diff --git a/.chloggen/mackjmr_remove-unused-rattr-as-tags.yaml b/.chloggen/mackjmr_remove-unused-rattr-as-tags.yaml new file mode 100755 index 00000000..e9aa8317 --- /dev/null +++ b/.chloggen/mackjmr_remove-unused-rattr-as-tags.yaml @@ -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: diff --git a/pkg/otlp/metrics/config.go b/pkg/otlp/metrics/config.go index 94f99913..f5c9dd1b 100644 --- a/pkg/otlp/metrics/config.go +++ b/pkg/otlp/metrics/config.go @@ -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 @@ -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 { diff --git a/pkg/otlp/metrics/histograms_test.go b/pkg/otlp/metrics/histograms_test.go index 18278483..3c1c931e 100644 --- a/pkg/otlp/metrics/histograms_test.go +++ b/pkg/otlp/metrics/histograms_test.go @@ -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, }, { @@ -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, @@ -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, @@ -266,7 +262,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) { ddogfile: "testdata/datadogdata/histogram/simple-exponential_all.json", options: []TranslatorOption{ WithHistogramAggregations(), - WithResourceAttributesAsTags(), WithInstrumentationLibraryMetadataAsTags(), WithInstrumentationScopeMetadataAsTags(), }, diff --git a/pkg/otlp/metrics/metrics_translator.go b/pkg/otlp/metrics/metrics_translator.go index 586534c3..7a05491e 100644 --- a/pkg/otlp/metrics/metrics_translator.go +++ b/pkg/otlp/metrics/metrics_translator.go @@ -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, diff --git a/pkg/otlp/metrics/mixed_metrics_test.go b/pkg/otlp/metrics/mixed_metrics_test.go index 9e4e6e34..10e182fe 100644 --- a/pkg/otlp/metrics/mixed_metrics_test.go +++ b/pkg/otlp/metrics/mixed_metrics_test.go @@ -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, }, { @@ -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, @@ -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, @@ -111,7 +107,6 @@ func TestMapMetrics(t *testing.T) { ddogfile: "testdata/datadogdata/mixed/simple_all.json", options: []TranslatorOption{ WithHistogramAggregations(), - WithResourceAttributesAsTags(), WithInstrumentationLibraryMetadataAsTags(), WithInstrumentationScopeMetadataAsTags(), },