metrics

package module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 27 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APMStatsConsumer deprecated

type APMStatsConsumer interface {
	// ConsumeAPMStats consumes the given StatsPayload.
	ConsumeAPMStats(*pb.ClientStatsPayload)
}

Deprecated: use WithStatsOut instead APMStatsConsumer implementations are able to consume APM Stats generated by a Translator.

type Consumer

type Consumer interface {
	TimeSeriesConsumer
	SketchConsumer
}

Consumer is a metrics consumer.

type DataType

type DataType int

DataType is a timeseries-style metric type.

const (
	// Gauge is the Datadog Gauge metric type.
	Gauge DataType = iota
	// Count is the Datadog Count metric type.
	Count
)

func (DataType) MarshalText

func (t DataType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*DataType) UnmarshalText

func (t *DataType) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Dimensions

type Dimensions struct {
	// contains filtered or unexported fields
}

Dimensions of a metric that identify a timeseries uniquely. This is similar to the concept of 'context' in DogStatsD/check metrics. NOTE: Keep this in sync with the TestDimensions struct.

func (*Dimensions) AddTags

func (d *Dimensions) AddTags(tags ...string) *Dimensions

AddTags to metrics dimensions.

func (*Dimensions) Host

func (d *Dimensions) Host() string

Host of the metric (may be empty).

func (*Dimensions) Name

func (d *Dimensions) Name() string

Name of the metric.

func (*Dimensions) OriginID

func (d *Dimensions) OriginID() string

OriginID of the metric (may be empty).

func (*Dimensions) OriginProduct added in v0.8.2

func (d *Dimensions) OriginProduct() OriginProduct

OriginProduct of the metric.

func (*Dimensions) OriginProductDetail added in v0.16.0

func (d *Dimensions) OriginProductDetail() OriginProductDetail

OriginProductDetail of the metric.

func (*Dimensions) OriginSubProduct added in v0.16.0

func (d *Dimensions) OriginSubProduct() OriginSubProduct

OriginSubProduct of the metric.

func (*Dimensions) String

func (d *Dimensions) String() string

String maps dimensions to a string to use as an identifier. The tags order does not matter.

func (*Dimensions) Tags

func (d *Dimensions) Tags() []string

Tags of the metric (read-only).

func (*Dimensions) WithAttributeMap

func (d *Dimensions) WithAttributeMap(labels pcommon.Map) *Dimensions

WithAttributeMap creates a new metricDimensions struct with additional tags from attributes.

func (*Dimensions) WithSuffix

func (d *Dimensions) WithSuffix(suffix string) *Dimensions

WithSuffix creates a new dimensions struct with an extra name suffix.

type HistogramMode

type HistogramMode string

HistogramMode is an export mode for OTLP Histogram metrics.

const (
	// HistogramModeNoBuckets disables bucket export.
	HistogramModeNoBuckets HistogramMode = "nobuckets"
	// HistogramModeCounters exports buckets as Datadog counts.
	HistogramModeCounters HistogramMode = "counters"
	// HistogramModeDistributions exports buckets as Datadog distributions.
	HistogramModeDistributions HistogramMode = "distributions"
)

type HostConsumer

type HostConsumer interface {
	// ConsumeHost consumes a hostname.
	ConsumeHost(host string)
}

HostConsumer is a hostname consumer. It is an optional interface that can be implemented by a Consumer.

type InitialCumulMonoValueMode added in v0.5.1

type InitialCumulMonoValueMode string

InitialCumulMonoValueMode defines what the exporter should do with the initial value of a cumulative monotonic sum when under the 'cumulative_to_delta' mode. It is not used when the mode is 'raw_value'.

const (
	// InitialCumulMonoValueModeAuto reports the initial value if its start timestamp
	// is set and it happens after the process was started.
	InitialCumulMonoValueModeAuto InitialCumulMonoValueMode = "auto"

	// InitialCumulMonoValueModeDrop always drops the initial value.
	InitialCumulMonoValueModeDrop InitialCumulMonoValueMode = "drop"

	// InitialCumulMonoValueModeKeep always reports the initial value.
	InitialCumulMonoValueModeKeep InitialCumulMonoValueMode = "keep"
)

type Metadata added in v0.3.0

type Metadata struct {
	// Languages specifies a list of languages for which runtime metrics were found.
	Languages []string
}

Metadata specifies information about the outcome of the MapMetrics call.

type NumberMode

type NumberMode string

NumberMode is an export mode for OTLP Number metrics.

const (
	// NumberModeCumulativeToDelta calculates delta for
	// cumulative monotonic metrics in the client side and reports
	// them as Datadog counts.
	NumberModeCumulativeToDelta NumberMode = "cumulative_to_delta"

	// NumberModeRawValue reports the raw value for cumulative monotonic
	// metrics as a Datadog gauge.
	NumberModeRawValue NumberMode = "raw_value"
)

type OriginProduct added in v0.8.2

type OriginProduct int32

OriginProduct defines the origin product.

const (
	OriginProductUnknown OriginProduct = 0
	// OriginProductDatadogAgent is the origin for metrics coming from the Datadog Agent OTLP Ingest.
	OriginProductDatadogAgent OriginProduct = 10
	// OriginProductDatadogExporter is the origin for metrics coming from the OpenTelemetry Collector Datadog Exporter.
	OriginProductDatadogExporter OriginProduct = 19
)

func (OriginProduct) String added in v0.8.4

func (o OriginProduct) String() string

type OriginProductDetail added in v0.16.0

type OriginProductDetail int32

OriginProductDetail defines the origin service.

const (
	OriginProductDetailUnknown                   OriginProductDetail = 0
	OriginProductDetailActiveDirectoryDSReceiver OriginProductDetail = 251
	OriginProductDetailAerospikeReceiver         OriginProductDetail = 252
	OriginProductDetailApacheReceiver            OriginProductDetail = 253
	OriginProductDetailApacheSparkReceiver       OriginProductDetail = 254
	OriginProductDetailAzureMonitorReceiver      OriginProductDetail = 255
	OriginProductDetailBigIPReceiver             OriginProductDetail = 256
	OriginProductDetailChronyReceiver            OriginProductDetail = 257
	OriginProductDetailCouchDBReceiver           OriginProductDetail = 258
	OriginProductDetailDockerStatsReceiver       OriginProductDetail = 217
	OriginProductDetailElasticsearchReceiver     OriginProductDetail = 218
	OriginProductDetailExpVarReceiver            OriginProductDetail = 219
	OriginProductDetailFileStatsReceiver         OriginProductDetail = 220
	OriginProductDetailFlinkMetricsReceiver      OriginProductDetail = 221
	OriginProductDetailGitProviderReceiver       OriginProductDetail = 222
	OriginProductDetailHAProxyReceiver           OriginProductDetail = 223
	OriginProductDetailHostMetricsReceiver       OriginProductDetail = 224
	OriginProductDetailHTTPCheckReceiver         OriginProductDetail = 225
	OriginProductDetailIISReceiver               OriginProductDetail = 226
	OriginProductDetailK8SClusterReceiver        OriginProductDetail = 227
	OriginProductDetailKafkaMetricsReceiver      OriginProductDetail = 228
	OriginProductDetailKubeletStatsReceiver      OriginProductDetail = 229
	OriginProductDetailMemcachedReceiver         OriginProductDetail = 230
	OriginProductDetailMongoDBAtlasReceiver      OriginProductDetail = 231
	OriginProductDetailMongoDBReceiver           OriginProductDetail = 232
	OriginProductDetailMySQLReceiver             OriginProductDetail = 233
	OriginProductDetailNginxReceiver             OriginProductDetail = 234
	OriginProductDetailNSXTReceiver              OriginProductDetail = 235
	OriginProductDetailOracleDBReceiver          OriginProductDetail = 236
	OriginProductDetailPostgreSQLReceiver        OriginProductDetail = 237
	OriginProductDetailPrometheusReceiver        OriginProductDetail = 238
	OriginProductDetailRabbitMQReceiver          OriginProductDetail = 239
	OriginProductDetailRedisReceiver             OriginProductDetail = 240
	OriginProductDetailRiakReceiver              OriginProductDetail = 241
	OriginProductDetailSAPHANAReceiver           OriginProductDetail = 242
	OriginProductDetailSNMPReceiver              OriginProductDetail = 243
	OriginProductDetailSnowflakeReceiver         OriginProductDetail = 244
	OriginProductDetailSplunkEnterpriseReceiver  OriginProductDetail = 245
	OriginProductDetailSQLServerReceiver         OriginProductDetail = 246
	OriginProductDetailSSHCheckReceiver          OriginProductDetail = 247
	OriginProductDetailStatsDReceiver            OriginProductDetail = 248
	OriginProductDetailVCenterReceiver           OriginProductDetail = 249
	OriginProductDetailZookeeperReceiver         OriginProductDetail = 250
)

List all receivers that set the scope name.

type OriginSubProduct added in v0.16.0

type OriginSubProduct int32

OriginSubProduct defines the origin subproduct.

const OriginSubProductOTLP OriginSubProduct = 17

OriginSubProductOTLP is the origin subproduct for all metrics coming from OTLP. All metrics produced by the translator MUST have origin subproduct set to OTLP.

func (OriginSubProduct) String added in v0.16.0

func (o OriginSubProduct) String() string

type SketchConsumer

type SketchConsumer interface {
	// ConsumeSketch consumes a pkg/quantile-style sketch.
	ConsumeSketch(
		ctx context.Context,
		dimensions *Dimensions,
		timestamp uint64,
		sketch *quantile.Sketch,
	)
}

SketchConsumer is a pkg/quantile sketch consumer.

type TagsConsumer

type TagsConsumer interface {
	// ConsumeTag consumes a tag
	ConsumeTag(tag string)
}

TagsConsumer is a tags consumer. It is an optional interface that can be implemented by a Consumer. Consumed tags are used for running metrics, and should represent some resource running a Collector (e.g. Fargate task).

type TimeSeriesConsumer

type TimeSeriesConsumer interface {
	// ConsumeTimeSeries consumes a timeseries-style metric.
	ConsumeTimeSeries(
		ctx context.Context,
		dimensions *Dimensions,
		typ DataType,
		timestamp uint64,
		value float64,
	)
}

TimeSeriesConsumer is timeseries consumer.

type Translator

type Translator struct {
	// contains filtered or unexported fields
}

Translator is a metrics translator.

func NewTranslator

func NewTranslator(set component.TelemetrySettings, attributesTranslator *attributes.Translator, options ...TranslatorOption) (*Translator, error)

NewTranslator creates a new translator with given options.

func (*Translator) MapMetrics

func (t *Translator) MapMetrics(ctx context.Context, md pmetric.Metrics, consumer Consumer) (Metadata, error)

MapMetrics maps OTLP metrics into the Datadog format

func (*Translator) StatsToMetrics added in v0.10.0

func (t *Translator) StatsToMetrics(sp *pb.StatsPayload) (pmetric.Metrics, error)

StatsToMetrics converts a StatsPayload to a pdata.Metrics

type TranslatorOption

type TranslatorOption func(*translatorConfig) error

TranslatorOption is a translator creation option.

func WithCountSumMetrics

func WithCountSumMetrics() TranslatorOption

WithCountSumMetrics exports .count and .sum histogram metrics. Deprecated: Use WithHistogramAggregations instead.

func WithDeltaTTL

func WithDeltaTTL(deltaTTL int64) TranslatorOption

WithDeltaTTL sets the delta TTL for cumulative metrics datapoints. By default, 3600 seconds are used.

func WithFallbackSourceProvider

func WithFallbackSourceProvider(provider source.Provider) TranslatorOption

WithFallbackSourceProvider sets the fallback source provider. By default, an empty hostname is used as a fallback.

func WithHistogramAggregations added in v0.1.4

func WithHistogramAggregations() TranslatorOption

WithHistogramAggregations exports .count, .sum, .min and .max histogram metrics when available.

func WithHistogramMode

func WithHistogramMode(mode HistogramMode) TranslatorOption

WithHistogramMode sets the histograms mode. The default mode is HistogramModeOff.

func WithInitialCumulMonoValueMode added in v0.5.1

func WithInitialCumulMonoValueMode(mode InitialCumulMonoValueMode) TranslatorOption

WithInitialCumulMonoValueMode sets the initial value mode. The default mode is InitialCumulMonoValueModeAuto.

func WithInstrumentationLibraryMetadataAsTags

func WithInstrumentationLibraryMetadataAsTags() TranslatorOption

WithInstrumentationLibraryMetadataAsTags sets instrumentation library metadata as tags.

func WithInstrumentationScopeMetadataAsTags

func WithInstrumentationScopeMetadataAsTags() TranslatorOption

WithInstrumentationScopeMetadataAsTags sets instrumentation scope metadata as tags.

func WithNumberMode

func WithNumberMode(mode NumberMode) TranslatorOption

WithNumberMode sets the number mode. The default mode is NumberModeCumulativeToDelta.

func WithOTelPrefix added in v0.18.0

func WithOTelPrefix() TranslatorOption

WithOTelPrefix appends the `otel.` prefix to OpenTelemetry system, process and a subset of Kafka metrics.

func WithOriginProduct added in v0.8.4

func WithOriginProduct(originProduct OriginProduct) TranslatorOption

WithOriginProduct sets the origin product attribute.

func WithQuantiles

func WithQuantiles() TranslatorOption

WithQuantiles enables quantiles exporting for summary metrics.

func WithRemapping added in v0.4.0

func WithRemapping() TranslatorOption

WithRemapping specifies that certain OTEL metrics (such as container.* and system.*) need to be remapped to their Datadog counterparts because they will not be available otherwise. This happens in situations when the translator is running as part of a Collector without the Datadog Agent.

Do note that in some scenarios this process renames certain metrics (such as for example prefixing system.* and process.* metrics with the otel.* namespace).

func WithStatsOut added in v0.10.0

func WithStatsOut(statsOut chan<- []byte) TranslatorOption

WithStatsOut sets the channel where the translator will send its APM statsPayload bytes

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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