From 329a01b4ee6f086c594064c9407470ecdfed303d Mon Sep 17 00:00:00 2001 From: Georg P Date: Tue, 30 Jul 2024 11:35:08 +0200 Subject: [PATCH 1/6] add temporality preference / default histogram aggregation --- service/internal/proctelemetry/config.go | 80 ++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/service/internal/proctelemetry/config.go b/service/internal/proctelemetry/config.go index b2d7ae19cb7..350c8bd1d4a 100644 --- a/service/internal/proctelemetry/config.go +++ b/service/internal/proctelemetry/config.go @@ -25,6 +25,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/sdk/instrumentation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/collector/processor/processorhelper" @@ -252,6 +253,24 @@ func initOTLPgRPCExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s if len(otlpConfig.Headers) > 0 { opts = append(opts, otlpmetricgrpc.WithHeaders(otlpConfig.Headers)) } + if otlpConfig.TemporalityPreference != nil { + switch *otlpConfig.TemporalityPreference { + case "cumulative": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceCumulative)) + case "delta": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceDeltaPreferred)) + case "lowmemory": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceLowMemory)) + } + } + if otlpConfig.DefaultHistogramAggregation != nil { + switch *otlpConfig.DefaultHistogramAggregation { + case "explicit_bucket_histogram": + opts = append(opts, otlpmetricgrpc.WithAggregationSelector(aggregationPreferenceExplicitBucketHistogram)) + case "base2_exponential_bucket_histogram": + opts = append(opts, otlpmetricgrpc.WithAggregationSelector(aggregationPreferenceExponentialHistogram)) + } + } return otlpmetricgrpc.New(ctx, opts...) } @@ -289,6 +308,67 @@ func initOTLPHTTPExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s if len(otlpConfig.Headers) > 0 { opts = append(opts, otlpmetrichttp.WithHeaders(otlpConfig.Headers)) } + if otlpConfig.TemporalityPreference != nil { + switch *otlpConfig.TemporalityPreference { + case "cumulative": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceCumulative)) + case "delta": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceDeltaPreferred)) + case "lowmemory": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceLowMemory)) + } + } + if otlpConfig.DefaultHistogramAggregation != nil { + switch *otlpConfig.DefaultHistogramAggregation { + case "explicit_bucket_histogram": + opts = append(opts, otlpmetrichttp.WithAggregationSelector(aggregationPreferenceExplicitBucketHistogram)) + case "base2_exponential_bucket_histogram": + opts = append(opts, otlpmetrichttp.WithAggregationSelector(aggregationPreferenceExponentialHistogram)) + } + } return otlpmetrichttp.New(ctx, opts...) } + +func aggregationPreferenceExplicitBucketHistogram(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation { + if ik == sdkmetric.InstrumentKindHistogram { + return sdkmetric.AggregationExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + NoMinMax: false, + } + } + return sdkmetric.DefaultAggregationSelector(ik) +} + +func aggregationPreferenceExponentialHistogram(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation { + if ik == sdkmetric.InstrumentKindHistogram { + return sdkmetric.AggregationBase2ExponentialHistogram{} + } + return sdkmetric.DefaultAggregationSelector(ik) +} + +func temporalityPreferenceCumulative(ik sdkmetric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func temporalityPreferenceDeltaPreferred(ik sdkmetric.InstrumentKind) metricdata.Temporality { + switch ik { + case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindObservableCounter, sdkmetric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + case sdkmetric.InstrumentKindObservableUpDownCounter, sdkmetric.InstrumentKindUpDownCounter: + return metricdata.CumulativeTemporality + default: + return metricdata.DeltaTemporality + } +} + +func temporalityPreferenceLowMemory(ik sdkmetric.InstrumentKind) metricdata.Temporality { + switch ik { + case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + case sdkmetric.InstrumentKindObservableCounter, sdkmetric.InstrumentKindObservableUpDownCounter, sdkmetric.InstrumentKindUpDownCounter: + return metricdata.CumulativeTemporality + default: + return metricdata.DeltaTemporality + } +} From 2c216faaf270fd81efe601cb945ab6efec8e7bcf Mon Sep 17 00:00:00 2001 From: Georg P Date: Wed, 31 Jul 2024 11:43:27 +0200 Subject: [PATCH 2/6] add error message --- service/internal/proctelemetry/config.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/service/internal/proctelemetry/config.go b/service/internal/proctelemetry/config.go index 350c8bd1d4a..71a15dead68 100644 --- a/service/internal/proctelemetry/config.go +++ b/service/internal/proctelemetry/config.go @@ -255,12 +255,14 @@ func initOTLPgRPCExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s } if otlpConfig.TemporalityPreference != nil { switch *otlpConfig.TemporalityPreference { + case "delta": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceDelta)) case "cumulative": opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceCumulative)) - case "delta": - opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceDeltaPreferred)) case "lowmemory": opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(temporalityPreferenceLowMemory)) + default: + return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) } } if otlpConfig.DefaultHistogramAggregation != nil { @@ -310,12 +312,14 @@ func initOTLPHTTPExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s } if otlpConfig.TemporalityPreference != nil { switch *otlpConfig.TemporalityPreference { + case "delta": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceDelta)) case "cumulative": opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceCumulative)) - case "delta": - opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceDeltaPreferred)) case "lowmemory": opts = append(opts, otlpmetrichttp.WithTemporalitySelector(temporalityPreferenceLowMemory)) + default: + return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) } } if otlpConfig.DefaultHistogramAggregation != nil { @@ -351,7 +355,7 @@ func temporalityPreferenceCumulative(ik sdkmetric.InstrumentKind) metricdata.Tem return metricdata.CumulativeTemporality } -func temporalityPreferenceDeltaPreferred(ik sdkmetric.InstrumentKind) metricdata.Temporality { +func temporalityPreferenceDelta(ik sdkmetric.InstrumentKind) metricdata.Temporality { switch ik { case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindObservableCounter, sdkmetric.InstrumentKindHistogram: return metricdata.DeltaTemporality From 575f353055f22465fd318b13b947dc24e7f251e8 Mon Sep 17 00:00:00 2001 From: Georg P Date: Fri, 2 Aug 2024 11:27:14 +0200 Subject: [PATCH 3/6] drop aggregation preference for now --- service/internal/proctelemetry/config.go | 33 ------------------------ 1 file changed, 33 deletions(-) diff --git a/service/internal/proctelemetry/config.go b/service/internal/proctelemetry/config.go index 71a15dead68..ea2910f9925 100644 --- a/service/internal/proctelemetry/config.go +++ b/service/internal/proctelemetry/config.go @@ -265,14 +265,6 @@ func initOTLPgRPCExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) } } - if otlpConfig.DefaultHistogramAggregation != nil { - switch *otlpConfig.DefaultHistogramAggregation { - case "explicit_bucket_histogram": - opts = append(opts, otlpmetricgrpc.WithAggregationSelector(aggregationPreferenceExplicitBucketHistogram)) - case "base2_exponential_bucket_histogram": - opts = append(opts, otlpmetricgrpc.WithAggregationSelector(aggregationPreferenceExponentialHistogram)) - } - } return otlpmetricgrpc.New(ctx, opts...) } @@ -322,35 +314,10 @@ func initOTLPHTTPExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) } } - if otlpConfig.DefaultHistogramAggregation != nil { - switch *otlpConfig.DefaultHistogramAggregation { - case "explicit_bucket_histogram": - opts = append(opts, otlpmetrichttp.WithAggregationSelector(aggregationPreferenceExplicitBucketHistogram)) - case "base2_exponential_bucket_histogram": - opts = append(opts, otlpmetrichttp.WithAggregationSelector(aggregationPreferenceExponentialHistogram)) - } - } return otlpmetrichttp.New(ctx, opts...) } -func aggregationPreferenceExplicitBucketHistogram(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation { - if ik == sdkmetric.InstrumentKindHistogram { - return sdkmetric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, - NoMinMax: false, - } - } - return sdkmetric.DefaultAggregationSelector(ik) -} - -func aggregationPreferenceExponentialHistogram(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation { - if ik == sdkmetric.InstrumentKindHistogram { - return sdkmetric.AggregationBase2ExponentialHistogram{} - } - return sdkmetric.DefaultAggregationSelector(ik) -} - func temporalityPreferenceCumulative(ik sdkmetric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } From cce0c171d7cc42d796659e46304fece52498ffee Mon Sep 17 00:00:00 2001 From: Georg P Date: Fri, 2 Aug 2024 17:43:42 +0200 Subject: [PATCH 4/6] add and adapt tests --- service/internal/proctelemetry/config_test.go | 246 ++++++++++++++++-- 1 file changed, 225 insertions(+), 21 deletions(-) diff --git a/service/internal/proctelemetry/config_test.go b/service/internal/proctelemetry/config_test.go index 5228b0ead44..d0560ac9c8c 100644 --- a/service/internal/proctelemetry/config_test.go +++ b/service/internal/proctelemetry/config_test.go @@ -7,10 +7,17 @@ import ( "context" "errors" "net/url" + "reflect" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/config" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + otelprom "go.opentelemetry.io/otel/exporters/prometheus" + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" ) func strPtr(s string) *string { @@ -22,15 +29,28 @@ func intPtr(i int) *int { } func TestMetricReader(t *testing.T) { + consoleExporter, err := stdoutmetric.New( + stdoutmetric.WithPrettyPrint(), + ) + require.NoError(t, err) + ctx := context.Background() + otlpGRPCExporter, err := otlpmetricgrpc.New(ctx) + require.NoError(t, err) + otlpHTTPExporter, err := otlpmetrichttp.New(ctx) + require.NoError(t, err) + promExporter, err := otelprom.New() + require.NoError(t, err) + testCases := []struct { - name string - reader config.MetricReader - args any - err error + name string + reader config.MetricReader + args any + wantErr error + wantReader sdkmetric.Reader }{ { - name: "noreader", - err: errors.New("unsupported metric reader type { }"), + name: "noreader", + wantErr: errors.New("unsupported metric reader type { }"), }, { name: "pull prometheus invalid exporter", @@ -41,7 +61,7 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errNoValidMetricExporter, + wantErr: errNoValidMetricExporter, }, { name: "pull/prometheus-invalid-config-no-host", @@ -52,7 +72,7 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errors.New("host must be specified"), + wantErr: errors.New("host must be specified"), }, { name: "pull/prometheus-invalid-config-no-port", @@ -65,10 +85,10 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errors.New("port must be specified"), + wantErr: errors.New("port must be specified"), }, { - name: "pull/prometheus-invalid-config-no-port", + name: "pull/prometheus-valid", reader: config.MetricReader{ Pull: &config.PullMetricReader{ Exporter: config.MetricExporter{ @@ -79,6 +99,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: promExporter, }, { name: "periodic/invalid-exporter", @@ -92,14 +113,14 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errNoValidMetricExporter, + wantErr: errNoValidMetricExporter, }, { name: "periodic/no-exporter", reader: config.MetricReader{ Periodic: &config.PeriodicMetricReader{}, }, - err: errNoValidMetricExporter, + wantErr: errNoValidMetricExporter, }, { name: "periodic/console-exporter", @@ -110,6 +131,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(consoleExporter), }, { name: "periodic/console-exporter-with-timeout-interval", @@ -122,6 +144,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(consoleExporter), }, { name: "periodic/otlp-exporter-invalid-protocol", @@ -134,7 +157,7 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errors.New("unsupported protocol http/invalid"), + wantErr: errors.New("unsupported protocol http/invalid"), }, { name: "periodic/otlp-grpc-exporter-no-endpoint", @@ -152,6 +175,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), }, { name: "periodic/otlp-grpc-exporter", @@ -170,6 +194,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), }, { name: "periodic/otlp-grpc-exporter-no-scheme", @@ -188,6 +213,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), }, { name: "periodic/otlp-grpc-invalid-endpoint", @@ -206,7 +232,7 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")}, + wantErr: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")}, }, { name: "periodic/otlp-grpc-invalid-compression", @@ -225,7 +251,87 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errors.New("unsupported compression \"invalid\""), + wantErr: errors.New("unsupported compression \"invalid\""), + }, + { + name: "periodic/otlp-grpc-delta-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "grpc/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("delta"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-cumulative-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "grpc/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("cumulative"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-lowmemory-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "grpc/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("lowmemory"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-invalid-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "grpc/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("invalid"), + }, + }, + }, + }, + wantErr: errors.New("unsupported temporality preference \"invalid\""), }, { name: "periodic/otlp-http-exporter", @@ -244,6 +350,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), }, { name: "periodic/otlp-http-exporter-with-path", @@ -262,6 +369,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), }, { name: "periodic/otlp-http-exporter-no-endpoint", @@ -279,6 +387,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), }, { name: "periodic/otlp-http-exporter-no-scheme", @@ -297,6 +406,7 @@ func TestMetricReader(t *testing.T) { }, }, }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), }, { name: "periodic/otlp-http-invalid-endpoint", @@ -315,7 +425,7 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")}, + wantErr: &url.Error{Op: "parse", URL: "http:// ", Err: url.InvalidHostError(" ")}, }, { name: "periodic/otlp-http-invalid-compression", @@ -334,21 +444,115 @@ func TestMetricReader(t *testing.T) { }, }, }, - err: errors.New("unsupported compression \"invalid\""), + wantErr: errors.New("unsupported compression \"invalid\""), + }, + { + name: "periodic/otlp-http-cumulative-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "http/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("cumulative"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-lowmemory-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "http/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("lowmemory"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-delta-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "http/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("delta"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-invalid-temporality", + reader: config.MetricReader{ + Periodic: &config.PeriodicMetricReader{ + Exporter: config.MetricExporter{ + OTLP: &config.OTLPMetric{ + Protocol: "http/protobuf", + Endpoint: "localhost:4318", + Compression: strPtr("none"), + Timeout: intPtr(1000), + Headers: map[string]string{ + "test": "test1", + }, + TemporalityPreference: strPtr("invalid"), + }, + }, + }, + }, + wantErr: errors.New("unsupported temporality preference \"invalid\""), }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - reader, server, err := InitMetricReader(context.Background(), tt.reader, make(chan error)) + gotReader, server, err := InitMetricReader(context.Background(), tt.reader, make(chan error)) + defer func() { - if reader != nil { - assert.NoError(t, reader.Shutdown(context.Background())) + if gotReader != nil { + assert.NoError(t, gotReader.Shutdown(context.Background())) } if server != nil { assert.NoError(t, server.Shutdown(context.Background())) } }() - assert.Equal(t, tt.err, err) + + assert.Equal(t, tt.wantErr, err) + + if tt.wantReader == nil { + assert.Nil(t, gotReader) + } else { + assert.Equal(t, reflect.TypeOf(tt.wantReader), reflect.TypeOf(gotReader)) + + if reflect.TypeOf(tt.wantReader).String() == "*metric.PeriodicReader" { + wantExporterType := reflect.Indirect(reflect.ValueOf(tt.wantReader)).FieldByName("exporter").Elem().Type() + gotExporterType := reflect.Indirect(reflect.ValueOf(gotReader)).FieldByName("exporter").Elem().Type() + assert.Equal(t, wantExporterType, gotExporterType) + } + } }) } } From 523aef9512381d6f45f4ffa313590c2d77ba7a44 Mon Sep 17 00:00:00 2001 From: Georg P Date: Fri, 2 Aug 2024 17:59:37 +0200 Subject: [PATCH 5/6] add changelog --- .chloggen/int-telemetry-otlp-options.yaml | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/int-telemetry-otlp-options.yaml diff --git a/.chloggen/int-telemetry-otlp-options.yaml b/.chloggen/int-telemetry-otlp-options.yaml new file mode 100644 index 00000000000..008977eeb6f --- /dev/null +++ b/.chloggen/int-telemetry-otlp-options.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: service + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Implement the `temporality_preference` setting for internal telemetry exported via OTLP" + +# One or more tracking issues or pull requests related to the change +issues: [ 10745 ] + +# (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: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [ user ] From 56431ed71ac603fa6f407c23574f4c119de61603 Mon Sep 17 00:00:00 2001 From: Georg Pirklbauer Date: Mon, 5 Aug 2024 09:14:48 +0200 Subject: [PATCH 6/6] Suggestion from code review Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- service/internal/proctelemetry/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/internal/proctelemetry/config.go b/service/internal/proctelemetry/config.go index ea2910f9925..14e533344d0 100644 --- a/service/internal/proctelemetry/config.go +++ b/service/internal/proctelemetry/config.go @@ -318,7 +318,7 @@ func initOTLPHTTPExporter(ctx context.Context, otlpConfig *config.OTLPMetric) (s return otlpmetrichttp.New(ctx, opts...) } -func temporalityPreferenceCumulative(ik sdkmetric.InstrumentKind) metricdata.Temporality { +func temporalityPreferenceCumulative(_ sdkmetric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality }