diff --git a/manifests/dotnet.yml b/manifests/dotnet.yml index d4755b47c50..d0a591f66fd 100644 --- a/manifests/dotnet.yml +++ b/manifests/dotnet.yml @@ -988,6 +988,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars: v2.53.0 tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<3.53.0' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<3.53.0' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_env: missing_feature (DD_LOG_LEVEL is not supported in .NET) tests/parametric/test_otel_logs.py: '>=3.36.0' # Modified by easy win activation script tests/parametric/test_otel_logs.py::Test_FR01_Enable_OTLP_Log_Collection::test_otlp_logs_enabled: missing_feature # Created by easy win activation script diff --git a/manifests/golang.yml b/manifests/golang.yml index 4eee9ada27f..7e1f0b6f87c 100644 --- a/manifests/golang.yml +++ b/manifests/golang.yml @@ -1476,6 +1476,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_otel_enabled_takes_precedence: irrelevant (does not support enabling opentelemetry via DD_TRACE_OTEL_ENABLED) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<2.11.0-dev.1' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<2.11.0-dev.1' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_env: missing_feature (DD_LOG_LEVEL is not supported in go) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_sdk_disabled_set: irrelevant (does not support enabling opentelemetry via DD_TRACE_OTEL_ENABLED) tests/parametric/test_otel_logs.py: '>=2.5.0' # Modified by easy win activation script diff --git a/manifests/java.yml b/manifests/java.yml index 315a0968732..5bacaa683e8 100644 --- a/manifests/java.yml +++ b/manifests/java.yml @@ -3971,6 +3971,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars: v1.35.2 tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<1.66.0-SNAPSHOT' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<1.66.0-SNAPSHOT' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_sdk_disabled_set: 'missing_feature (Currently DD_TRACE_OTEL_ENABLED=true is required for OTEL_SDK_DISABLED to be parsed. Revisit when the OpenTelemetry integration is enabled by default.)' tests/parametric/test_otel_logs.py: '>=1.62.0' tests/parametric/test_otel_logs.py::Test_FR06_OTLP_Protocols::test_otlp_protocols: incomplete_test_app (GPRC fails for system-test but works with real collector) diff --git a/manifests/nodejs.yml b/manifests/nodejs.yml index 4631503f769..2ba6ce5e485 100644 --- a/manifests/nodejs.yml +++ b/manifests/nodejs.yml @@ -2394,6 +2394,13 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_otel_enabled_takes_precedence: missing_feature (this setting is not exposed in the Node.js config object) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<7.0.0-pre' + - declaration: incomplete_test_app (/trace/config endpoint is not implemented) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<7.0.0-pre' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_sdk_disabled_set: missing_feature (this setting is not exposed in the Node.js config object) tests/parametric/test_otel_logs.py::Test_FR01_Enable_OTLP_Log_Collection: *ref_5_72_0 tests/parametric/test_otel_logs.py::Test_FR03_Resource_Attributes: *ref_5_72_0 diff --git a/manifests/php.yml b/manifests/php.yml index c27db671c3e..1e7d68a7e73 100644 --- a/manifests/php.yml +++ b/manifests/php.yml @@ -1554,6 +1554,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars: v1.1.0 tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<1.25.0' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<1.25.0' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_to_debug_mapping: irrelevant (PHP uses DD_TRACE_DEBUG to set DD_TRACE_LOG_LEVEL=debug, so it does not do this mapping in the reverse direction) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_traces_always_on: - declaration: missing_feature (The always_on sampler mapping is properly implemented in v1.2.0) diff --git a/manifests/python.yml b/manifests/python.yml index 0a751aed6c4..7907223c8b1 100644 --- a/manifests/python.yml +++ b/manifests/python.yml @@ -2059,6 +2059,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars: v2.9.0 tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<4.15.0-rc1' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<4.15.0-rc1' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_env: missing_feature (DD_LOG_LEVEL is not supported in Python) tests/parametric/test_otel_logs.py::Test_FR01_Enable_OTLP_Log_Collection: v3.13.0.dev tests/parametric/test_otel_logs.py::Test_FR03_Resource_Attributes: v3.13.0.dev diff --git a/manifests/ruby.yml b/manifests/ruby.yml index 01fbd206f42..a435fe29cf7 100644 --- a/manifests/ruby.yml +++ b/manifests/ruby.yml @@ -2470,6 +2470,12 @@ manifest: tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_otel_enabled_takes_precedence: missing_feature (does not support enabling opentelemetry via DD_TRACE_OTEL_ENABLED) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_false: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_dd_trace_sample_ignore_parent_true: missing_feature (dd_trace_sample_ignore_parent requires an RFC, this feature is not implemented in any language) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<2.42.0-dev' + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<2.42.0-dev' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_env: missing_feature (DD_LOG_LEVEL is not supported in ruby) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_sdk_disabled_set: missing_feature (does not support enabling opentelemetry via DD_TRACE_OTEL_ENABLED) tests/parametric/test_otel_logs.py: '>=2.34.0-dev' diff --git a/manifests/rust.yml b/manifests/rust.yml index 3b3a2bf92b4..738f49780cc 100644 --- a/manifests/rust.yml +++ b/manifests/rust.yml @@ -232,6 +232,13 @@ manifest: - declaration: incomplete_test_app - declaration: incomplete_test_app (/trace/config endpoint is not implemented) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_attribute_mapping: incomplete_test_app (/trace/config endpoint is not implemented) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<0.5.3-dev' + - declaration: incomplete_test_app (/trace/config endpoint is not implemented) + tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_deployment_environment_mapping_on_span: + - declaration: missing_feature (deployment.environment.name mapping is not released) + component_version: '<0.5.3-dev' tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_env_vars_set: incomplete_test_app (/trace/config endpoint is not implemented) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_log_level_env: incomplete_test_app (/trace/config endpoint is not implemented) tests/parametric/test_otel_env_vars.py::Test_Otel_Env_Vars::test_otel_sdk_disabled_set: incomplete_test_app (/trace/config endpoint is not implemented) diff --git a/tests/parametric/test_otel_env_vars.py b/tests/parametric/test_otel_env_vars.py index 9621540ed86..6e055ce73b8 100644 --- a/tests/parametric/test_otel_env_vars.py +++ b/tests/parametric/test_otel_env_vars.py @@ -148,16 +148,16 @@ def test_otel_log_level_env(self, test_agent: TestAgentAPI, test_library: APMLib "library_env", [ { - "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment=test1,service.name=test2,service.version=5,foo=bar1,baz=qux1", + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment=legacy,service.name=test2,service.version=5,foo=bar1,baz=qux1", "DD_TRACE_OTEL_ENABLED": "true", } ], ) - def test_otel_attribute_mapping(self, test_agent: TestAgentAPI, test_library: APMLibrary): + def test_otel_attribute_mapping(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None: with test_library as t: if t.lang == "nodejs": assert_nodejs_telemetry_config( - test_agent, {"dd_service": "test2", "dd_env": "test1", "dd_version": "5"} + test_agent, {"dd_service": "test2", "dd_env": "legacy", "dd_version": "5"} ) # OTEL_RESOURCE_ATTRIBUTES tags surface on spans, not in the DD_TAGS telemetry value with t.dd_start_span(name="otel_attrs"): @@ -165,16 +165,132 @@ def test_otel_attribute_mapping(self, test_agent: TestAgentAPI, test_library: AP span = find_only_span(test_agent.wait_for_num_traces(1)) assert span["meta"]["foo"] == "bar1" assert span["meta"]["baz"] == "qux1" + assert "deployment.environment" not in span["meta"] + assert "deployment.environment.name" not in span["meta"] return resp = t.config() assert resp["dd_service"] == "test2" - assert resp["dd_env"] == "test1" + assert resp["dd_env"] == "legacy" assert resp["dd_version"] == "5" tags = resp["dd_tags"] assert isinstance(tags, (str, list)) assert "foo:bar1" in tags assert "baz:qux1" in tags + tags_text = str(tags) + assert "deployment.environment:" not in tags_text + assert "deployment.environment.name:" not in tags_text + + @pytest.mark.parametrize( + ("library_env", "expected_env"), + [ + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,service.name=test2,service.version=5,foo=bar1,baz=qux1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="stable-only", + ), + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,deployment.environment=legacy,service.name=test2,service.version=5,foo=bar1,baz=qux1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="both-stable-first", + ), + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment=legacy,deployment.environment.name=stable,service.name=test2,service.version=5,foo=bar1,baz=qux1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="both-legacy-first", + ), + pytest.param( + { + "DD_ENV": "datadog", + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,deployment.environment=legacy,service.name=test2,service.version=5,foo=bar1,baz=qux1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "datadog", + id="dd-env-precedence", + ), + ], + ) + def test_otel_deployment_environment_mapping(self, expected_env: str, test_library: APMLibrary) -> None: + with test_library as t: + resp = t.config() + + assert resp["dd_service"] == "test2" + assert resp["dd_env"] == expected_env + assert resp["dd_version"] == "5" + tags = resp["dd_tags"] + assert isinstance(tags, (str, list)) + assert "foo:bar1" in tags + assert "baz:qux1" in tags + tags_text = str(tags) + assert "deployment.environment:" not in tags_text + assert "deployment.environment.name:" not in tags_text + + @pytest.mark.parametrize( + ("library_env", "expected_env"), + [ + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment=legacy,foo=bar1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "legacy", + id="legacy-only", + ), + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,foo=bar1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="stable-only", + ), + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,deployment.environment=legacy,foo=bar1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="both-stable-first", + ), + pytest.param( + { + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment=legacy,deployment.environment.name=stable,foo=bar1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "stable", + id="both-legacy-first", + ), + pytest.param( + { + "DD_ENV": "datadog", + "OTEL_RESOURCE_ATTRIBUTES": "deployment.environment.name=stable,deployment.environment=legacy,foo=bar1", + "DD_TRACE_OTEL_ENABLED": "true", + }, + "datadog", + id="dd-env-precedence", + ), + ], + ) + def test_otel_deployment_environment_mapping_on_span( + self, expected_env: str, test_agent: TestAgentAPI, test_library: APMLibrary + ) -> None: + with test_library as t, t.dd_start_span(name="otel_deployment_environment"): + pass + + span = find_only_span(test_agent.wait_for_num_traces(1)) + assert span["meta"]["env"] == expected_env + assert span["meta"]["foo"] == "bar1" + assert "deployment.environment" not in span["meta"] + assert "deployment.environment.name" not in span["meta"] @pytest.mark.parametrize("library_env", [{"OTEL_TRACES_SAMPLER": "always_on", "DD_TRACE_OTEL_ENABLED": "true"}]) def test_otel_traces_always_on(self, test_agent: TestAgentAPI, test_library: APMLibrary):