Skip to content

Commit

Permalink
Remove ResourceAttributesAsTags (#219)
Browse files Browse the repository at this point in the history
* remove unused ResourceAttributesAsTags

* changelog

* make fmt
  • Loading branch information
mackjmr authored Dec 12, 2023
1 parent 3086b1d commit 8b736e4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 38 deletions.
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 @@ -188,13 +188,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 @@ -243,7 +241,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 @@ -255,7 +252,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 @@ -267,7 +263,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 @@ -70,7 +70,6 @@ func NewTranslator(set component.TelemetrySettings, options ...TranslatorOption)
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 @@ -33,13 +33,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 @@ -88,7 +86,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 @@ -100,7 +97,6 @@ func TestMapMetrics(t *testing.T) {
ddogfile: "testdata/datadogdata/mixed/simple_cs-both-tags.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
},
expectedUnknownMetricType: 1,
Expand All @@ -112,7 +108,6 @@ func TestMapMetrics(t *testing.T) {
ddogfile: "testdata/datadogdata/mixed/simple_all.json",
options: []TranslatorOption{
WithHistogramAggregations(),
WithResourceAttributesAsTags(),
WithInstrumentationLibraryMetadataAsTags(),
WithInstrumentationScopeMetadataAsTags(),
},
Expand Down

0 comments on commit 8b736e4

Please sign in to comment.