12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118 |
- // 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"
- )
- // AttributeDirection specifies the a value direction attribute.
- type AttributeDirection int
- const (
- _ AttributeDirection = iota
- AttributeDirectionReceived
- AttributeDirectionSent
- )
- // String returns the string representation of the AttributeDirection.
- func (av AttributeDirection) String() string {
- switch av {
- case AttributeDirectionReceived:
- return "received"
- case AttributeDirectionSent:
- return "sent"
- }
- return ""
- }
- // MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
- var MapAttributeDirection = map[string]AttributeDirection{
- "received": AttributeDirectionReceived,
- "sent": AttributeDirectionSent,
- }
- // AttributeState specifies the a value state attribute.
- type AttributeState int
- const (
- _ AttributeState = iota
- AttributeStateSynced
- AttributeStateUnsynced
- )
- // String returns the string representation of the AttributeState.
- func (av AttributeState) String() string {
- switch av {
- case AttributeStateSynced:
- return "synced"
- case AttributeStateUnsynced:
- return "unsynced"
- }
- return ""
- }
- // MapAttributeState is a helper map of string to AttributeState attribute value.
- var MapAttributeState = map[string]AttributeState{
- "synced": AttributeStateSynced,
- "unsynced": AttributeStateUnsynced,
- }
- type metricZookeeperConnectionActive 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 zookeeper.connection.active metric with initial data.
- func (m *metricZookeeperConnectionActive) init() {
- m.data.SetName("zookeeper.connection.active")
- m.data.SetDescription("Number of active clients connected to a ZooKeeper server.")
- m.data.SetUnit("{connections}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperConnectionActive) 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 *metricZookeeperConnectionActive) 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 *metricZookeeperConnectionActive) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperConnectionActive(cfg MetricConfig) metricZookeeperConnectionActive {
- m := metricZookeeperConnectionActive{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperDataTreeEphemeralNodeCount 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 zookeeper.data_tree.ephemeral_node.count metric with initial data.
- func (m *metricZookeeperDataTreeEphemeralNodeCount) init() {
- m.data.SetName("zookeeper.data_tree.ephemeral_node.count")
- m.data.SetDescription("Number of ephemeral nodes that a ZooKeeper server has in its data tree.")
- m.data.SetUnit("{nodes}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperDataTreeEphemeralNodeCount) 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 *metricZookeeperDataTreeEphemeralNodeCount) 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 *metricZookeeperDataTreeEphemeralNodeCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperDataTreeEphemeralNodeCount(cfg MetricConfig) metricZookeeperDataTreeEphemeralNodeCount {
- m := metricZookeeperDataTreeEphemeralNodeCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperDataTreeSize 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 zookeeper.data_tree.size metric with initial data.
- func (m *metricZookeeperDataTreeSize) init() {
- m.data.SetName("zookeeper.data_tree.size")
- m.data.SetDescription("Size of data in bytes that a ZooKeeper server has in its data tree.")
- m.data.SetUnit("By")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperDataTreeSize) 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 *metricZookeeperDataTreeSize) 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 *metricZookeeperDataTreeSize) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperDataTreeSize(cfg MetricConfig) metricZookeeperDataTreeSize {
- m := metricZookeeperDataTreeSize{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperFileDescriptorLimit 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 zookeeper.file_descriptor.limit metric with initial data.
- func (m *metricZookeeperFileDescriptorLimit) init() {
- m.data.SetName("zookeeper.file_descriptor.limit")
- m.data.SetDescription("Maximum number of file descriptors that a ZooKeeper server can open.")
- m.data.SetUnit("{file_descriptors}")
- m.data.SetEmptyGauge()
- }
- func (m *metricZookeeperFileDescriptorLimit) 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 *metricZookeeperFileDescriptorLimit) 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 *metricZookeeperFileDescriptorLimit) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperFileDescriptorLimit(cfg MetricConfig) metricZookeeperFileDescriptorLimit {
- m := metricZookeeperFileDescriptorLimit{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperFileDescriptorOpen 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 zookeeper.file_descriptor.open metric with initial data.
- func (m *metricZookeeperFileDescriptorOpen) init() {
- m.data.SetName("zookeeper.file_descriptor.open")
- m.data.SetDescription("Number of file descriptors that a ZooKeeper server has open.")
- m.data.SetUnit("{file_descriptors}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperFileDescriptorOpen) 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 *metricZookeeperFileDescriptorOpen) 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 *metricZookeeperFileDescriptorOpen) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperFileDescriptorOpen(cfg MetricConfig) metricZookeeperFileDescriptorOpen {
- m := metricZookeeperFileDescriptorOpen{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperFollowerCount 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 zookeeper.follower.count metric with initial data.
- func (m *metricZookeeperFollowerCount) init() {
- m.data.SetName("zookeeper.follower.count")
- m.data.SetDescription("The number of followers. Only exposed by the leader.")
- m.data.SetUnit("{followers}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricZookeeperFollowerCount) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, stateAttributeValue string) {
- if !m.config.Enabled {
- return
- }
- dp := m.data.Sum().DataPoints().AppendEmpty()
- dp.SetStartTimestamp(start)
- dp.SetTimestamp(ts)
- dp.SetIntValue(val)
- dp.Attributes().PutStr("state", stateAttributeValue)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricZookeeperFollowerCount) 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 *metricZookeeperFollowerCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperFollowerCount(cfg MetricConfig) metricZookeeperFollowerCount {
- m := metricZookeeperFollowerCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperFsyncExceededThresholdCount 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 zookeeper.fsync.exceeded_threshold.count metric with initial data.
- func (m *metricZookeeperFsyncExceededThresholdCount) init() {
- m.data.SetName("zookeeper.fsync.exceeded_threshold.count")
- m.data.SetDescription("Number of times fsync duration has exceeded warning threshold.")
- m.data.SetUnit("{events}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(true)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperFsyncExceededThresholdCount) 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 *metricZookeeperFsyncExceededThresholdCount) 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 *metricZookeeperFsyncExceededThresholdCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperFsyncExceededThresholdCount(cfg MetricConfig) metricZookeeperFsyncExceededThresholdCount {
- m := metricZookeeperFsyncExceededThresholdCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperLatencyAvg 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 zookeeper.latency.avg metric with initial data.
- func (m *metricZookeeperLatencyAvg) init() {
- m.data.SetName("zookeeper.latency.avg")
- m.data.SetDescription("Average time in milliseconds for requests to be processed.")
- m.data.SetUnit("ms")
- m.data.SetEmptyGauge()
- }
- func (m *metricZookeeperLatencyAvg) 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 *metricZookeeperLatencyAvg) 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 *metricZookeeperLatencyAvg) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperLatencyAvg(cfg MetricConfig) metricZookeeperLatencyAvg {
- m := metricZookeeperLatencyAvg{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperLatencyMax 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 zookeeper.latency.max metric with initial data.
- func (m *metricZookeeperLatencyMax) init() {
- m.data.SetName("zookeeper.latency.max")
- m.data.SetDescription("Maximum time in milliseconds for requests to be processed.")
- m.data.SetUnit("ms")
- m.data.SetEmptyGauge()
- }
- func (m *metricZookeeperLatencyMax) 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 *metricZookeeperLatencyMax) 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 *metricZookeeperLatencyMax) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperLatencyMax(cfg MetricConfig) metricZookeeperLatencyMax {
- m := metricZookeeperLatencyMax{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperLatencyMin 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 zookeeper.latency.min metric with initial data.
- func (m *metricZookeeperLatencyMin) init() {
- m.data.SetName("zookeeper.latency.min")
- m.data.SetDescription("Minimum time in milliseconds for requests to be processed.")
- m.data.SetUnit("ms")
- m.data.SetEmptyGauge()
- }
- func (m *metricZookeeperLatencyMin) 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 *metricZookeeperLatencyMin) 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 *metricZookeeperLatencyMin) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperLatencyMin(cfg MetricConfig) metricZookeeperLatencyMin {
- m := metricZookeeperLatencyMin{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperPacketCount 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 zookeeper.packet.count metric with initial data.
- func (m *metricZookeeperPacketCount) init() {
- m.data.SetName("zookeeper.packet.count")
- m.data.SetDescription("The number of ZooKeeper packets received or sent by a server.")
- m.data.SetUnit("{packets}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(true)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- m.data.Sum().DataPoints().EnsureCapacity(m.capacity)
- }
- func (m *metricZookeeperPacketCount) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, directionAttributeValue 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)
- }
- // updateCapacity saves max length of data point slices that will be used for the slice capacity.
- func (m *metricZookeeperPacketCount) 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 *metricZookeeperPacketCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperPacketCount(cfg MetricConfig) metricZookeeperPacketCount {
- m := metricZookeeperPacketCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperRequestActive 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 zookeeper.request.active metric with initial data.
- func (m *metricZookeeperRequestActive) init() {
- m.data.SetName("zookeeper.request.active")
- m.data.SetDescription("Number of currently executing requests.")
- m.data.SetUnit("{requests}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperRequestActive) 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 *metricZookeeperRequestActive) 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 *metricZookeeperRequestActive) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperRequestActive(cfg MetricConfig) metricZookeeperRequestActive {
- m := metricZookeeperRequestActive{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperRuok 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 zookeeper.ruok metric with initial data.
- func (m *metricZookeeperRuok) init() {
- m.data.SetName("zookeeper.ruok")
- m.data.SetDescription("Response from zookeeper ruok command")
- m.data.SetUnit("1")
- m.data.SetEmptyGauge()
- }
- func (m *metricZookeeperRuok) 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 *metricZookeeperRuok) 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 *metricZookeeperRuok) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperRuok(cfg MetricConfig) metricZookeeperRuok {
- m := metricZookeeperRuok{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperSyncPending 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 zookeeper.sync.pending metric with initial data.
- func (m *metricZookeeperSyncPending) init() {
- m.data.SetName("zookeeper.sync.pending")
- m.data.SetDescription("The number of pending syncs from the followers. Only exposed by the leader.")
- m.data.SetUnit("{syncs}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperSyncPending) 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 *metricZookeeperSyncPending) 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 *metricZookeeperSyncPending) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperSyncPending(cfg MetricConfig) metricZookeeperSyncPending {
- m := metricZookeeperSyncPending{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperWatchCount 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 zookeeper.watch.count metric with initial data.
- func (m *metricZookeeperWatchCount) init() {
- m.data.SetName("zookeeper.watch.count")
- m.data.SetDescription("Number of watches placed on Z-Nodes on a ZooKeeper server.")
- m.data.SetUnit("{watches}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperWatchCount) 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 *metricZookeeperWatchCount) 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 *metricZookeeperWatchCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperWatchCount(cfg MetricConfig) metricZookeeperWatchCount {
- m := metricZookeeperWatchCount{config: cfg}
- if cfg.Enabled {
- m.data = pmetric.NewMetric()
- m.init()
- }
- return m
- }
- type metricZookeeperZnodeCount 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 zookeeper.znode.count metric with initial data.
- func (m *metricZookeeperZnodeCount) init() {
- m.data.SetName("zookeeper.znode.count")
- m.data.SetDescription("Number of z-nodes that a ZooKeeper server has in its data tree.")
- m.data.SetUnit("{znodes}")
- m.data.SetEmptySum()
- m.data.Sum().SetIsMonotonic(false)
- m.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
- }
- func (m *metricZookeeperZnodeCount) 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 *metricZookeeperZnodeCount) 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 *metricZookeeperZnodeCount) emit(metrics pmetric.MetricSlice) {
- if m.config.Enabled && m.data.Sum().DataPoints().Len() > 0 {
- m.updateCapacity()
- m.data.MoveTo(metrics.AppendEmpty())
- m.init()
- }
- }
- func newMetricZookeeperZnodeCount(cfg MetricConfig) metricZookeeperZnodeCount {
- m := metricZookeeperZnodeCount{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.
- metricZookeeperConnectionActive metricZookeeperConnectionActive
- metricZookeeperDataTreeEphemeralNodeCount metricZookeeperDataTreeEphemeralNodeCount
- metricZookeeperDataTreeSize metricZookeeperDataTreeSize
- metricZookeeperFileDescriptorLimit metricZookeeperFileDescriptorLimit
- metricZookeeperFileDescriptorOpen metricZookeeperFileDescriptorOpen
- metricZookeeperFollowerCount metricZookeeperFollowerCount
- metricZookeeperFsyncExceededThresholdCount metricZookeeperFsyncExceededThresholdCount
- metricZookeeperLatencyAvg metricZookeeperLatencyAvg
- metricZookeeperLatencyMax metricZookeeperLatencyMax
- metricZookeeperLatencyMin metricZookeeperLatencyMin
- metricZookeeperPacketCount metricZookeeperPacketCount
- metricZookeeperRequestActive metricZookeeperRequestActive
- metricZookeeperRuok metricZookeeperRuok
- metricZookeeperSyncPending metricZookeeperSyncPending
- metricZookeeperWatchCount metricZookeeperWatchCount
- metricZookeeperZnodeCount metricZookeeperZnodeCount
- }
- // 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,
- metricZookeeperConnectionActive: newMetricZookeeperConnectionActive(mbc.Metrics.ZookeeperConnectionActive),
- metricZookeeperDataTreeEphemeralNodeCount: newMetricZookeeperDataTreeEphemeralNodeCount(mbc.Metrics.ZookeeperDataTreeEphemeralNodeCount),
- metricZookeeperDataTreeSize: newMetricZookeeperDataTreeSize(mbc.Metrics.ZookeeperDataTreeSize),
- metricZookeeperFileDescriptorLimit: newMetricZookeeperFileDescriptorLimit(mbc.Metrics.ZookeeperFileDescriptorLimit),
- metricZookeeperFileDescriptorOpen: newMetricZookeeperFileDescriptorOpen(mbc.Metrics.ZookeeperFileDescriptorOpen),
- metricZookeeperFollowerCount: newMetricZookeeperFollowerCount(mbc.Metrics.ZookeeperFollowerCount),
- metricZookeeperFsyncExceededThresholdCount: newMetricZookeeperFsyncExceededThresholdCount(mbc.Metrics.ZookeeperFsyncExceededThresholdCount),
- metricZookeeperLatencyAvg: newMetricZookeeperLatencyAvg(mbc.Metrics.ZookeeperLatencyAvg),
- metricZookeeperLatencyMax: newMetricZookeeperLatencyMax(mbc.Metrics.ZookeeperLatencyMax),
- metricZookeeperLatencyMin: newMetricZookeeperLatencyMin(mbc.Metrics.ZookeeperLatencyMin),
- metricZookeeperPacketCount: newMetricZookeeperPacketCount(mbc.Metrics.ZookeeperPacketCount),
- metricZookeeperRequestActive: newMetricZookeeperRequestActive(mbc.Metrics.ZookeeperRequestActive),
- metricZookeeperRuok: newMetricZookeeperRuok(mbc.Metrics.ZookeeperRuok),
- metricZookeeperSyncPending: newMetricZookeeperSyncPending(mbc.Metrics.ZookeeperSyncPending),
- metricZookeeperWatchCount: newMetricZookeeperWatchCount(mbc.Metrics.ZookeeperWatchCount),
- metricZookeeperZnodeCount: newMetricZookeeperZnodeCount(mbc.Metrics.ZookeeperZnodeCount),
- }
- for _, op := range options {
- op(mb)
- }
- return mb
- }
- // NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.
- func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder {
- return NewResourceBuilder(mb.config.ResourceAttributes)
- }
- // 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/zookeeperreceiver")
- ils.Scope().SetVersion(mb.buildInfo.Version)
- ils.Metrics().EnsureCapacity(mb.metricsCapacity)
- mb.metricZookeeperConnectionActive.emit(ils.Metrics())
- mb.metricZookeeperDataTreeEphemeralNodeCount.emit(ils.Metrics())
- mb.metricZookeeperDataTreeSize.emit(ils.Metrics())
- mb.metricZookeeperFileDescriptorLimit.emit(ils.Metrics())
- mb.metricZookeeperFileDescriptorOpen.emit(ils.Metrics())
- mb.metricZookeeperFollowerCount.emit(ils.Metrics())
- mb.metricZookeeperFsyncExceededThresholdCount.emit(ils.Metrics())
- mb.metricZookeeperLatencyAvg.emit(ils.Metrics())
- mb.metricZookeeperLatencyMax.emit(ils.Metrics())
- mb.metricZookeeperLatencyMin.emit(ils.Metrics())
- mb.metricZookeeperPacketCount.emit(ils.Metrics())
- mb.metricZookeeperRequestActive.emit(ils.Metrics())
- mb.metricZookeeperRuok.emit(ils.Metrics())
- mb.metricZookeeperSyncPending.emit(ils.Metrics())
- mb.metricZookeeperWatchCount.emit(ils.Metrics())
- mb.metricZookeeperZnodeCount.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
- }
- // RecordZookeeperConnectionActiveDataPoint adds a data point to zookeeper.connection.active metric.
- func (mb *MetricsBuilder) RecordZookeeperConnectionActiveDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperConnectionActive.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperDataTreeEphemeralNodeCountDataPoint adds a data point to zookeeper.data_tree.ephemeral_node.count metric.
- func (mb *MetricsBuilder) RecordZookeeperDataTreeEphemeralNodeCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperDataTreeEphemeralNodeCount.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperDataTreeSizeDataPoint adds a data point to zookeeper.data_tree.size metric.
- func (mb *MetricsBuilder) RecordZookeeperDataTreeSizeDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperDataTreeSize.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperFileDescriptorLimitDataPoint adds a data point to zookeeper.file_descriptor.limit metric.
- func (mb *MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperFileDescriptorLimit.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperFileDescriptorOpenDataPoint adds a data point to zookeeper.file_descriptor.open metric.
- func (mb *MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperFileDescriptorOpen.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperFollowerCountDataPoint adds a data point to zookeeper.follower.count metric.
- func (mb *MetricsBuilder) RecordZookeeperFollowerCountDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState) {
- mb.metricZookeeperFollowerCount.recordDataPoint(mb.startTime, ts, val, stateAttributeValue.String())
- }
- // RecordZookeeperFsyncExceededThresholdCountDataPoint adds a data point to zookeeper.fsync.exceeded_threshold.count metric.
- func (mb *MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperFsyncExceededThresholdCount.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperLatencyAvgDataPoint adds a data point to zookeeper.latency.avg metric.
- func (mb *MetricsBuilder) RecordZookeeperLatencyAvgDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperLatencyAvg.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperLatencyMaxDataPoint adds a data point to zookeeper.latency.max metric.
- func (mb *MetricsBuilder) RecordZookeeperLatencyMaxDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperLatencyMax.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperLatencyMinDataPoint adds a data point to zookeeper.latency.min metric.
- func (mb *MetricsBuilder) RecordZookeeperLatencyMinDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperLatencyMin.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperPacketCountDataPoint adds a data point to zookeeper.packet.count metric.
- func (mb *MetricsBuilder) RecordZookeeperPacketCountDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection) {
- mb.metricZookeeperPacketCount.recordDataPoint(mb.startTime, ts, val, directionAttributeValue.String())
- }
- // RecordZookeeperRequestActiveDataPoint adds a data point to zookeeper.request.active metric.
- func (mb *MetricsBuilder) RecordZookeeperRequestActiveDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperRequestActive.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperRuokDataPoint adds a data point to zookeeper.ruok metric.
- func (mb *MetricsBuilder) RecordZookeeperRuokDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperRuok.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperSyncPendingDataPoint adds a data point to zookeeper.sync.pending metric.
- func (mb *MetricsBuilder) RecordZookeeperSyncPendingDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperSyncPending.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperWatchCountDataPoint adds a data point to zookeeper.watch.count metric.
- func (mb *MetricsBuilder) RecordZookeeperWatchCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperWatchCount.recordDataPoint(mb.startTime, ts, val)
- }
- // RecordZookeeperZnodeCountDataPoint adds a data point to zookeeper.znode.count metric.
- func (mb *MetricsBuilder) RecordZookeeperZnodeCountDataPoint(ts pcommon.Timestamp, val int64) {
- mb.metricZookeeperZnodeCount.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)
- }
- }
|