Skip to content

Commit

Permalink
[exporter/datadog] Map deployment.environment.name to env (#35147)
Browse files Browse the repository at this point in the history
**Description:** 
Map the new OTel semantic convention `deployment.environment.name` to
`env`
  • Loading branch information
songy23 authored Sep 12, 2024
1 parent 21208c0 commit 56149b2
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 36 deletions.
27 changes: 27 additions & 0 deletions .chloggen/dd-con-new-env-conv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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: datadogconnector

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Map the new OTel semantic convention `deployment.environment.name` to `env` for OTLP traces in APM stats."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35147]

# (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: "The old convention `deployment.environment` still works"

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
27 changes: 27 additions & 0 deletions .chloggen/dd-exp-new-env-conv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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: "Map the new OTel semantic convention `deployment.environment.name` to `env` for OTLP traces, metrics and logs."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35147]

# (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: "The old convention `deployment.environment` still works"

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
6 changes: 3 additions & 3 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/sources v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.58.0-devel.0.20240830155027-f44a9da12951 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.59.0-devel.0.20240911192058-0c2181220f85 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/status/health v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.58.0-devel.0.20240830155027-f44a9da12951 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.59.0-devel.0.20240911192058-0c2181220f85 // indirect
github.com/DataDog/datadog-agent/pkg/util/backoff v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/util/executable v0.57.0 // indirect
Expand All @@ -353,7 +353,7 @@ require (
github.com/DataDog/datadog-api-client-go/v2 v2.30.0 // indirect
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240419161837-f1b2f553edfe // indirect
github.com/DataDog/go-sqllexer v0.0.13 // indirect
github.com/DataDog/go-sqllexer v0.0.14 // indirect
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions connector/datadogconnector/connector_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.opentelemetry.io/collector/connector/connectortest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/ptrace"
conventions127 "go.opentelemetry.io/collector/semconv/v1.27.0"
semconv "go.opentelemetry.io/collector/semconv/v1.5.0"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -145,6 +146,8 @@ func TestMeasuredAndClientKindNative(t *testing.T) {
td := ptrace.NewTraces()
res := td.ResourceSpans().AppendEmpty().Resource()
res.Attributes().PutStr("service.name", "svc")
res.Attributes().PutStr(conventions127.AttributeDeploymentEnvironmentName, "my-env")

ss := td.ResourceSpans().At(0).ScopeSpans().AppendEmpty().Spans()
// Root span
s1 := ss.AppendEmpty()
Expand Down Expand Up @@ -200,6 +203,7 @@ func TestMeasuredAndClientKindNative(t *testing.T) {
require.NoError(t, err)
assert.Len(t, sp.Stats, 1)
assert.Len(t, sp.Stats[0].Stats, 1)
assert.Equal(t, "my-env", sp.Stats[0].Env)
assert.Len(t, sp.Stats[0].Stats[0].Stats, 3)
cgss := sp.Stats[0].Stats[0].Stats
sort.Slice(cgss, func(i, j int) bool {
Expand Down
6 changes: 3 additions & 3 deletions connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.57.0
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.57.0
github.com/DataDog/datadog-agent/pkg/proto v0.57.0
github.com/DataDog/datadog-agent/pkg/trace v0.58.0-devel.0.20240830155027-f44a9da12951
github.com/DataDog/datadog-agent/pkg/trace v0.59.0-devel.0.20240911192058-0c2181220f85
github.com/DataDog/datadog-go/v5 v5.5.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.20.0
Expand Down Expand Up @@ -71,7 +71,7 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/sources v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.58.0-devel.0.20240830155027-f44a9da12951 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.59.0-devel.0.20240911192058-0c2181220f85 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/status/health v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.57.0 // indirect
Expand All @@ -94,7 +94,7 @@ require (
github.com/DataDog/datadog-agent/pkg/version v0.57.0 // indirect
github.com/DataDog/datadog-api-client-go/v2 v2.30.0 // indirect
github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240419161837-f1b2f553edfe // indirect
github.com/DataDog/go-sqllexer v0.0.13 // indirect
github.com/DataDog/go-sqllexer v0.0.14 // indirect
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions connector/datadogconnector/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.57.0
github.com/DataDog/datadog-agent/pkg/status/health v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.58.0-devel.0.20240830155027-f44a9da12951
github.com/DataDog/datadog-agent/pkg/trace v0.59.0-devel.0.20240911192058-0c2181220f85
github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0
github.com/DataDog/datadog-agent/pkg/util/startstop v0.57.0 // indirect
github.com/DataDog/datadog-api-client-go/v2 v2.30.0
Expand Down Expand Up @@ -117,7 +117,7 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/processor v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/sender v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.58.0-devel.0.20240830155027-f44a9da12951 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.59.0-devel.0.20240911192058-0c2181220f85 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/util/backoff v0.57.0 // indirect
Expand All @@ -136,7 +136,7 @@ require (
github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.0 // indirect
github.com/DataDog/datadog-agent/pkg/version v0.57.0 // indirect
github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240419161837-f1b2f553edfe // indirect
github.com/DataDog/go-sqllexer v0.0.13 // indirect
github.com/DataDog/go-sqllexer v0.0.14 // indirect
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
github.com/DataDog/viper v1.13.5 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
Expand Down
Loading

0 comments on commit 56149b2

Please sign in to comment.