123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389 |
- // Code generated by mdatagen. DO NOT EDIT.
- package metadata
- import (
- "time"
- "go.opentelemetry.io/collector/component"
- "go.opentelemetry.io/collector/pdata/pcommon"
- "go.opentelemetry.io/collector/pdata/pmetric"
- "go.opentelemetry.io/collector/receiver"
- )
- // AttributeBindType specifies the a value bind_type attribute.
- type AttributeBindType int
- const (
- _ AttributeBindType = iota
- AttributeBindTypeServer
- AttributeBindTypeClient
- )
- // String returns the string representation of the AttributeBindType.
- func (av AttributeBindType) String() string {
- switch av {
- case AttributeBindTypeServer:
- return "server"
- case AttributeBindTypeClient:
- return "client"
- }
- return ""
- }
- // MapAttributeBindType is a helper map of string to AttributeBindType attribute value.
- var MapAttributeBindType = map[string]AttributeBindType{
- "server": AttributeBindTypeServer,
- "client": AttributeBindTypeClient,
- }
- // AttributeDirection specifies the a value direction attribute.
- type AttributeDirection int
- const (
- _ AttributeDirection = iota
- AttributeDirectionSent
- AttributeDirectionReceived
- )
- // String returns the string representation of the AttributeDirection.
- func (av AttributeDirection) String() string {
- switch av {
- case AttributeDirectionSent:
- return "sent"
- case AttributeDirectionReceived:
- return "received"
- }
- return ""
- }
- // MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
- var MapAttributeDirection = map[string]AttributeDirection{
- "sent": AttributeDirectionSent,
- "received": AttributeDirectionReceived,
- }
- // AttributeNetworkDataType specifies the a value network_data_type attribute.
- type AttributeNetworkDataType int
- const (
- _ AttributeNetworkDataType = iota
- AttributeNetworkDataTypeCompressed
- AttributeNetworkDataTypeUncompressed
- )
- // String returns the string representation of the AttributeNetworkDataType.
- func (av AttributeNetworkDataType) String() string {
- switch av {
- case AttributeNetworkDataTypeCompressed:
- return "compressed"
- case AttributeNetworkDataTypeUncompressed:
- return "uncompressed"
- }
- return ""
- }
- // MapAttributeNetworkDataType is a helper map of string to AttributeNetworkDataType attribute value.
- var MapAttributeNetworkDataType = map[string]AttributeNetworkDataType{
- "compressed": AttributeNetworkDataTypeCompressed,
- "uncompressed": AttributeNetworkDataTypeUncompressed,
- }
- // AttributeOperationType specifies the a value operation_type attribute.
- type AttributeOperationType int
- const (
- _ AttributeOperationType = iota
- AttributeOperationTypeRead
- AttributeOperationTypeWrite
- AttributeOperationTypeSearch
- )
- // String returns the string representation of the AttributeOperationType.
- func (av AttributeOperationType) String() string {
- switch av {
- case AttributeOperationTypeRead:
- return "read"
- case AttributeOperationTypeWrite:
- return "write"
- case AttributeOperationTypeSearch:
- return "search"
- }
- return ""
- }
- // MapAttributeOperationType is a helper map of string to AttributeOperationType attribute value.
- var MapAttributeOperationType = map[string]AttributeOperationType{
- "read": AttributeOperationTypeRead,
- "write": AttributeOperationTypeWrite,
- "search": AttributeOperationTypeSearch,
- }
- // AttributeSuboperationType specifies the a value suboperation_type attribute.
- type AttributeSuboperationType int
- const (
- _ AttributeSuboperationType = iota
- AttributeSuboperationTypeSecurityDescriptorPropagationsEvent
- AttributeSuboperationTypeSearch
- )
- // String returns the string representation of the AttributeSuboperationType.
- func (av AttributeSuboperationType) String() string {
- switch av {
- case AttributeSuboperationTypeSecurityDescriptorPropagationsEvent:
- return "security_descriptor_propagations_event"
- case AttributeSuboperationTypeSearch:
- return "search"
- }
- return ""
- }
- // MapAttributeSuboperationType is a helper map of string to AttributeSuboperationType attribute value.
- var MapAttributeSuboperationType = map[string]AttributeSuboperationType{
- "security_descriptor_propagations_event": AttributeSuboperationTypeSecurityDescriptorPropagationsEvent,
- "search": AttributeSuboperationTypeSearch,
- }
- // AttributeSyncResult specifies the a value sync_result attribute.
- type AttributeSyncResult int
- const (
- _ AttributeSyncResult = iota
- AttributeSyncResultSuccess
- AttributeSyncResultSchemaMismatch
- AttributeSyncResultOther
- )
- // String returns the string representation of the AttributeSyncResult.
- func (av AttributeSyncResult) String() string {
- switch av {
- case AttributeSyncResultSuccess:
- return "success"
- case AttributeSyncResultSchemaMismatch:
- return "schema_mismatch"
- case AttributeSyncResultOther:
- return "other"
- }
- return ""
- }
- // MapAttributeSyncResult is a helper map of string to AttributeSyncResult attribute value.
- var MapAttributeSyncResult = map[string]AttributeSyncResult{
- "success": AttributeSyncResultSuccess,
- "schema_mismatch": AttributeSyncResultSchemaMismatch,
- "other": AttributeSyncResultOther,
- }
- // AttributeValueType specifies the a value value_type attribute.
- type AttributeValueType int
- const (
- _ AttributeValueType = iota
- AttributeValueTypeDistingushedNames
- AttributeValueTypeOther
- )
- // String returns the string representation of the AttributeValueType.
- func (av AttributeValueType) String() string {
- switch av {
- case AttributeValueTypeDistingushedNames:
- return "distingushed_names"
- case AttributeValueTypeOther:
- return "other"
- }
- return ""
- }
- // MapAttributeValueType is a helper map of string to AttributeValueType attribute value.
- var MapAttributeValueType = map[string]AttributeValueType{
- "distingushed_names": AttributeValueTypeDistingushedNames,
- "other": AttributeValueTypeOther,
- }
- type metricActiveDirectoryDsBindRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.bind.rate metric with initial data.
- func (m *metricActiveDirectoryDsBindRate) init() {
- m.data.SetName("active_directory.ds.bind.rate")
- m.data.SetDescription("The number of binds per second serviced by this domain controller.")
- m.data.SetUnit("{binds}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsBindRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, bindTypeAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("type", bindTypeAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsBindRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsBindRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsBindRate(cfg MetricConfig) metricActiveDirectoryDsBindRate {
- m := metricActiveDirectoryDsBindRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsLdapBindLastSuccessfulTime struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.ldap.bind.last_successful.time metric with initial data.
- func (m *metricActiveDirectoryDsLdapBindLastSuccessfulTime) init() {
- m.data.SetName("active_directory.ds.ldap.bind.last_successful.time")
- m.data.SetDescription("The amount of time taken for the last successful LDAP bind.")
- m.data.SetUnit("ms")
- m.data.SetEmptyGauge()
- }
- func (m *metricActiveDirectoryDsLdapBindLastSuccessfulTime) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Gauge().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsLdapBindLastSuccessfulTime) updateCapacity() {
- if m.data.Gauge().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Gauge().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsLdapBindLastSuccessfulTime) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsLdapBindLastSuccessfulTime(cfg MetricConfig) metricActiveDirectoryDsLdapBindLastSuccessfulTime {
- m := metricActiveDirectoryDsLdapBindLastSuccessfulTime{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsLdapBindRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.ldap.bind.rate metric with initial data.
- func (m *metricActiveDirectoryDsLdapBindRate) init() {
- m.data.SetName("active_directory.ds.ldap.bind.rate")
- m.data.SetDescription("The number of successful LDAP binds per second.")
- m.data.SetUnit("{binds}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsLdapBindRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsLdapBindRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsLdapBindRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsLdapBindRate(cfg MetricConfig) metricActiveDirectoryDsLdapBindRate {
- m := metricActiveDirectoryDsLdapBindRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsLdapClientSessionCount struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.ldap.client.session.count metric with initial data.
- func (m *metricActiveDirectoryDsLdapClientSessionCount) init() {
- m.data.SetName("active_directory.ds.ldap.client.session.count")
- m.data.SetDescription("The number of connected LDAP client sessions.")
- m.data.SetUnit("{sessions}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsLdapClientSessionCount) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsLdapClientSessionCount) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsLdapClientSessionCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsLdapClientSessionCount(cfg MetricConfig) metricActiveDirectoryDsLdapClientSessionCount {
- m := metricActiveDirectoryDsLdapClientSessionCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsLdapSearchRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.ldap.search.rate metric with initial data.
- func (m *metricActiveDirectoryDsLdapSearchRate) init() {
- m.data.SetName("active_directory.ds.ldap.search.rate")
- m.data.SetDescription("The number of LDAP searches per second.")
- m.data.SetUnit("{searches}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsLdapSearchRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsLdapSearchRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsLdapSearchRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsLdapSearchRate(cfg MetricConfig) metricActiveDirectoryDsLdapSearchRate {
- m := metricActiveDirectoryDsLdapSearchRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsNameCacheHitRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.name_cache.hit_rate metric with initial data.
- func (m *metricActiveDirectoryDsNameCacheHitRate) init() {
- m.data.SetName("active_directory.ds.name_cache.hit_rate")
- m.data.SetDescription("The percentage of directory object name component lookups that are satisfied by the Directory System Agent's name cache.")
- m.data.SetUnit("%")
- m.data.SetEmptyGauge()
- }
- func (m *metricActiveDirectoryDsNameCacheHitRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Gauge().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsNameCacheHitRate) updateCapacity() {
- if m.data.Gauge().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Gauge().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsNameCacheHitRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsNameCacheHitRate(cfg MetricConfig) metricActiveDirectoryDsNameCacheHitRate {
- m := metricActiveDirectoryDsNameCacheHitRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsNotificationQueued struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.notification.queued metric with initial data.
- func (m *metricActiveDirectoryDsNotificationQueued) init() {
- m.data.SetName("active_directory.ds.notification.queued")
- m.data.SetDescription("The number of pending update notifications that have been queued to push to clients.")
- m.data.SetUnit("{notifications}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsNotificationQueued) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsNotificationQueued) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsNotificationQueued) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsNotificationQueued(cfg MetricConfig) metricActiveDirectoryDsNotificationQueued {
- m := metricActiveDirectoryDsNotificationQueued{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsOperationRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.operation.rate metric with initial data.
- func (m *metricActiveDirectoryDsOperationRate) init() {
- m.data.SetName("active_directory.ds.operation.rate")
- m.data.SetDescription("The number of operations performed per second.")
- m.data.SetUnit("{operations}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsOperationRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, operationTypeAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("type", operationTypeAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsOperationRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsOperationRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsOperationRate(cfg MetricConfig) metricActiveDirectoryDsOperationRate {
- m := metricActiveDirectoryDsOperationRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationNetworkIo struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.network.io metric with initial data.
- func (m *metricActiveDirectoryDsReplicationNetworkIo) init() {
- m.data.SetName("active_directory.ds.replication.network.io")
- m.data.SetDescription("The amount of network data transmitted by the Directory Replication Agent.")
- m.data.SetUnit("By")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(true)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsReplicationNetworkIo) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, directionAttributeValue string, networkDataTypeAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- dp.Attributes().PutStr("direction", directionAttributeValue)
- dp.Attributes().PutStr("type", networkDataTypeAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationNetworkIo) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationNetworkIo) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationNetworkIo(cfg MetricConfig) metricActiveDirectoryDsReplicationNetworkIo {
- m := metricActiveDirectoryDsReplicationNetworkIo{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationObjectRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.object.rate metric with initial data.
- func (m *metricActiveDirectoryDsReplicationObjectRate) init() {
- m.data.SetName("active_directory.ds.replication.object.rate")
- m.data.SetDescription("The number of objects transmitted by the Directory Replication Agent per second.")
- m.data.SetUnit("{objects}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsReplicationObjectRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, directionAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("direction", directionAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationObjectRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationObjectRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationObjectRate(cfg MetricConfig) metricActiveDirectoryDsReplicationObjectRate {
- m := metricActiveDirectoryDsReplicationObjectRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationOperationPending struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.operation.pending metric with initial data.
- func (m *metricActiveDirectoryDsReplicationOperationPending) init() {
- m.data.SetName("active_directory.ds.replication.operation.pending")
- m.data.SetDescription("The number of pending replication operations for the Directory Replication Agent.")
- m.data.SetUnit("{operations}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsReplicationOperationPending) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationOperationPending) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationOperationPending) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationOperationPending(cfg MetricConfig) metricActiveDirectoryDsReplicationOperationPending {
- m := metricActiveDirectoryDsReplicationOperationPending{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationPropertyRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.property.rate metric with initial data.
- func (m *metricActiveDirectoryDsReplicationPropertyRate) init() {
- m.data.SetName("active_directory.ds.replication.property.rate")
- m.data.SetDescription("The number of properties transmitted by the Directory Replication Agent per second.")
- m.data.SetUnit("{properties}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsReplicationPropertyRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, directionAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("direction", directionAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationPropertyRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationPropertyRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationPropertyRate(cfg MetricConfig) metricActiveDirectoryDsReplicationPropertyRate {
- m := metricActiveDirectoryDsReplicationPropertyRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationSyncObjectPending struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.sync.object.pending metric with initial data.
- func (m *metricActiveDirectoryDsReplicationSyncObjectPending) init() {
- m.data.SetName("active_directory.ds.replication.sync.object.pending")
- m.data.SetDescription("The number of objects remaining until the full sync completes for the Directory Replication Agent.")
- m.data.SetUnit("{objects}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsReplicationSyncObjectPending) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationSyncObjectPending) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationSyncObjectPending) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationSyncObjectPending(cfg MetricConfig) metricActiveDirectoryDsReplicationSyncObjectPending {
- m := metricActiveDirectoryDsReplicationSyncObjectPending{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationSyncRequestCount struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.sync.request.count metric with initial data.
- func (m *metricActiveDirectoryDsReplicationSyncRequestCount) init() {
- m.data.SetName("active_directory.ds.replication.sync.request.count")
- m.data.SetDescription("The number of sync requests made by the Directory Replication Agent.")
- m.data.SetUnit("{requests}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(true)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsReplicationSyncRequestCount) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, syncResultAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- dp.Attributes().PutStr("result", syncResultAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationSyncRequestCount) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationSyncRequestCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationSyncRequestCount(cfg MetricConfig) metricActiveDirectoryDsReplicationSyncRequestCount {
- m := metricActiveDirectoryDsReplicationSyncRequestCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsReplicationValueRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.replication.value.rate metric with initial data.
- func (m *metricActiveDirectoryDsReplicationValueRate) init() {
- m.data.SetName("active_directory.ds.replication.value.rate")
- m.data.SetDescription("The number of values transmitted by the Directory Replication Agent per second.")
- m.data.SetUnit("{values}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsReplicationValueRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, directionAttributeValue string, valueTypeAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("direction", directionAttributeValue)
- dp.Attributes().PutStr("type", valueTypeAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsReplicationValueRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsReplicationValueRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsReplicationValueRate(cfg MetricConfig) metricActiveDirectoryDsReplicationValueRate {
- m := metricActiveDirectoryDsReplicationValueRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.security_descriptor_propagations_event.queued metric with initial data.
- func (m *metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued) init() {
- m.data.SetName("active_directory.ds.security_descriptor_propagations_event.queued")
- m.data.SetDescription("The number of security descriptor propagation events that are queued for processing.")
- m.data.SetUnit("{events}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued(cfg MetricConfig) metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued {
- m := metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsSuboperationRate struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.suboperation.rate metric with initial data.
- func (m *metricActiveDirectoryDsSuboperationRate) init() {
- m.data.SetName("active_directory.ds.suboperation.rate")
- m.data.SetDescription("The rate of sub-operations performed.")
- m.data.SetUnit("{suboperations}/s")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricActiveDirectoryDsSuboperationRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64, suboperationTypeAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetDoubleValue(val)
- dp.Attributes().PutStr("type", suboperationTypeAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsSuboperationRate) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsSuboperationRate) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsSuboperationRate(cfg MetricConfig) metricActiveDirectoryDsSuboperationRate {
- m := metricActiveDirectoryDsSuboperationRate{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricActiveDirectoryDsThreadCount struct {
- data pmetric.Metric // data buffer for generated metric.
- config MetricConfig // metric config provided by user.
- capacity int // max observed number of data points added to the metric.
- }
- // init fills active_directory.ds.thread.count metric with initial data.
- func (m *metricActiveDirectoryDsThreadCount) init() {
- m.data.SetName("active_directory.ds.thread.count")
- m.data.SetDescription("The number of threads in use by the directory service.")
- m.data.SetUnit("{threads}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricActiveDirectoryDsThreadCount) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricActiveDirectoryDsThreadCount) updateCapacity() {
- if m.data.Sum().DataPoints().Len() > m.capacity {
- m.capacity = m.data.Sum().DataPoints().Len()
- }
- }
- // emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points.
- func (m *metricActiveDirectoryDsThreadCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricActiveDirectoryDsThreadCount(cfg MetricConfig) metricActiveDirectoryDsThreadCount {
- m := metricActiveDirectoryDsThreadCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- // MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations
- // required to produce metric representation defined in metadata and user config.
- type MetricsBuilder struct {
- config MetricsBuilderConfig // config of the metrics builder.
- startTime pcommon.Timestamp // start time that will be applied to all recorded data points.
- metricsCapacity int // maximum observed number of metrics per resource.
- metricsBuffer pmetric.Metrics // accumulates metrics data before emitting.
- buildInfo component.BuildInfo // contains version information.
- metricActiveDirectoryDsBindRate metricActiveDirectoryDsBindRate
- metricActiveDirectoryDsLdapBindLastSuccessfulTime metricActiveDirectoryDsLdapBindLastSuccessfulTime
- metricActiveDirectoryDsLdapBindRate metricActiveDirectoryDsLdapBindRate
- metricActiveDirectoryDsLdapClientSessionCount metricActiveDirectoryDsLdapClientSessionCount
- metricActiveDirectoryDsLdapSearchRate metricActiveDirectoryDsLdapSearchRate
- metricActiveDirectoryDsNameCacheHitRate metricActiveDirectoryDsNameCacheHitRate
- metricActiveDirectoryDsNotificationQueued metricActiveDirectoryDsNotificationQueued
- metricActiveDirectoryDsOperationRate metricActiveDirectoryDsOperationRate
- metricActiveDirectoryDsReplicationNetworkIo metricActiveDirectoryDsReplicationNetworkIo
- metricActiveDirectoryDsReplicationObjectRate metricActiveDirectoryDsReplicationObjectRate
- metricActiveDirectoryDsReplicationOperationPending metricActiveDirectoryDsReplicationOperationPending
- metricActiveDirectoryDsReplicationPropertyRate metricActiveDirectoryDsReplicationPropertyRate
- metricActiveDirectoryDsReplicationSyncObjectPending metricActiveDirectoryDsReplicationSyncObjectPending
- metricActiveDirectoryDsReplicationSyncRequestCount metricActiveDirectoryDsReplicationSyncRequestCount
- metricActiveDirectoryDsReplicationValueRate metricActiveDirectoryDsReplicationValueRate
- metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued
- metricActiveDirectoryDsSuboperationRate metricActiveDirectoryDsSuboperationRate
- metricActiveDirectoryDsThreadCount metricActiveDirectoryDsThreadCount
- }
- // metricBuilderOption applies changes to default metrics builder.
- type metricBuilderOption func(*MetricsBuilder)
- // WithStartTime sets startTime on the metrics builder.
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption {
- return func(mb *MetricsBuilder) {
- mb.startTime = startTime
- }
- }
- func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder {
- mb := &MetricsBuilder{
- config: mbc,
- startTime: pcommon.NewTimestampFromTime(time.Now()),
- metricsBuffer: pmetric.NewMetrics(),
- buildInfo: settings.BuildInfo,
- metricActiveDirectoryDsBindRate: newMetricActiveDirectoryDsBindRate(mbc.Metrics.ActiveDirectoryDsBindRate),
- metricActiveDirectoryDsLdapBindLastSuccessfulTime: newMetricActiveDirectoryDsLdapBindLastSuccessfulTime(mbc.Metrics.ActiveDirectoryDsLdapBindLastSuccessfulTime),
- metricActiveDirectoryDsLdapBindRate: newMetricActiveDirectoryDsLdapBindRate(mbc.Metrics.ActiveDirectoryDsLdapBindRate),
- metricActiveDirectoryDsLdapClientSessionCount: newMetricActiveDirectoryDsLdapClientSessionCount(mbc.Metrics.ActiveDirectoryDsLdapClientSessionCount),
- metricActiveDirectoryDsLdapSearchRate: newMetricActiveDirectoryDsLdapSearchRate(mbc.Metrics.ActiveDirectoryDsLdapSearchRate),
- metricActiveDirectoryDsNameCacheHitRate: newMetricActiveDirectoryDsNameCacheHitRate(mbc.Metrics.ActiveDirectoryDsNameCacheHitRate),
- metricActiveDirectoryDsNotificationQueued: newMetricActiveDirectoryDsNotificationQueued(mbc.Metrics.ActiveDirectoryDsNotificationQueued),
- metricActiveDirectoryDsOperationRate: newMetricActiveDirectoryDsOperationRate(mbc.Metrics.ActiveDirectoryDsOperationRate),
- metricActiveDirectoryDsReplicationNetworkIo: newMetricActiveDirectoryDsReplicationNetworkIo(mbc.Metrics.ActiveDirectoryDsReplicationNetworkIo),
- metricActiveDirectoryDsReplicationObjectRate: newMetricActiveDirectoryDsReplicationObjectRate(mbc.Metrics.ActiveDirectoryDsReplicationObjectRate),
- metricActiveDirectoryDsReplicationOperationPending: newMetricActiveDirectoryDsReplicationOperationPending(mbc.Metrics.ActiveDirectoryDsReplicationOperationPending),
- metricActiveDirectoryDsReplicationPropertyRate: newMetricActiveDirectoryDsReplicationPropertyRate(mbc.Metrics.ActiveDirectoryDsReplicationPropertyRate),
- metricActiveDirectoryDsReplicationSyncObjectPending: newMetricActiveDirectoryDsReplicationSyncObjectPending(mbc.Metrics.ActiveDirectoryDsReplicationSyncObjectPending),
- metricActiveDirectoryDsReplicationSyncRequestCount: newMetricActiveDirectoryDsReplicationSyncRequestCount(mbc.Metrics.ActiveDirectoryDsReplicationSyncRequestCount),
- metricActiveDirectoryDsReplicationValueRate: newMetricActiveDirectoryDsReplicationValueRate(mbc.Metrics.ActiveDirectoryDsReplicationValueRate),
- metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued: newMetricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued(mbc.Metrics.ActiveDirectoryDsSecurityDescriptorPropagationsEventQueued),
- metricActiveDirectoryDsSuboperationRate: newMetricActiveDirectoryDsSuboperationRate(mbc.Metrics.ActiveDirectoryDsSuboperationRate),
- metricActiveDirectoryDsThreadCount: newMetricActiveDirectoryDsThreadCount(mbc.Metrics.ActiveDirectoryDsThreadCount),
- }
- for _, op := range options {
- op(mb)
- }
- return mb
- }
- // updateCapacity updates max length of metrics and resource attributes that will be used for the slice capacity.
- func (mb *MetricsBuilder) updateCapacity(rm pmetric.ResourceMetrics) {
- if mb.metricsCapacity < rm.ScopeMetrics().At(0).Metrics().Len() {
- mb.metricsCapacity = rm.ScopeMetrics().At(0).Metrics().Len()
- }
- }
- // ResourceMetricsOption applies changes to provided resource metrics.
- type ResourceMetricsOption func(pmetric.ResourceMetrics)
- // WithResource sets the provided resource on the emitted ResourceMetrics.
- // It's recommended to use ResourceBuilder to create the resource.
- func WithResource(res pcommon.Resource) ResourceMetricsOption {
- return func(rm pmetric.ResourceMetrics) {
- res.CopyTo(rm.Resource())
- }
- }
- // WithStartTimeOverride overrides start time for all the resource metrics data points.
- // This option should be only used if different start time has to be set on metrics coming from different resources.
- func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption {
- return func(rm pmetric.ResourceMetrics) {
- var dps pmetric.NumberDataPointSlice
- metrics := rm.ScopeMetrics().At(0).Metrics()
- for i := 0; i < metrics.Len(); i++ {
- switch metrics.At(i).Type() {
- case pmetric.MetricTypeGauge:
- dps = metrics.At(i).Gauge().DataPoints()
- case pmetric.MetricTypeSum:
- dps = metrics.At(i).Sum().DataPoints()
- }
- for j := 0; j < dps.Len(); j++ {
- dps.At(j).SetStartTimestamp(start)
- }
- }
- }
- }
- // EmitForResource saves all the generated metrics under a new resource and updates the internal state to be ready for
- // recording another set of data points as part of another resource. This function can be helpful when one scraper
- // needs to emit metrics from several resources. Otherwise calling this function is not required,
- // just `Emit` function can be called instead.
- // Resource attributes should be provided as ResourceMetricsOption arguments.
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) {
- rm := pmetric.NewResourceMetrics()
- ils := rm.ScopeMetrics().AppendEmpty()
- ils.Scope().SetName("otelcol/activedirectorydsreceiver")
- ils.Scope().SetVersion(mb.buildInfo.Version)
- ils.Metrics().EnsureCapacity(mb.metricsCapacity)
- mb.metricActiveDirectoryDsBindRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsLdapBindLastSuccessfulTime.emit(ils.Metrics())
- mb.metricActiveDirectoryDsLdapBindRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsLdapClientSessionCount.emit(ils.Metrics())
- mb.metricActiveDirectoryDsLdapSearchRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsNameCacheHitRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsNotificationQueued.emit(ils.Metrics())
- mb.metricActiveDirectoryDsOperationRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationNetworkIo.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationObjectRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationOperationPending.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationPropertyRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationSyncObjectPending.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationSyncRequestCount.emit(ils.Metrics())
- mb.metricActiveDirectoryDsReplicationValueRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued.emit(ils.Metrics())
- mb.metricActiveDirectoryDsSuboperationRate.emit(ils.Metrics())
- mb.metricActiveDirectoryDsThreadCount.emit(ils.Metrics())
- for _, op := range rmo {
- op(rm)
- }
- if ils.Metrics().Len() > 0 {
- mb.updateCapacity(rm)
- rm.MoveTo(mb.metricsBuffer.ResourceMetrics().AppendEmpty())
- }
- }
- // Emit returns all the metrics accumulated by the metrics builder and updates the internal state to be ready for
- // recording another set of metrics. This function will be responsible for applying all the transformations required to
- // produce metric representation defined in metadata and user config, e.g. delta or cumulative.
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics {
- mb.EmitForResource(rmo...)
- metrics := mb.metricsBuffer
- mb.metricsBuffer = pmetric.NewMetrics()
- return metrics
- }
- // RecordActiveDirectoryDsBindRateDataPoint adds a data point to active_directory.ds.bind.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsBindRateDataPoint(ts pcommon.Timestamp, val float64, bindTypeAttributeValue AttributeBindType) {
- mb.metricActiveDirectoryDsBindRate.recordDataPoint(mb.startTime, ts, val, bindTypeAttributeValue.String())
- }
- // RecordActiveDirectoryDsLdapBindLastSuccessfulTimeDataPoint adds a data point to active_directory.ds.ldap.bind.last_successful.time metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsLdapBindLastSuccessfulTimeDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsLdapBindLastSuccessfulTime.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsLdapBindRateDataPoint adds a data point to active_directory.ds.ldap.bind.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsLdapBindRateDataPoint(ts pcommon.Timestamp, val float64) {
- mb.metricActiveDirectoryDsLdapBindRate.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsLdapClientSessionCountDataPoint adds a data point to active_directory.ds.ldap.client.session.count metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsLdapClientSessionCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsLdapClientSessionCount.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsLdapSearchRateDataPoint adds a data point to active_directory.ds.ldap.search.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsLdapSearchRateDataPoint(ts pcommon.Timestamp, val float64) {
- mb.metricActiveDirectoryDsLdapSearchRate.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsNameCacheHitRateDataPoint adds a data point to active_directory.ds.name_cache.hit_rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsNameCacheHitRateDataPoint(ts pcommon.Timestamp, val float64) {
- mb.metricActiveDirectoryDsNameCacheHitRate.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsNotificationQueuedDataPoint adds a data point to active_directory.ds.notification.queued metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsNotificationQueuedDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsNotificationQueued.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsOperationRateDataPoint adds a data point to active_directory.ds.operation.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsOperationRateDataPoint(ts pcommon.Timestamp, val float64, operationTypeAttributeValue AttributeOperationType) {
- mb.metricActiveDirectoryDsOperationRate.recordDataPoint(mb.startTime, ts, val, operationTypeAttributeValue.String())
- }
- // RecordActiveDirectoryDsReplicationNetworkIoDataPoint adds a data point to active_directory.ds.replication.network.io metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationNetworkIoDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection, networkDataTypeAttributeValue AttributeNetworkDataType) {
- mb.metricActiveDirectoryDsReplicationNetworkIo.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String(), networkDataTypeAttributeValue.String())
- }
- // RecordActiveDirectoryDsReplicationObjectRateDataPoint adds a data point to active_directory.ds.replication.object.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationObjectRateDataPoint(ts pcommon.Timestamp, val float64, directionAttributeValue AttributeDirection) {
- mb.metricActiveDirectoryDsReplicationObjectRate.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String())
- }
- // RecordActiveDirectoryDsReplicationOperationPendingDataPoint adds a data point to active_directory.ds.replication.operation.pending metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationOperationPendingDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsReplicationOperationPending.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsReplicationPropertyRateDataPoint adds a data point to active_directory.ds.replication.property.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationPropertyRateDataPoint(ts pcommon.Timestamp, val float64, directionAttributeValue AttributeDirection) {
- mb.metricActiveDirectoryDsReplicationPropertyRate.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String())
- }
- // RecordActiveDirectoryDsReplicationSyncObjectPendingDataPoint adds a data point to active_directory.ds.replication.sync.object.pending metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationSyncObjectPendingDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsReplicationSyncObjectPending.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsReplicationSyncRequestCountDataPoint adds a data point to active_directory.ds.replication.sync.request.count metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationSyncRequestCountDataPoint(ts pcommon.Timestamp, val int64, syncResultAttributeValue AttributeSyncResult) {
- mb.metricActiveDirectoryDsReplicationSyncRequestCount.recordDataPoint(mb.startTime, ts, val, syncResultAttributeValue.String())
- }
- // RecordActiveDirectoryDsReplicationValueRateDataPoint adds a data point to active_directory.ds.replication.value.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsReplicationValueRateDataPoint(ts pcommon.Timestamp, val float64, directionAttributeValue AttributeDirection, valueTypeAttributeValue AttributeValueType) {
- mb.metricActiveDirectoryDsReplicationValueRate.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String(), valueTypeAttributeValue.String())
- }
- // RecordActiveDirectoryDsSecurityDescriptorPropagationsEventQueuedDataPoint adds a data point to active_directory.ds.security_descriptor_propagations_event.queued metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsSecurityDescriptorPropagationsEventQueuedDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordActiveDirectoryDsSuboperationRateDataPoint adds a data point to active_directory.ds.suboperation.rate metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsSuboperationRateDataPoint(ts pcommon.Timestamp, val float64, suboperationTypeAttributeValue AttributeSuboperationType) {
- mb.metricActiveDirectoryDsSuboperationRate.recordDataPoint(mb.startTime, ts, val, suboperationTypeAttributeValue.String())
- }
- // RecordActiveDirectoryDsThreadCountDataPoint adds a data point to active_directory.ds.thread.count metric.
- func (mb *MetricsBuilder) RecordActiveDirectoryDsThreadCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricActiveDirectoryDsThreadCount.recordDataPoint(mb.startTime, ts, val)
- }
- // Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted,
- // and metrics builder should update its startTime and reset it's internal state accordingly.
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption) {
- mb.startTime = pcommon.NewTimestampFromTime(time.Now())
- for _, op := range options {
- op(mb)
- }
- }
|