spanmetrics

package
v0.40.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package spanmetrics provides an otelcol.connector.spanmetrics component.

Index

Constants

View Source
const (
	AggregationTemporalityCumulative = "CUMULATIVE"
	AggregationTemporalityDelta      = "DELTA"
)
View Source
const (
	MetricsUnitMilliseconds string = "ms"
	MetricsUnitSeconds      string = "s"
)

Variables

View Source
var DefaultArguments = Arguments{
	DimensionsCacheSize:    1000,
	AggregationTemporality: AggregationTemporalityCumulative,
	MetricsFlushInterval:   15 * time.Second,
}

DefaultArguments holds default settings for Arguments.

View Source
var DefaultHistogramConfig = HistogramConfig{
	Unit:        MetricsUnitMilliseconds,
	Exponential: nil,
	Explicit:    nil,
}

Functions

func ConvertMetricUnit

func ConvertMetricUnit(unit string) (map[string]interface{}, error)

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.87.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 `river:"dimension,block,optional"`
	ExcludeDimensions []string    `river:"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 `river:"dimensions_cache_size,attr,optional"`

	AggregationTemporality string `river:"aggregation_temporality,attr,optional"`

	Histogram HistogramConfig `river:"histogram,block"`

	// MetricsEmitInterval is the time period between when metrics are flushed or emitted to the downstream components.
	MetricsFlushInterval time.Duration `river:"metrics_flush_interval,attr,optional"`

	// Namespace is the namespace of the metrics emitted by the connector.
	Namespace string `river:"namespace,attr,optional"`

	// Exemplars defines the configuration for exemplars.
	Exemplars ExemplarsConfig `river:"exemplars,block,optional"`

	// Output configures where to send processed data. Required.
	Output *otelcol.ConsumerArguments `river:"output,block"`
}

Arguments configures the otelcol.connector.spanmetrics component.

func (Arguments) ConnectorType

func (Arguments) ConnectorType() int

ConnectorType() int implements connector.Arguments.

func (Arguments) Convert

func (args Arguments) Convert() (otelcomponent.Config, error)

Convert implements connector.Arguments.

func (Arguments) Exporters

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 river.Defaulter.

func (*Arguments) Validate

func (args *Arguments) Validate() error

Validate implements river.Validator.

type Dimension

type Dimension struct {
	Name    string  `river:"name,attr"`
	Default *string `river:"default,attr,optional"`
}

Dimension defines the dimension name and optional default value if the Dimension is missing from a span attribute.

func (Dimension) Convert

type ExemplarsConfig added in v0.37.0

type ExemplarsConfig struct {
	Enabled bool `river:"enabled,attr,optional"`
}

func (ExemplarsConfig) Convert added in v0.37.0

type ExplicitHistogramConfig

type ExplicitHistogramConfig struct {
	// Buckets is the list of durations representing explicit histogram buckets.
	Buckets []time.Duration `river:"buckets,attr,optional"`
}

func (ExplicitHistogramConfig) Convert

func (*ExplicitHistogramConfig) SetToDefault

func (hc *ExplicitHistogramConfig) SetToDefault()

type ExponentialHistogramConfig

type ExponentialHistogramConfig struct {
	MaxSize int32 `river:"max_size,attr,optional"`
}

func (ExponentialHistogramConfig) Convert

func (*ExponentialHistogramConfig) SetToDefault

func (ehc *ExponentialHistogramConfig) SetToDefault()

SetToDefault implements river.Defaulter.

func (*ExponentialHistogramConfig) Validate

func (ehc *ExponentialHistogramConfig) Validate() error

Validate implements river.Validator.

type HistogramConfig

type HistogramConfig struct {
	Disable     bool                        `river:"disable,attr,optional"`
	Unit        string                      `river:"unit,attr,optional"`
	Exponential *ExponentialHistogramConfig `river:"exponential,block,optional"`
	Explicit    *ExplicitHistogramConfig    `river:"explicit,block,optional"`
}

func (HistogramConfig) Convert

func (*HistogramConfig) SetToDefault

func (hc *HistogramConfig) SetToDefault()

func (*HistogramConfig) Validate

func (hc *HistogramConfig) Validate() error

Jump to

Keyboard shortcuts

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