Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/mackjmr_remove-unused-rattr-as-tags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component (e.g. pkg/quantile)
component: pkg/metrics

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove `WithResourceAttributesAsTags()` and `translatorConfig.ResourceAttributesAsTags`

# The PR related to this change
issues: [219]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
22 changes: 5 additions & 17 deletions pkg/otlp/metrics/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ import (

type translatorConfig struct {
// metrics export behavior
HistMode HistogramMode
SendHistogramAggregations bool
Quantiles bool
NumberMode NumberMode
InitialCumulMonoValueMode InitialCumulMonoValueMode
ResourceAttributesAsTags bool
// Deprecated: use InstrumentationScopeMetadataAsTags instead in favor of
// https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.15.0
// Both must not be enabled at the same time.
HistMode HistogramMode
SendHistogramAggregations bool
Quantiles bool
NumberMode NumberMode
InitialCumulMonoValueMode InitialCumulMonoValueMode
InstrumentationLibraryMetadataAsTags bool
InstrumentationScopeMetadataAsTags bool

Expand Down Expand Up @@ -95,14 +91,6 @@ func WithQuantiles() TranslatorOption {
}
}

// WithResourceAttributesAsTags sets resource attributes as tags.
func WithResourceAttributesAsTags() TranslatorOption {
return func(t *translatorConfig) error {
t.ResourceAttributesAsTags = true
return nil
}
}

// WithInstrumentationLibraryMetadataAsTags sets instrumentation library metadata as tags.
func WithInstrumentationLibraryMetadataAsTags() TranslatorOption {
return func(t *translatorConfig) error {
Expand Down
15 changes: 5 additions & 10 deletions pkg/otlp/metrics/histograms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,11 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
expectedUnsupportedAggregationTemporality: 1,
},
{
name: "resource-attributes-as-tags",
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-tags.json",
options: []TranslatorOption{
WithResourceAttributesAsTags(),
},
expectedUnknownMetricType: 1,
name: "resource-attributes-as-tags",
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-tags.json",
options: []TranslatorOption{},
expectedUnknownMetricType: 1,
expectedUnsupportedAggregationTemporality: 1,
},
{
Expand Down Expand Up @@ -242,7 +240,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-ilmd-tags.json",
options: []TranslatorOption{
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
},
expectedUnknownMetricType: 1,
Expand All @@ -254,7 +251,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
ddogfile: "testdata/datadogdata/histogram/simple-exponential_cs-both-tags.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
},
expectedUnknownMetricType: 1,
Expand All @@ -266,7 +262,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
ddogfile: "testdata/datadogdata/histogram/simple-exponential_all.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
WithInstrumentationScopeMetadataAsTags(),
},
Expand Down
1 change: 0 additions & 1 deletion pkg/otlp/metrics/metrics_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func NewTranslator(logger *zap.Logger, options ...TranslatorOption) (*Translator
Quantiles: false,
NumberMode: NumberModeCumulativeToDelta,
InitialCumulMonoValueMode: InitialCumulMonoValueModeAuto,
ResourceAttributesAsTags: false,
InstrumentationLibraryMetadataAsTags: false,
sweepInterval: 1800,
deltaTTL: 3600,
Expand Down
15 changes: 5 additions & 10 deletions pkg/otlp/metrics/mixed_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ func TestMapMetrics(t *testing.T) {
expectedUnsupportedAggregationTemporality: 2,
},
{
name: "resource-attributes-as-tags",
otlpfile: "testdata/otlpdata/mixed/simple.json",
ddogfile: "testdata/datadogdata/mixed/simple_res-tags.json",
options: []TranslatorOption{
WithResourceAttributesAsTags(),
},
expectedUnknownMetricType: 1,
name: "resource-attributes-as-tags",
otlpfile: "testdata/otlpdata/mixed/simple.json",
ddogfile: "testdata/datadogdata/mixed/simple_res-tags.json",
options: []TranslatorOption{},
expectedUnknownMetricType: 1,
expectedUnsupportedAggregationTemporality: 2,
},
{
Expand Down Expand Up @@ -87,7 +85,6 @@ func TestMapMetrics(t *testing.T) {
otlpfile: "testdata/otlpdata/mixed/simple.json",
ddogfile: "testdata/datadogdata/mixed/simple_res-ilmd-tags.json",
options: []TranslatorOption{
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
},
expectedUnknownMetricType: 1,
Expand All @@ -99,7 +96,6 @@ func TestMapMetrics(t *testing.T) {
ddogfile: "testdata/datadogdata/mixed/simple_cs-both-tags.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
},
expectedUnknownMetricType: 1,
Expand All @@ -111,7 +107,6 @@ func TestMapMetrics(t *testing.T) {
ddogfile: "testdata/datadogdata/mixed/simple_all.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
WithInstrumentationScopeMetadataAsTags(),
},
Expand Down