Documentation ¶
Index ¶
- Constants
- Variables
- func Meter(settings component.TelemetrySettings) metric.Meter
- func Tracer(settings component.TelemetrySettings) trace.Tracer
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeDirection
- type AttributeState
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
- func (mb *MetricsBuilder) RecordZookeeperConnectionActiveDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperDataTreeEphemeralNodeCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperDataTreeSizeDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperFollowerCountDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)
- func (mb *MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperLatencyAvgDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperLatencyMaxDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperLatencyMinDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperPacketCountDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
- func (mb *MetricsBuilder) RecordZookeeperRequestActiveDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperRuokDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperSyncPendingDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperWatchCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordZookeeperZnodeCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceAttributeConfig
- type ResourceAttributesConfig
- type ResourceBuilder
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelAlpha
)
Variables ¶
var MapAttributeDirection = map[string]AttributeDirection{ "received": AttributeDirectionReceived, "sent": AttributeDirectionSent, }
MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
var MapAttributeState = map[string]AttributeState{ "synced": AttributeStateSynced, "unsynced": AttributeStateUnsynced, }
MapAttributeState is a helper map of string to AttributeState attribute value.
var (
Type = component.MustNewType("zookeeper")
)
Functions ¶
func WithStartTime ¶ added in v0.42.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeDirection ¶ added in v0.43.0
type AttributeDirection int
AttributeDirection specifies the a value direction attribute.
const ( AttributeDirectionReceived AttributeDirection AttributeDirectionSent )
func (AttributeDirection) String ¶ added in v0.51.0
func (av AttributeDirection) String() string
String returns the string representation of the AttributeDirection.
type AttributeState ¶ added in v0.43.0
type AttributeState int
AttributeState specifies the a value state attribute.
const ( AttributeStateSynced AttributeState AttributeStateUnsynced )
func (AttributeState) String ¶ added in v0.51.0
func (av AttributeState) String() string
String returns the string representation of the AttributeState.
type MetricConfig ¶ added in v0.77.0
type MetricConfig struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricConfig provides common config for a particular metric.
type MetricsBuilder ¶ added in v0.42.0
type MetricsBuilder struct {
// contains filtered or unexported fields
}
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.
func NewMetricsBuilder ¶ added in v0.42.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.42.0
func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
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 (*MetricsBuilder) EmitForResource ¶ added in v0.48.0
func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
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 (*MetricsBuilder) NewResourceBuilder ¶ added in v0.83.0
func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.
func (*MetricsBuilder) RecordZookeeperConnectionActiveDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperConnectionActiveDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperConnectionActiveDataPoint adds a data point to zookeeper.connection.active metric.
func (*MetricsBuilder) RecordZookeeperDataTreeEphemeralNodeCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperDataTreeEphemeralNodeCountDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperDataTreeEphemeralNodeCountDataPoint adds a data point to zookeeper.data_tree.ephemeral_node.count metric.
func (*MetricsBuilder) RecordZookeeperDataTreeSizeDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperDataTreeSizeDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperDataTreeSizeDataPoint adds a data point to zookeeper.data_tree.size metric.
func (*MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperFileDescriptorLimitDataPoint adds a data point to zookeeper.file_descriptor.limit metric.
func (*MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperFileDescriptorOpenDataPoint adds a data point to zookeeper.file_descriptor.open metric.
func (*MetricsBuilder) RecordZookeeperFollowerCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperFollowerCountDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)
RecordZookeeperFollowerCountDataPoint adds a data point to zookeeper.follower.count metric.
func (*MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperFsyncExceededThresholdCountDataPoint adds a data point to zookeeper.fsync.exceeded_threshold.count metric.
func (*MetricsBuilder) RecordZookeeperLatencyAvgDataPoint ¶ added in v0.42.0
func (mb *MetricsBuilder) RecordZookeeperLatencyAvgDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperLatencyAvgDataPoint adds a data point to zookeeper.latency.avg metric.
func (*MetricsBuilder) RecordZookeeperLatencyMaxDataPoint ¶ added in v0.42.0
func (mb *MetricsBuilder) RecordZookeeperLatencyMaxDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperLatencyMaxDataPoint adds a data point to zookeeper.latency.max metric.
func (*MetricsBuilder) RecordZookeeperLatencyMinDataPoint ¶ added in v0.42.0
func (mb *MetricsBuilder) RecordZookeeperLatencyMinDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperLatencyMinDataPoint adds a data point to zookeeper.latency.min metric.
func (*MetricsBuilder) RecordZookeeperPacketCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperPacketCountDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)
RecordZookeeperPacketCountDataPoint adds a data point to zookeeper.packet.count metric.
func (*MetricsBuilder) RecordZookeeperRequestActiveDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperRequestActiveDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperRequestActiveDataPoint adds a data point to zookeeper.request.active metric.
func (*MetricsBuilder) RecordZookeeperRuokDataPoint ¶ added in v0.81.0
func (mb *MetricsBuilder) RecordZookeeperRuokDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperRuokDataPoint adds a data point to zookeeper.ruok metric.
func (*MetricsBuilder) RecordZookeeperSyncPendingDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperSyncPendingDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperSyncPendingDataPoint adds a data point to zookeeper.sync.pending metric.
func (*MetricsBuilder) RecordZookeeperWatchCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperWatchCountDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperWatchCountDataPoint adds a data point to zookeeper.watch.count metric.
func (*MetricsBuilder) RecordZookeeperZnodeCountDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordZookeeperZnodeCountDataPoint(ts pcommon.Timestamp, val int64)
RecordZookeeperZnodeCountDataPoint adds a data point to zookeeper.znode.count metric.
func (*MetricsBuilder) Reset ¶ added in v0.42.0
func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
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.
type MetricsBuilderConfig ¶ added in v0.73.0
type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a configuration for zookeeper metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { ZookeeperConnectionActive MetricConfig `mapstructure:"zookeeper.connection.active"` ZookeeperDataTreeEphemeralNodeCount MetricConfig `mapstructure:"zookeeper.data_tree.ephemeral_node.count"` ZookeeperDataTreeSize MetricConfig `mapstructure:"zookeeper.data_tree.size"` ZookeeperFileDescriptorLimit MetricConfig `mapstructure:"zookeeper.file_descriptor.limit"` ZookeeperFileDescriptorOpen MetricConfig `mapstructure:"zookeeper.file_descriptor.open"` ZookeeperFollowerCount MetricConfig `mapstructure:"zookeeper.follower.count"` ZookeeperFsyncExceededThresholdCount MetricConfig `mapstructure:"zookeeper.fsync.exceeded_threshold.count"` ZookeeperLatencyAvg MetricConfig `mapstructure:"zookeeper.latency.avg"` ZookeeperLatencyMax MetricConfig `mapstructure:"zookeeper.latency.max"` ZookeeperLatencyMin MetricConfig `mapstructure:"zookeeper.latency.min"` ZookeeperPacketCount MetricConfig `mapstructure:"zookeeper.packet.count"` ZookeeperRequestActive MetricConfig `mapstructure:"zookeeper.request.active"` ZookeeperRuok MetricConfig `mapstructure:"zookeeper.ruok"` ZookeeperSyncPending MetricConfig `mapstructure:"zookeeper.sync.pending"` ZookeeperWatchCount MetricConfig `mapstructure:"zookeeper.watch.count"` ZookeeperZnodeCount MetricConfig `mapstructure:"zookeeper.znode.count"` }
MetricsConfig provides config for zookeeper metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
type ResourceAttributeConfig ¶ added in v0.77.0
type ResourceAttributeConfig struct { Enabled bool `mapstructure:"enabled"` // Experimental: MetricsInclude defines a list of filters for attribute values. // If the list is not empty, only metrics with matching resource attribute values will be emitted. MetricsInclude []filter.Config `mapstructure:"metrics_include"` // Experimental: MetricsExclude defines a list of filters for attribute values. // If the list is not empty, metrics with matching resource attribute values will not be emitted. // MetricsInclude has higher priority than MetricsExclude. MetricsExclude []filter.Config `mapstructure:"metrics_exclude"` // contains filtered or unexported fields }
ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributesConfig ¶ added in v0.77.0
type ResourceAttributesConfig struct { ServerState ResourceAttributeConfig `mapstructure:"server.state"` ZkVersion ResourceAttributeConfig `mapstructure:"zk.version"` }
ResourceAttributesConfig provides config for zookeeper resource attributes.
func DefaultResourceAttributesConfig ¶ added in v0.77.0
func DefaultResourceAttributesConfig() ResourceAttributesConfig
type ResourceBuilder ¶ added in v0.82.0
type ResourceBuilder struct {
// contains filtered or unexported fields
}
ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.
func NewResourceBuilder ¶ added in v0.82.0
func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder
NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.
func (*ResourceBuilder) Emit ¶ added in v0.82.0
func (rb *ResourceBuilder) Emit() pcommon.Resource
Emit returns the built resource and resets the internal builder state.
func (*ResourceBuilder) SetServerState ¶ added in v0.82.0
func (rb *ResourceBuilder) SetServerState(val string)
SetServerState sets provided value as "server.state" attribute.
func (*ResourceBuilder) SetZkVersion ¶ added in v0.82.0
func (rb *ResourceBuilder) SetZkVersion(val string)
SetZkVersion sets provided value as "zk.version" attribute.
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithResource ¶ added in v0.82.0
func WithResource(res pcommon.Resource) ResourceMetricsOption
WithResource sets the provided resource on the emitted ResourceMetrics. It's recommended to use ResourceBuilder to create the resource.
func WithStartTimeOverride ¶ added in v0.52.0
func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption
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.