Documentation ¶
Overview ¶
Package spanmetrics provides an otelcol.connector.spanmetrics component.
Index ¶
- Constants
- Variables
- func ConvertMetricUnit(unit string) (map[string]interface{}, error)
- func FromOTelAggregationTemporality(temporality string) string
- type Arguments
- func (Arguments) ConnectorType() int
- func (args Arguments) Convert() (otelcomponent.Config, error)
- func (args Arguments) DebugMetricsConfig() otelcolCfg.DebugMetricsArguments
- func (args Arguments) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component
- func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension
- func (args Arguments) NextConsumers() *otelcol.ConsumerArguments
- func (args *Arguments) SetToDefault()
- func (args *Arguments) Validate() error
- type Dimension
- type EventsConfig
- type ExemplarsConfig
- type ExplicitHistogramConfig
- type ExponentialHistogramConfig
- type HistogramConfig
Constants ¶
const ( AggregationTemporalityCumulative = "CUMULATIVE" AggregationTemporalityDelta = "DELTA" )
const ( MetricsUnitMilliseconds string = "ms" MetricsUnitSeconds string = "s" )
Variables ¶
var DefaultArguments = Arguments{ DimensionsCacheSize: 1000, AggregationTemporality: AggregationTemporalityCumulative, MetricsFlushInterval: 60 * time.Second, MetricsExpiration: 0, ResourceMetricsCacheSize: 1000, TimestampCacheSize: 1000, }
DefaultArguments holds default settings for Arguments.
var DefaultHistogramConfig = HistogramConfig{ Unit: MetricsUnitMilliseconds, Exponential: nil, Explicit: nil, }
Functions ¶
func ConvertMetricUnit ¶
The unit is a private type in an internal Otel package, so we need to convert it to a map and then back to the internal type. ConvertMetricUnit matches the Unit type in this internal package: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.96.0/connector/spanmetricsconnector/internal/metrics/unit.go
Types ¶
type Arguments ¶
type Arguments struct { // Dimensions defines the list of additional dimensions on top of the provided: // - service.name // - span.name // - span.kind // - status.code // The dimensions will be fetched from the span's attributes. Examples of some conventionally used attributes: // https://github.com/open-telemetry/opentelemetry-collector/blob/main/model/semconv/opentelemetry.go. Dimensions []Dimension `alloy:"dimension,block,optional"` ExcludeDimensions []string `alloy:"exclude_dimensions,attr,optional"` // DimensionsCacheSize defines the size of cache for storing Dimensions, which helps to avoid cache memory growing // indefinitely over the lifetime of the collector. DimensionsCacheSize int `alloy:"dimensions_cache_size,attr,optional"` // ResourceMetricsCacheSize defines the size of the cache holding metrics for a service. This is mostly relevant for // cumulative temporality to avoid memory leaks and correct metric timestamp resets. ResourceMetricsCacheSize int `alloy:"resource_metrics_cache_size,attr,optional"` // ResourceMetricsKeyAttributes filters the resource attributes used to create the resource metrics key hash. // This can be used to avoid situations where resource attributes may change across service restarts, causing // metric counters to break (and duplicate). A resource does not need to have all of the attributes. The list // must include enough attributes to properly identify unique resources or risk aggregating data from more // than one service and span. // e.g. ["service.name", "telemetry.sdk.language", "telemetry.sdk.name"] // See https://opentelemetry.io/docs/specs/semconv/resource/ for possible attributes. ResourceMetricsKeyAttributes []string `alloy:"resource_metrics_key_attributes,attr,optional"` AggregationTemporality string `alloy:"aggregation_temporality,attr,optional"` Histogram HistogramConfig `alloy:"histogram,block"` // MetricsEmitInterval is the time period between when metrics are flushed or emitted to the downstream components. MetricsFlushInterval time.Duration `alloy:"metrics_flush_interval,attr,optional"` // MetricsExpiration is the time period after which metrics are considered stale and are removed from the cache. // Default value (0) means that the metrics will never expire. MetricsExpiration time.Duration `alloy:"metrics_expiration,attr,optional"` // TimestampCacheSize controls the size of the cache used to keep track of delta metrics' TimestampUnixNano the last time it was flushed TimestampCacheSize int `alloy:"metric_timestamp_cache_size,attr,optional"` // Namespace is the namespace of the metrics emitted by the connector. Namespace string `alloy:"namespace,attr,optional"` // Exemplars defines the configuration for exemplars. Exemplars ExemplarsConfig `alloy:"exemplars,block,optional"` // Events defines the configuration for events section of spans. Events EventsConfig `alloy:"events,block,optional"` // Output configures where to send processed data. Required. Output *otelcol.ConsumerArguments `alloy:"output,block"` // DebugMetrics configures component internal metrics. Optional. DebugMetrics otelcolCfg.DebugMetricsArguments `alloy:"debug_metrics,block,optional"` }
Arguments configures the otelcol.connector.spanmetrics component.
func (Arguments) ConnectorType ¶
ConnectorType() int implements connector.Arguments.
func (Arguments) Convert ¶
func (args Arguments) Convert() (otelcomponent.Config, error)
Convert implements connector.Arguments.
func (Arguments) DebugMetricsConfig ¶ added in v1.2.0
func (args Arguments) DebugMetricsConfig() otelcolCfg.DebugMetricsArguments
DebugMetricsConfig implements connector.Arguments.
func (Arguments) Exporters ¶
func (args Arguments) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component
Exporters implements connector.Arguments.
func (Arguments) Extensions ¶
func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension
Extensions implements connector.Arguments.
func (Arguments) NextConsumers ¶
func (args Arguments) NextConsumers() *otelcol.ConsumerArguments
NextConsumers implements connector.Arguments.
func (*Arguments) SetToDefault ¶
func (args *Arguments) SetToDefault()
SetToDefault implements syntax.Defaulter.
type Dimension ¶
type Dimension struct { Name string `alloy:"name,attr"` Default *string `alloy:"default,attr,optional"` }
Dimension defines the dimension name and optional default value if the Dimension is missing from a span attribute.
func (Dimension) Convert ¶
func (d Dimension) Convert() spanmetricsconnector.Dimension
type EventsConfig ¶
type EventsConfig struct { // Enabled is a flag to enable events. Enabled bool `alloy:"enabled,attr,optional"` // Dimensions defines the list of dimensions to add to the events metric. Dimensions []Dimension `alloy:"dimension,block,optional"` }
func (EventsConfig) Convert ¶
func (ec EventsConfig) Convert() spanmetricsconnector.EventsConfig
type ExemplarsConfig ¶
type ExemplarsConfig struct { Enabled bool `alloy:"enabled,attr,optional"` MaxPerDataPoint *int `alloy:"max_per_data_point,attr,optional"` }
func (ExemplarsConfig) Convert ¶
func (ec ExemplarsConfig) Convert() *spanmetricsconnector.ExemplarsConfig
type ExplicitHistogramConfig ¶
type ExplicitHistogramConfig struct { // Buckets is the list of durations representing explicit histogram buckets. Buckets []time.Duration `alloy:"buckets,attr,optional"` }
func (ExplicitHistogramConfig) Convert ¶
func (hc ExplicitHistogramConfig) Convert() *spanmetricsconnector.ExplicitHistogramConfig
func (*ExplicitHistogramConfig) SetToDefault ¶
func (hc *ExplicitHistogramConfig) SetToDefault()
type ExponentialHistogramConfig ¶
type ExponentialHistogramConfig struct {
MaxSize int32 `alloy:"max_size,attr,optional"`
}
func (ExponentialHistogramConfig) Convert ¶
func (ehc ExponentialHistogramConfig) Convert() *spanmetricsconnector.ExponentialHistogramConfig
func (*ExponentialHistogramConfig) SetToDefault ¶
func (ehc *ExponentialHistogramConfig) SetToDefault()
SetToDefault implements syntax.Defaulter.
func (*ExponentialHistogramConfig) Validate ¶
func (ehc *ExponentialHistogramConfig) Validate() error
Validate implements syntax.Validator.
type HistogramConfig ¶
type HistogramConfig struct { Disable bool `alloy:"disable,attr,optional"` Unit string `alloy:"unit,attr,optional"` Exponential *ExponentialHistogramConfig `alloy:"exponential,block,optional"` Explicit *ExplicitHistogramConfig `alloy:"explicit,block,optional"` }
func (HistogramConfig) Convert ¶
func (hc HistogramConfig) Convert() (*spanmetricsconnector.HistogramConfig, error)
func (*HistogramConfig) SetToDefault ¶
func (hc *HistogramConfig) SetToDefault()
func (*HistogramConfig) Validate ¶
func (hc *HistogramConfig) Validate() error