metadata

package
v0.119.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelAlpha
)

Variables

View Source
var (
	Type      = component.MustNewType("zookeeper")
	ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/scraper/zookeeperscraper"
)
View Source
var MapAttributeDirection = map[string]AttributeDirection{
	"received": AttributeDirectionReceived,
	"sent":     AttributeDirectionSent,
}

MapAttributeDirection is a helper map of string to AttributeDirection attribute value.

View Source
var MapAttributeState = map[string]AttributeState{
	"synced":   AttributeStateSynced,
	"unsynced": AttributeStateUnsynced,
}

MapAttributeState is a helper map of string to AttributeState attribute value.

Functions

This section is empty.

Types

type AttributeDirection

type AttributeDirection int

AttributeDirection specifies the value direction attribute.

const (
	AttributeDirectionReceived AttributeDirection
	AttributeDirectionSent
)

func (AttributeDirection) String

func (av AttributeDirection) String() string

String returns the string representation of the AttributeDirection.

type AttributeState

type AttributeState int

AttributeState specifies the value state attribute.

const (
	AttributeStateSynced AttributeState
	AttributeStateUnsynced
)

func (AttributeState) String

func (av AttributeState) String() string

String returns the string representation of the AttributeState.

type MetricBuilderOption

type MetricBuilderOption interface {
	// contains filtered or unexported methods
}

MetricBuilderOption applies changes to default metrics builder.

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption

WithStartTime sets startTime on the metrics builder.

type MetricConfig

type MetricConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

type MetricsBuilder

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

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings scraper.Settings, options ...MetricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

func (mb *MetricsBuilder) Emit(options ...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

func (mb *MetricsBuilder) EmitForResource(options ...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

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

func (mb *MetricsBuilder) RecordZookeeperConnectionActiveDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperConnectionActiveDataPoint adds a data point to zookeeper.connection.active metric.

func (*MetricsBuilder) RecordZookeeperDataTreeEphemeralNodeCountDataPoint

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

func (mb *MetricsBuilder) RecordZookeeperDataTreeSizeDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperDataTreeSizeDataPoint adds a data point to zookeeper.data_tree.size metric.

func (*MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint

func (mb *MetricsBuilder) RecordZookeeperFileDescriptorLimitDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperFileDescriptorLimitDataPoint adds a data point to zookeeper.file_descriptor.limit metric.

func (*MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint

func (mb *MetricsBuilder) RecordZookeeperFileDescriptorOpenDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperFileDescriptorOpenDataPoint adds a data point to zookeeper.file_descriptor.open metric.

func (*MetricsBuilder) RecordZookeeperFollowerCountDataPoint

func (mb *MetricsBuilder) RecordZookeeperFollowerCountDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)

RecordZookeeperFollowerCountDataPoint adds a data point to zookeeper.follower.count metric.

func (*MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint

func (mb *MetricsBuilder) RecordZookeeperFsyncExceededThresholdCountDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperFsyncExceededThresholdCountDataPoint adds a data point to zookeeper.fsync.exceeded_threshold.count metric.

func (*MetricsBuilder) RecordZookeeperLatencyAvgDataPoint

func (mb *MetricsBuilder) RecordZookeeperLatencyAvgDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperLatencyAvgDataPoint adds a data point to zookeeper.latency.avg metric.

func (*MetricsBuilder) RecordZookeeperLatencyMaxDataPoint

func (mb *MetricsBuilder) RecordZookeeperLatencyMaxDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperLatencyMaxDataPoint adds a data point to zookeeper.latency.max metric.

func (*MetricsBuilder) RecordZookeeperLatencyMinDataPoint

func (mb *MetricsBuilder) RecordZookeeperLatencyMinDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperLatencyMinDataPoint adds a data point to zookeeper.latency.min metric.

func (*MetricsBuilder) RecordZookeeperPacketCountDataPoint

func (mb *MetricsBuilder) RecordZookeeperPacketCountDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)

RecordZookeeperPacketCountDataPoint adds a data point to zookeeper.packet.count metric.

func (*MetricsBuilder) RecordZookeeperRequestActiveDataPoint

func (mb *MetricsBuilder) RecordZookeeperRequestActiveDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperRequestActiveDataPoint adds a data point to zookeeper.request.active metric.

func (*MetricsBuilder) RecordZookeeperRuokDataPoint

func (mb *MetricsBuilder) RecordZookeeperRuokDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperRuokDataPoint adds a data point to zookeeper.ruok metric.

func (*MetricsBuilder) RecordZookeeperSyncPendingDataPoint

func (mb *MetricsBuilder) RecordZookeeperSyncPendingDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperSyncPendingDataPoint adds a data point to zookeeper.sync.pending metric.

func (*MetricsBuilder) RecordZookeeperWatchCountDataPoint

func (mb *MetricsBuilder) RecordZookeeperWatchCountDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperWatchCountDataPoint adds a data point to zookeeper.watch.count metric.

func (*MetricsBuilder) RecordZookeeperZnodeCountDataPoint

func (mb *MetricsBuilder) RecordZookeeperZnodeCountDataPoint(ts pcommon.Timestamp, val int64)

RecordZookeeperZnodeCountDataPoint adds a data point to zookeeper.znode.count metric.

func (*MetricsBuilder) Reset

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

type MetricsBuilderConfig struct {
	Metrics            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for zookeeper metrics builder.

func DefaultMetricsBuilderConfig

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

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

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig

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.

func (*ResourceAttributeConfig) Unmarshal

func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error

type ResourceAttributesConfig

type ResourceAttributesConfig struct {
	ServerState ResourceAttributeConfig `mapstructure:"server.state"`
	ZkVersion   ResourceAttributeConfig `mapstructure:"zk.version"`
}

ResourceAttributesConfig provides config for zookeeper resource attributes.

func DefaultResourceAttributesConfig

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder

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

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.

func (*ResourceBuilder) Emit

func (rb *ResourceBuilder) Emit() pcommon.Resource

Emit returns the built resource and resets the internal builder state.

func (*ResourceBuilder) SetServerState

func (rb *ResourceBuilder) SetServerState(val string)

SetServerState sets provided value as "server.state" attribute.

func (*ResourceBuilder) SetZkVersion

func (rb *ResourceBuilder) SetZkVersion(val string)

SetZkVersion sets provided value as "zk.version" attribute.

type ResourceMetricsOption

type ResourceMetricsOption interface {
	// contains filtered or unexported methods
}

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL