diff --git a/.chloggen/add-feature-flag-for-updated-datadog-span-receiver.yaml b/.chloggen/add-feature-flag-for-updated-datadog-span-receiver.yaml new file mode 100644 index 000000000000..d6fdc6909775 --- /dev/null +++ b/.chloggen/add-feature-flag-for-updated-datadog-span-receiver.yaml @@ -0,0 +1,14 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: datadogexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Add a feature gate datadog.EnableReceiveResourceSpansV2. Enabling this gate uses a refactored implementation of OTLP->Datadog Span translation in datadogexporter and datadogconnector which improves performance by 10%, and deprecates the following functionality: + - No longer checks for resource-related values (container, env, hostname) in span attributes. This previous behavior did not follow the OTel spec." + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37171] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9ab6d5813018..373abb2121eb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -26,7 +26,7 @@ confmap/provider/s3provider/ @open-telemetry/collector-cont confmap/provider/secretsmanagerprovider/ @open-telemetry/collector-contrib-approvers @driverpt @atoulme connector/countconnector/ @open-telemetry/collector-contrib-approvers @djaglowski @jpkrohling -connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 @jade-guiton-dd +connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 @jade-guiton-dd @IbraheemA connector/exceptionsconnector/ @open-telemetry/collector-contrib-approvers @marctc connector/failoverconnector/ @open-telemetry/collector-contrib-approvers @akats7 @fatsheep9146 connector/grafanacloudconnector/ @open-telemetry/collector-contrib-approvers @rlankfo @jcreixell @@ -54,7 +54,7 @@ exporter/carbonexporter/ @open-telemetry/collector-cont exporter/cassandraexporter/ @open-telemetry/collector-contrib-approvers @atoulme @emreyalvac exporter/clickhouseexporter/ @open-telemetry/collector-contrib-approvers @hanjm @dmitryax @Frapschen @SpencerTorres exporter/coralogixexporter/ @open-telemetry/collector-contrib-approvers @povilasv -exporter/datadogexporter/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd +exporter/datadogexporter/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd @IbraheemA exporter/datasetexporter/ @open-telemetry/collector-contrib-approvers @atoulme @martin-majlis-s1 @zdaratom-s1 @tomaz-s1 exporter/dorisexporter/ @open-telemetry/collector-contrib-approvers @atoulme @joker-star-l exporter/elasticsearchexporter/ @open-telemetry/collector-contrib-approvers @JaredTan95 @carsonip @lahsivjar @@ -146,7 +146,7 @@ internal/tools/ @open-telemetry/collector-cont pkg/batchperresourceattr/ @open-telemetry/collector-contrib-approvers @atoulme @dmitryax pkg/batchpersignal/ @open-telemetry/collector-contrib-approvers @jpkrohling -pkg/datadog/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd +pkg/datadog/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd @IbraheemA pkg/experimentalmetricmetadata/ @open-telemetry/collector-contrib-approvers @dmitryax pkg/golden/ @open-telemetry/collector-contrib-approvers @djaglowski @atoulme pkg/kafka/topic/ @open-telemetry/collector-contrib-approvers @pavolloffay @MovieStoreGuy diff --git a/connector/datadogconnector/README.md b/connector/datadogconnector/README.md index a80b0c33eb91..f2c9b13726a1 100644 --- a/connector/datadogconnector/README.md +++ b/connector/datadogconnector/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Distributions | [contrib] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fdatadog%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fdatadog) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fdatadog%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fdatadog) | -| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd), [@IbraheemA](https://www.github.com/IbraheemA) | | Emeritus | [@gbbr](https://www.github.com/gbbr) | [beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta diff --git a/connector/datadogconnector/connector.go b/connector/datadogconnector/connector.go index f81c244f801a..32f4ba4c6d72 100644 --- a/connector/datadogconnector/connector.go +++ b/connector/datadogconnector/connector.go @@ -24,6 +24,8 @@ import ( semconv "go.opentelemetry.io/collector/semconv/v1.27.0" "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog" ) // traceToMetricConnector is the schema for connector @@ -117,6 +119,9 @@ func getTraceAgentCfg(logger *zap.Logger, cfg TracesConfig, attributesTranslator logger.Info("traces::compute_top_level_by_span_kind needs to be enabled in both the Datadog connector and Datadog exporter configs if both components are being used") acfg.Features["enable_otlp_compute_top_level_by_span_kind"] = struct{}{} } + if datadog.ReceiveResourceSpansV2FeatureGate.IsEnabled() { + acfg.Features["enable_receive_resource_spans_v2"] = struct{}{} + } if v := cfg.BucketInterval; v > 0 { acfg.BucketInterval = v } diff --git a/connector/datadogconnector/connector_test.go b/connector/datadogconnector/connector_test.go index 71ca2db0e58d..9e9e426c9595 100644 --- a/connector/datadogconnector/connector_test.go +++ b/connector/datadogconnector/connector_test.go @@ -192,6 +192,67 @@ func TestContainerTags(t *testing.T) { assert.ElementsMatch(t, []string{"region:my-region", "zone:my-zone", "az:my-az"}, tags) } +func TestReceiveResourceSpansV2(t *testing.T) { + t.Run("ReceiveResourceSpansV1", func(t *testing.T) { + testReceiveResourceSpansV2(t, false) + }) + t.Run("ReceiveResourceSpansV2", func(t *testing.T) { + testReceiveResourceSpansV2(t, true) + }) +} + +func testReceiveResourceSpansV2(t *testing.T, enableReceiveResourceSpansV2 bool) { + if enableReceiveResourceSpansV2 { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + } + connector, metricsSink := creteConnector(t) + err := connector.Start(context.Background(), componenttest.NewNopHost()) + if err != nil { + t.Errorf("Error starting connector: %v", err) + return + } + defer func() { + _ = connector.Shutdown(context.Background()) + }() + + trace := generateTrace() + sattr := trace.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Attributes() + + sattr.PutStr("deployment.environment.name", "do-not-use") + + err = connector.ConsumeTraces(context.Background(), trace) + assert.NoError(t, err) + + for { + if len(metricsSink.AllMetrics()) > 0 { + break + } + time.Sleep(100 * time.Millisecond) + } + + // check if the container tags are added to the metrics + metrics := metricsSink.AllMetrics() + assert.Len(t, metrics, 1) + + ch := make(chan []byte, 100) + tr := newTranslatorWithStatsChannel(t, zap.NewNop(), ch) + _, err = tr.MapMetrics(context.Background(), metrics[0], nil) + require.NoError(t, err) + msg := <-ch + sp := &pb.StatsPayload{} + + err = proto.Unmarshal(msg, sp) + require.NoError(t, err) + + if enableReceiveResourceSpansV2 { + assert.Equal(t, "none", sp.Stats[0].Env) + } else { + assert.Equal(t, "do-not-use", sp.Stats[0].Env) + } +} + func newTranslatorWithStatsChannel(t *testing.T, logger *zap.Logger, ch chan []byte) *otlpmetrics.Translator { options := []otlpmetrics.TranslatorOption{ otlpmetrics.WithHistogramMode(otlpmetrics.HistogramModeDistributions), diff --git a/connector/datadogconnector/metadata.yaml b/connector/datadogconnector/metadata.yaml index 42aeeee24f4e..d5ead1ee8e0e 100644 --- a/connector/datadogconnector/metadata.yaml +++ b/connector/datadogconnector/metadata.yaml @@ -6,9 +6,9 @@ status: beta: [traces_to_metrics, traces_to_traces] distributions: [contrib] codeowners: - active: [mx-psi, dineshg13, ankitpatel96, jade-guiton-dd] + active: [mx-psi, dineshg13, ankitpatel96, jade-guiton-dd, IbraheemA] emeritus: [gbbr] tests: goleak: - skip: true \ No newline at end of file + skip: true diff --git a/exporter/datadogexporter/README.md b/exporter/datadogexporter/README.md index 73524f795985..92b77e2f33e0 100644 --- a/exporter/datadogexporter/README.md +++ b/exporter/datadogexporter/README.md @@ -6,7 +6,7 @@ | Stability | [beta]: traces, metrics, logs | | Distributions | [contrib] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fdatadog%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fdatadog) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fdatadog%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fdatadog) | -| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@liustanley](https://www.github.com/liustanley), [@songy23](https://www.github.com/songy23), [@mackjmr](https://www.github.com/mackjmr), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@liustanley](https://www.github.com/liustanley), [@songy23](https://www.github.com/songy23), [@mackjmr](https://www.github.com/mackjmr), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd), [@IbraheemA](https://www.github.com/IbraheemA) | | Emeritus | [@gbbr](https://www.github.com/gbbr) | [beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta diff --git a/exporter/datadogexporter/metadata.yaml b/exporter/datadogexporter/metadata.yaml index bb1f67478bbe..c4a966a52ac3 100644 --- a/exporter/datadogexporter/metadata.yaml +++ b/exporter/datadogexporter/metadata.yaml @@ -6,7 +6,7 @@ status: beta: [traces, metrics, logs] distributions: [contrib] codeowners: - active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd] + active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd, IbraheemA] emeritus: [gbbr] tests: @@ -22,4 +22,4 @@ tests: expect_consumer_error: true goleak: setup: "setupTestMain(m)" - skip: true \ No newline at end of file + skip: true diff --git a/exporter/datadogexporter/traces_exporter.go b/exporter/datadogexporter/traces_exporter.go index a510c7e88ae4..f87378db9e1f 100644 --- a/exporter/datadogexporter/traces_exporter.go +++ b/exporter/datadogexporter/traces_exporter.go @@ -32,6 +32,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/hostmetadata" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metrics" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/scrub" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog" ) var traceCustomHTTPFeatureGate = featuregate.GlobalRegistry().MustRegister( @@ -238,6 +239,9 @@ func newTraceAgentConfig(ctx context.Context, params exporter.Settings, cfg *Con if cfg.Traces.ComputeTopLevelBySpanKind { acfg.Features["enable_otlp_compute_top_level_by_span_kind"] = struct{}{} } + if datadog.ReceiveResourceSpansV2FeatureGate.IsEnabled() { + acfg.Features["enable_receive_resource_spans_v2"] = struct{}{} + } tracelog.SetLogger(&zaplogger{params.Logger}) // TODO: This shouldn't be a singleton return acfg, nil } diff --git a/exporter/datadogexporter/traces_exporter_test.go b/exporter/datadogexporter/traces_exporter_test.go index 169276dd8c9d..9ef4b8e87861 100644 --- a/exporter/datadogexporter/traces_exporter_test.go +++ b/exporter/datadogexporter/traces_exporter_test.go @@ -25,6 +25,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/exporter/exportertest" + "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" conventions127 "go.opentelemetry.io/collector/semconv/v1.27.0" @@ -103,6 +104,22 @@ func (testlogger) Criticalf(format string, params ...any) error { func (testlogger) Flush() {} func TestTracesSource(t *testing.T) { + t.Run("ReceiveResourceSpansV1", func(t *testing.T) { + testTracesSource(t, false) + }) + + t.Run("ReceiveResourceSpansV2", func(t *testing.T) { + testTracesSource(t, true) + }) +} + +func testTracesSource(t *testing.T, enableReceiveResourceSpansV2 bool) { + if enableReceiveResourceSpansV2 { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + } + reqs := make(chan []byte, 1) metricsServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var expectedMetricEndpoint string @@ -212,7 +229,7 @@ func TestTracesSource(t *testing.T) { } { t.Run("", func(t *testing.T) { ctx := context.Background() - err = exporter.ConsumeTraces(ctx, simpleTracesWithAttributes(tt.attrs)) + err = exporter.ConsumeTraces(ctx, simpleTracesWithResAttributes(tt.attrs)) assert.NoError(err) timeout := time.After(time.Second) select { @@ -234,6 +251,21 @@ func TestTracesSource(t *testing.T) { } func TestTraceExporter(t *testing.T) { + t.Run("ReceiveResourceSpansV1", func(t *testing.T) { + testTraceExporter(t, false) + }) + + t.Run("ReceiveResourceSpansV2", func(t *testing.T) { + testTraceExporter(t, true) + }) +} + +func testTraceExporter(t *testing.T, enableReceiveResourceSpansV2 bool) { + if enableReceiveResourceSpansV2 { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + } metricsServer := testutil.DatadogServerMock() defer metricsServer.Close() @@ -304,6 +336,21 @@ func TestNewTracesExporter(t *testing.T) { } func TestPushTraceData(t *testing.T) { + t.Run("ReceiveResourceSpansV1", func(t *testing.T) { + testPushTraceData(t, false) + }) + + t.Run("ReceiveResourceSpansV2", func(t *testing.T) { + testPushTraceData(t, true) + }) +} + +func testPushTraceData(t *testing.T, enableReceiveResourceSpansV2 bool) { + if enableReceiveResourceSpansV2 { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + } server := testutil.DatadogServerMock() defer server.Close() cfg := &Config{ @@ -340,7 +387,23 @@ func TestPushTraceData(t *testing.T) { assert.Equal(t, "custom-hostname", recvMetadata.InternalHostname) } -func TestPushTraceData_NewEnvConvention(t *testing.T) { +func TestPushTraceDataNewEnvConvention(t *testing.T) { + t.Run("ReceiveResourceSpansV1", func(t *testing.T) { + testPushTraceDataNewEnvConvention(t, false) + }) + + t.Run("ReceiveResourceSpansV2", func(t *testing.T) { + testPushTraceDataNewEnvConvention(t, true) + }) +} + +func testPushTraceDataNewEnvConvention(t *testing.T, enableReceiveResourceSpansV2 bool) { + if enableReceiveResourceSpansV2 { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + } + tracesRec := &testutil.HTTPRequestRecorderWithChan{Pattern: testutil.TraceEndpoint, ReqChan: make(chan []byte)} server := testutil.DatadogServerMock(tracesRec.HandlerFunc) defer server.Close() @@ -365,7 +428,7 @@ func TestPushTraceData_NewEnvConvention(t *testing.T) { exp, err := f.CreateTraces(context.Background(), params, cfg) assert.NoError(t, err) - err = exp.ConsumeTraces(context.Background(), simpleTracesWithAttributes(map[string]any{conventions127.AttributeDeploymentEnvironmentName: "new_env"})) + err = exp.ConsumeTraces(context.Background(), simpleTracesWithResAttributes(map[string]any{conventions127.AttributeDeploymentEnvironmentName: "new_env"})) assert.NoError(t, err) reqBytes := <-tracesRec.ReqChan @@ -380,24 +443,92 @@ func TestPushTraceData_NewEnvConvention(t *testing.T) { assert.Equal(t, "new_env", traces.TracerPayloads[0].GetEnv()) } +func TestResRelatedAttributesInSpanAttributes_ReceiveResourceSpansV2Enabled(t *testing.T) { + if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil { + t.Fatal(err) + } + + tracesRec := &testutil.HTTPRequestRecorderWithChan{Pattern: testutil.TraceEndpoint, ReqChan: make(chan []byte)} + server := testutil.DatadogServerMock(tracesRec.HandlerFunc) + defer server.Close() + cfg := &Config{ + API: APIConfig{ + Key: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + TagsConfig: TagsConfig{ + Hostname: "test-host", + }, + Metrics: MetricsConfig{ + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}, + }, + Traces: TracesConfig{ + TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL}, + }, + } + cfg.Traces.SetFlushInterval(0.1) + + params := exportertest.NewNopSettings() + f := NewFactory() + exp, err := f.CreateTraces(context.Background(), params, cfg) + assert.NoError(t, err) + + sattr := map[string]any{ + "datadog.host.name": "do-not-use", + "container.id": "do-not-use", + "k8s.pod.id": "do-not-use", + "deployment.environment.name": "do-not-use", + "service.name": "do-not-use", + "service.version": "do-not-use", + } + err = exp.ConsumeTraces(context.Background(), simpleTracesWithResAndSpanAttributes(nil, sattr)) + assert.NoError(t, err) + + reqBytes := <-tracesRec.ReqChan + buf := bytes.NewBuffer(reqBytes) + reader, err := gzip.NewReader(buf) + require.NoError(t, err) + slurp, err := io.ReadAll(reader) + require.NoError(t, err) + var traces pb.AgentPayload + require.NoError(t, proto.Unmarshal(slurp, &traces)) + assert.Len(t, traces.TracerPayloads, 1) + tracerPayload := traces.TracerPayloads[0] + span := tracerPayload.Chunks[0].Spans[0] + assert.Equal(t, "test-host", tracerPayload.Hostname) + assert.Empty(t, tracerPayload.ContainerID) + assert.Empty(t, tracerPayload.Env) + assert.Equal(t, "otlpresourcenoservicename", span.Service) + assert.Empty(t, span.Meta["version"]) +} + func simpleTraces() ptrace.Traces { - return genTraces([16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}, nil) + return genTraces([16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}, nil, nil) } -func simpleTracesWithAttributes(attrs map[string]any) ptrace.Traces { - return genTraces([16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}, attrs) +func simpleTracesWithResAttributes(rattrs map[string]any) ptrace.Traces { + return genTraces([16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}, rattrs, nil) } -func genTraces(traceID pcommon.TraceID, attrs map[string]any) ptrace.Traces { +func simpleTracesWithResAndSpanAttributes(rattrs map[string]any, sattrs map[string]any) ptrace.Traces { + return genTraces([16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}, rattrs, sattrs) +} + +func genTraces(traceID pcommon.TraceID, rattrs map[string]any, sattrs map[string]any) ptrace.Traces { traces := ptrace.NewTraces() rspans := traces.ResourceSpans().AppendEmpty() span := rspans.ScopeSpans().AppendEmpty().Spans().AppendEmpty() span.SetTraceID(traceID) span.SetSpanID([8]byte{0, 0, 0, 0, 1, 2, 3, 4}) - if attrs == nil { + if rattrs == nil { return traces } //nolint:errcheck - rspans.Resource().Attributes().FromRaw(attrs) + rspans.Resource().Attributes().FromRaw(rattrs) + if sattrs != nil { + err := span.Attributes().FromRaw(sattrs) + if err != nil { + return traces + } + } return traces } diff --git a/exporter/pulsarexporter/README.md b/exporter/pulsarexporter/README.md index 87a090977918..cba8b675cf00 100644 --- a/exporter/pulsarexporter/README.md +++ b/exporter/pulsarexporter/README.md @@ -12,8 +12,8 @@ [contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib -Pulsar exporter exports logs, metrics, and traces to Pulsar. This exporter uses a synchronous producer -that blocks and able to batch messages. +Pulsar exporter exports logs, metrics, and traces to [Apache Pulsar](https://pulsar.apache.org/). +This exporter uses a synchronous producer that blocks and able to batch messages. ## Get Started diff --git a/pkg/datadog/gates.go b/pkg/datadog/gates.go new file mode 100644 index 000000000000..fb161e1cb69b --- /dev/null +++ b/pkg/datadog/gates.go @@ -0,0 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package datadog // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog" + +import "go.opentelemetry.io/collector/featuregate" + +var ReceiveResourceSpansV2FeatureGate = featuregate.GlobalRegistry().MustRegister( + "datadog.EnableReceiveResourceSpansV2", + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled, use a refactored implementation of the span receiver which improves performance by 10% and deprecates some not-to-spec functionality."), + featuregate.WithRegisterFromVersion("v0.118.0"), + featuregate.WithRegisterToVersion("v0.124.0"), +) diff --git a/pkg/datadog/go.mod b/pkg/datadog/go.mod index 8c1bcec497e6..98faee1ef203 100644 --- a/pkg/datadog/go.mod +++ b/pkg/datadog/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/config/configtls v1.23.1-0.20250114172347-71aae791d7f8 go.opentelemetry.io/collector/confmap v1.23.1-0.20250114172347-71aae791d7f8 go.opentelemetry.io/collector/exporter v0.117.1-0.20250114172347-71aae791d7f8 + go.opentelemetry.io/collector/featuregate v1.23.1-0.20250114172347-71aae791d7f8 go.uber.org/zap v1.27.0 ) @@ -63,7 +64,6 @@ require ( go.opentelemetry.io/collector/extension v0.117.1-0.20250114172347-71aae791d7f8 // indirect go.opentelemetry.io/collector/extension/auth v0.117.1-0.20250114172347-71aae791d7f8 // indirect go.opentelemetry.io/collector/extension/xextension v0.117.1-0.20250114172347-71aae791d7f8 // indirect - go.opentelemetry.io/collector/featuregate v1.23.1-0.20250114172347-71aae791d7f8 // indirect go.opentelemetry.io/collector/pdata v1.23.1-0.20250114172347-71aae791d7f8 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.117.1-0.20250114172347-71aae791d7f8 // indirect go.opentelemetry.io/collector/pipeline v0.117.1-0.20250114172347-71aae791d7f8 // indirect diff --git a/pkg/datadog/metadata.yaml b/pkg/datadog/metadata.yaml index 2b6a2b6d571c..ce120d41c215 100644 --- a/pkg/datadog/metadata.yaml +++ b/pkg/datadog/metadata.yaml @@ -1,3 +1,3 @@ status: codeowners: - active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd] \ No newline at end of file + active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd, IbraheemA] diff --git a/receiver/ntpreceiver/README.md b/receiver/ntpreceiver/README.md index 8f6fe98dbfb8..ab4642a21561 100644 --- a/receiver/ntpreceiver/README.md +++ b/receiver/ntpreceiver/README.md @@ -12,8 +12,6 @@ [contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib -> :construction: This receiver is in development. Configuration fields and metric data model are subject to change. - ## Purpose This receiver periodically retrieves the clock offset from a NTP server. @@ -26,7 +24,7 @@ This receiver periodically retrieves the clock offset from a NTP server. - `initial_delay` (default = `1s`): defines how long this receiver waits before starting. -- `metrics` (default: see DefaultMetricsSettings [here])(./internal/metadata/generated_metrics.go): Allows enabling and disabling specific metrics from being collected in this receiver. +- `metrics` (default: see DefaultMetricsSettings [here](./internal/metadata/generated_metrics.go)): Allows enabling and disabling specific metrics from being collected in this receiver. ### Example Configuration