Documentation
¶
Index ¶
- Constants
- type APMStatsConsumer
- type Consumer
- type DataType
- type Dimensions
- func (d *Dimensions) AddTags(tags ...string) *Dimensions
- func (d *Dimensions) Host() string
- func (d *Dimensions) Name() string
- func (d *Dimensions) OriginCategory() OriginCategory
- func (d *Dimensions) OriginID() string
- func (d *Dimensions) OriginProduct() OriginProduct
- func (d *Dimensions) OriginService() OriginService
- func (d *Dimensions) String() string
- func (d *Dimensions) Tags() []string
- func (d *Dimensions) WithAttributeMap(labels pcommon.Map) *Dimensions
- func (d *Dimensions) WithSuffix(suffix string) *Dimensions
- type HistogramMode
- type HostConsumer
- type InitialCumulMonoValueMode
- type Metadata
- type NumberMode
- type OriginCategory
- type OriginProduct
- type OriginService
- type SketchConsumer
- type TagsConsumer
- type TimeSeriesConsumer
- type Translator
- type TranslatorOption
- func WithCountSumMetrics() TranslatorOption
- func WithDeltaTTL(deltaTTL int64) TranslatorOption
- func WithFallbackSourceProvider(provider source.Provider) TranslatorOption
- func WithHistogramAggregations() TranslatorOption
- func WithHistogramMode(mode HistogramMode) TranslatorOption
- func WithInitialCumulMonoValueMode(mode InitialCumulMonoValueMode) TranslatorOption
- func WithInstrumentationLibraryMetadataAsTags() TranslatorOption
- func WithInstrumentationScopeMetadataAsTags() TranslatorOption
- func WithNumberMode(mode NumberMode) TranslatorOption
- func WithOriginProduct(originProduct OriginProduct) TranslatorOption
- func WithQuantiles() TranslatorOption
- func WithRemapping() TranslatorOption
- func WithStatsOut(statsOut chan<- []byte) TranslatorOption
Constants ¶
const UnsetHostnamePlaceholder = "__unset__"
UnsetHostnamePlaceholder is the string used as a hostname when the hostname can not be extracted from span attributes by the processor. Upon decoding the metrics, the Translator will use its configured fallback SourceProvider to replace it with the correct hostname.
This isn't the most ideal approach to the problem, but provides the better user experience by avoiding the need to duplicate the "exporter::datadog::hostname" configuration field as "processor::datadog::hostname". The hostname can also not be left empty in case of failure to obtain it, because empty has special meaning. An empty hostname means that we are in a Lambda environment. Thus, we must use a placeholder.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APMStatsConsumer ¶
type APMStatsConsumer interface {
// ConsumeAPMStats consumes the given StatsPayload.
ConsumeAPMStats(*pb.ClientStatsPayload)
}
APMStatsConsumer implementations are able to consume APM Stats generated by a Translator.
type Consumer ¶
type Consumer interface {
TimeSeriesConsumer
SketchConsumer
APMStatsConsumer
}
Consumer is a metrics consumer.
type DataType ¶
type DataType int
DataType is a timeseries-style metric type.
func (DataType) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*DataType) UnmarshalText ¶
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) OriginCategory ¶ added in v0.8.2
func (d *Dimensions) OriginCategory() OriginCategory
OriginCategory 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) OriginService ¶ added in v0.8.2
func (d *Dimensions) OriginService() OriginService
OriginService 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) 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 OriginCategory ¶ added in v0.8.2
type OriginCategory int32
OriginCategory defines the origin category.
const OriginCategoryOTLP OriginCategory = 17
OriginCategoryOTLP is the origin category for all metrics coming from OTLP. All metrics produced by the translator MUST have origin category set to OTLP.
func (OriginCategory) String ¶ added in v0.8.4
func (o OriginCategory) String() string
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 )
func (OriginProduct) String ¶ added in v0.8.4
func (o OriginProduct) String() string
type OriginService ¶ added in v0.8.2
type OriginService int32
OriginService defines the origin service.
const ( OriginServiceUnknown OriginService = 0 OriginServiceActiveDirectoryDSReceiver OriginService = 251 OriginServiceAerospikeReceiver OriginService = 252 OriginServiceApacheReceiver OriginService = 253 OriginServiceApacheSparkReceiver OriginService = 254 OriginServiceAzureMonitorReceiver OriginService = 255 OriginServiceBigIPReceiver OriginService = 256 OriginServiceChronyReceiver OriginService = 257 OriginServiceCouchDBReceiver OriginService = 258 OriginServiceDockerStatsReceiver OriginService = 217 OriginServiceElasticsearchReceiver OriginService = 218 OriginServiceExpVarReceiver OriginService = 219 OriginServiceFileStatsReceiver OriginService = 220 OriginServiceFlinkMetricsReceiver OriginService = 221 OriginServiceGitProviderReceiver OriginService = 222 OriginServiceHAProxyReceiver OriginService = 223 OriginServiceHostMetricsReceiver OriginService = 224 OriginServiceHTTPCheckReceiver OriginService = 225 OriginServiceIISReceiver OriginService = 226 OriginServiceK8SClusterReceiver OriginService = 227 OriginServiceKafkaMetricsReceiver OriginService = 228 OriginServiceKubeletStatsReceiver OriginService = 229 OriginServiceMemcachedReceiver OriginService = 230 OriginServiceMongoDBAtlasReceiver OriginService = 231 OriginServiceMongoDBReceiver OriginService = 232 OriginServiceMySQLReceiver OriginService = 233 OriginServiceNginxReceiver OriginService = 234 OriginServiceNSXTReceiver OriginService = 235 OriginServiceOracleDBReceiver OriginService = 236 OriginServicePostgreSQLReceiver OriginService = 237 OriginServicePrometheusReceiver OriginService = 238 OriginServiceRabbitMQReceiver OriginService = 239 OriginServiceRedisReceiver OriginService = 240 OriginServiceRiakReceiver OriginService = 241 OriginServiceSAPHANAReceiver OriginService = 242 OriginServiceSNMPReceiver OriginService = 243 OriginServiceSnowflakeReceiver OriginService = 244 OriginServiceSplunkEnterpriseReceiver OriginService = 245 OriginServiceSQLServerReceiver OriginService = 246 OriginServiceSSHCheckReceiver OriginService = 247 OriginServiceStatsDReceiver OriginService = 248 OriginServiceVCenterReceiver OriginService = 249 OriginServiceZookeeperReceiver OriginService = 250 )
List all receivers that set the scope name.
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) StatsPayloadToMetrics ¶
func (t *Translator) StatsPayloadToMetrics(sp *pb.StatsPayload) pmetric.Metrics
StatsPayloadToMetrics converts an APM Stats Payload to a set of OTLP Metrics.
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 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