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) OriginID() string
- 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 NumberMode
- 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 WithInstrumentationLibraryMetadataAsTags() TranslatorOption
- func WithInstrumentationScopeMetadataAsTags() TranslatorOption
- func WithNumberMode(mode NumberMode) TranslatorOption
- func WithQuantiles() TranslatorOption
- func WithResourceAttributesAsTags() 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) OriginID ¶
func (d *Dimensions) OriginID() string
OriginID of the metric (may be empty).
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 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 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(logger *zap.Logger, options ...TranslatorOption) (*Translator, error)
NewTranslator creates a new translator with given options.
func (*Translator) MapMetrics ¶
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.
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 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 WithQuantiles ¶
func WithQuantiles() TranslatorOption
WithQuantiles enables quantiles exporting for summary metrics.
func WithResourceAttributesAsTags ¶
func WithResourceAttributesAsTags() TranslatorOption
WithResourceAttributesAsTags sets resource attributes as tags.