Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 8b736e4

Browse files
authored
Remove ResourceAttributesAsTags (#219)
* remove unused ResourceAttributesAsTags * changelog * make fmt
1 parent 3086b1d commit 8b736e4

File tree

5 files changed

+31
-38
lines changed

5 files changed

+31
-38
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component (e.g. pkg/quantile)
5+
component: pkg/metrics
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Remove `WithResourceAttributesAsTags()` and `translatorConfig.ResourceAttributesAsTags`
9+
10+
# The PR related to this change
11+
issues: [219]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

pkg/otlp/metrics/config.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@ import (
2222

2323
type translatorConfig struct {
2424
// metrics export behavior
25-
HistMode HistogramMode
26-
SendHistogramAggregations bool
27-
Quantiles bool
28-
NumberMode NumberMode
29-
InitialCumulMonoValueMode InitialCumulMonoValueMode
30-
ResourceAttributesAsTags bool
31-
// Deprecated: use InstrumentationScopeMetadataAsTags instead in favor of
32-
// https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.15.0
33-
// Both must not be enabled at the same time.
25+
HistMode HistogramMode
26+
SendHistogramAggregations bool
27+
Quantiles bool
28+
NumberMode NumberMode
29+
InitialCumulMonoValueMode InitialCumulMonoValueMode
3430
InstrumentationLibraryMetadataAsTags bool
3531
InstrumentationScopeMetadataAsTags bool
3632

@@ -95,14 +91,6 @@ func WithQuantiles() TranslatorOption {
9591
}
9692
}
9793

98-
// WithResourceAttributesAsTags sets resource attributes as tags.
99-
func WithResourceAttributesAsTags() TranslatorOption {
100-
return func(t *translatorConfig) error {
101-
t.ResourceAttributesAsTags = true
102-
return nil
103-
}
104-
}
105-
10694
// WithInstrumentationLibraryMetadataAsTags sets instrumentation library metadata as tags.
10795
func WithInstrumentationLibraryMetadataAsTags() TranslatorOption {
10896
return func(t *translatorConfig) error {

pkg/otlp/metrics/histograms_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,11 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
188188
expectedUnsupportedAggregationTemporality: 1,
189189
},
190190
{
191-
name: "resource-attributes-as-tags",
192-
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
193-
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-tags.json",
194-
options: []TranslatorOption{
195-
WithResourceAttributesAsTags(),
196-
},
197-
expectedUnknownMetricType: 1,
191+
name: "resource-attributes-as-tags",
192+
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
193+
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-tags.json",
194+
options: []TranslatorOption{},
195+
expectedUnknownMetricType: 1,
198196
expectedUnsupportedAggregationTemporality: 1,
199197
},
200198
{
@@ -243,7 +241,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
243241
otlpfile: "testdata/otlpdata/histogram/simple-exponential.json",
244242
ddogfile: "testdata/datadogdata/histogram/simple-exponential_res-ilmd-tags.json",
245243
options: []TranslatorOption{
246-
WithResourceAttributesAsTags(),
247244
WithInstrumentationLibraryMetadataAsTags(),
248245
},
249246
expectedUnknownMetricType: 1,
@@ -255,7 +252,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
255252
ddogfile: "testdata/datadogdata/histogram/simple-exponential_cs-both-tags.json",
256253
options: []TranslatorOption{
257254
WithHistogramAggregations(),
258-
WithResourceAttributesAsTags(),
259255
WithInstrumentationLibraryMetadataAsTags(),
260256
},
261257
expectedUnknownMetricType: 1,
@@ -267,7 +263,6 @@ func TestExponentialHistogramTranslatorOptions(t *testing.T) {
267263
ddogfile: "testdata/datadogdata/histogram/simple-exponential_all.json",
268264
options: []TranslatorOption{
269265
WithHistogramAggregations(),
270-
WithResourceAttributesAsTags(),
271266
WithInstrumentationLibraryMetadataAsTags(),
272267
WithInstrumentationScopeMetadataAsTags(),
273268
},

pkg/otlp/metrics/metrics_translator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ func NewTranslator(set component.TelemetrySettings, options ...TranslatorOption)
7070
Quantiles: false,
7171
NumberMode: NumberModeCumulativeToDelta,
7272
InitialCumulMonoValueMode: InitialCumulMonoValueModeAuto,
73-
ResourceAttributesAsTags: false,
7473
InstrumentationLibraryMetadataAsTags: false,
7574
sweepInterval: 1800,
7675
deltaTTL: 3600,

pkg/otlp/metrics/mixed_metrics_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ func TestMapMetrics(t *testing.T) {
3333
expectedUnsupportedAggregationTemporality: 2,
3434
},
3535
{
36-
name: "resource-attributes-as-tags",
37-
otlpfile: "testdata/otlpdata/mixed/simple.json",
38-
ddogfile: "testdata/datadogdata/mixed/simple_res-tags.json",
39-
options: []TranslatorOption{
40-
WithResourceAttributesAsTags(),
41-
},
42-
expectedUnknownMetricType: 1,
36+
name: "resource-attributes-as-tags",
37+
otlpfile: "testdata/otlpdata/mixed/simple.json",
38+
ddogfile: "testdata/datadogdata/mixed/simple_res-tags.json",
39+
options: []TranslatorOption{},
40+
expectedUnknownMetricType: 1,
4341
expectedUnsupportedAggregationTemporality: 2,
4442
},
4543
{
@@ -88,7 +86,6 @@ func TestMapMetrics(t *testing.T) {
8886
otlpfile: "testdata/otlpdata/mixed/simple.json",
8987
ddogfile: "testdata/datadogdata/mixed/simple_res-ilmd-tags.json",
9088
options: []TranslatorOption{
91-
WithResourceAttributesAsTags(),
9289
WithInstrumentationLibraryMetadataAsTags(),
9390
},
9491
expectedUnknownMetricType: 1,
@@ -100,7 +97,6 @@ func TestMapMetrics(t *testing.T) {
10097
ddogfile: "testdata/datadogdata/mixed/simple_cs-both-tags.json",
10198
options: []TranslatorOption{
10299
WithHistogramAggregations(),
103-
WithResourceAttributesAsTags(),
104100
WithInstrumentationLibraryMetadataAsTags(),
105101
},
106102
expectedUnknownMetricType: 1,
@@ -112,7 +108,6 @@ func TestMapMetrics(t *testing.T) {
112108
ddogfile: "testdata/datadogdata/mixed/simple_all.json",
113109
options: []TranslatorOption{
114110
WithHistogramAggregations(),
115-
WithResourceAttributesAsTags(),
116111
WithInstrumentationLibraryMetadataAsTags(),
117112
WithInstrumentationScopeMetadataAsTags(),
118113
},

0 commit comments

Comments
 (0)