diff --git a/manifests/nodejs.yml b/manifests/nodejs.yml index 1f6a2b37e8..8232521aad 100644 --- a/manifests/nodejs.yml +++ b/manifests/nodejs.yml @@ -580,11 +580,11 @@ tests/: TestAdmisionControllerProfiling: *ref_5_22_0 parametric/: test_config_consistency.py: - Test_Config_RateLimit: missing_feature - Test_Config_TraceAgentURL: *ref_5_22_0 - Test_Config_TraceEnabled: missing_feature + Test_Config_RateLimit: *ref_5_25_0 + Test_Config_TraceAgentURL: *ref_5_25_0 + Test_Config_TraceEnabled: *ref_4_3_0 Test_Config_TraceLogDirectory: missing_feature - Test_Config_UnifiedServiceTagging: missing_feature + Test_Config_UnifiedServiceTagging: *ref_5_25_0 test_crashtracking.py: missing_feature test_dynamic_configuration.py: TestDynamicConfigHeaderTags: missing_feature @@ -615,7 +615,7 @@ tests/: test_span_links.py: Test_Span_Links: *ref_5_3_0 test_telemetry.py: - Test_Consistent_Configs: missing_feature + Test_Consistent_Configs: *ref_5_25_0 Test_Defaults: *ref_5_6_0 Test_Environment: *ref_5_6_0 Test_TelemetryInstallSignature: *ref_4_23_0 @@ -655,19 +655,25 @@ tests/: Test_Client_Stats: missing_feature test_config_consistency.py: Test_Config_ClientIPHeader_Configured: *ref_3_13_0 - Test_Config_ClientIPHeader_Precedence: missing_feature (all headers listed in the RFC are not supported) + Test_Config_ClientIPHeader_Precedence: *ref_3_19_0 Test_Config_ClientTagQueryString_Configured: missing_feature (adding query string to http.url is not supported) Test_Config_ClientTagQueryString_Empty: missing_feature (removes query strings by default) Test_Config_HttpClientErrorStatuses_Default: missing_feature Test_Config_HttpClientErrorStatuses_FeatureFlagCustom: missing_feature Test_Config_HttpServerErrorStatuses_Default: missing_feature Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: missing_feature - Test_Config_IntegrationEnabled_False: missing_feature - Test_Config_IntegrationEnabled_True: missing_feature - Test_Config_ObfuscationQueryStringRegexp_Configured: missing_feature - Test_Config_ObfuscationQueryStringRegexp_Empty: missing_feature - Test_Config_UnifiedServiceTagging_CustomService: missing_feature - Test_Config_UnifiedServiceTagging_Default: missing_feature + Test_Config_IntegrationEnabled_False: + '*': *ref_5_25_0 + express4-typescript: irrelevant + nextjs: irrelevant # nextjs is not related with kafka + Test_Config_IntegrationEnabled_True: + '*': *ref_5_25_0 + express4-typescript: irrelevant + nextjs: irrelevant # nextjs is not related with kafka + Test_Config_ObfuscationQueryStringRegexp_Configured: *ref_3_0_0 + Test_Config_ObfuscationQueryStringRegexp_Empty: *ref_3_0_0 + Test_Config_UnifiedServiceTagging_CustomService: *ref_5_25_0 + Test_Config_UnifiedServiceTagging_Default: *ref_5_25_0 test_distributed.py: Test_DistributedHttp: missing_feature test_identify.py: @@ -680,8 +686,8 @@ tests/: Test_HeaderTags_Colon_Trailing: *ref_4_11_0 Test_HeaderTags_Long: *ref_4_11_0 Test_HeaderTags_Short: *ref_4_11_0 - Test_HeaderTags_Whitespace_Header: bug (AIT-9109) - Test_HeaderTags_Whitespace_Tag: bug (AIT-9109) + Test_HeaderTags_Whitespace_Header: *ref_5_25_0 + Test_HeaderTags_Whitespace_Tag: *ref_5_25_0 Test_HeaderTags_Whitespace_Val_Long: *ref_4_11_0 Test_HeaderTags_Whitespace_Val_Short: *ref_4_11_0 test_profiling.py: diff --git a/tests/parametric/test_config_consistency.py b/tests/parametric/test_config_consistency.py index d6cef54c33..4fc9825690 100644 --- a/tests/parametric/test_config_consistency.py +++ b/tests/parametric/test_config_consistency.py @@ -81,7 +81,9 @@ def test_default_config(self, library_env, test_agent, test_library): span = find_span_in_traces(traces, s1.trace_id, s1.span_id) assert span["service"] != "version_test" - assert "version" not in span["meta"] + # in Node.js version can automatically be grabbed from the package.json on default, thus this test does not apply + if test_library.lang != "nodejs": + assert "version" not in span["meta"] assert "env" not in span["meta"] # Assert that iff a span has service name set by DD_SERVICE, it also gets the version specified in DD_VERSION @@ -98,6 +100,7 @@ def test_specific_version(self, library_env, test_agent, test_library): assert len(traces) == 2 span1 = find_span_in_traces(traces, s1.trace_id, s1.span_id) + assert span1["service"] == "version_test" assert span1["meta"]["version"] == "5.2.0" diff --git a/tests/parametric/test_telemetry.py b/tests/parametric/test_telemetry.py index cf41c1a02b..cb2d1f90e6 100644 --- a/tests/parametric/test_telemetry.py +++ b/tests/parametric/test_telemetry.py @@ -129,14 +129,14 @@ class Test_Consistent_Configs: "DD_VERSION": "5.2.0", "DD_TRACE_RATE_LIMIT": 10, "DD_TRACE_HEADER_TAGS": "User-Agent:my-user-agent,Content-Type.", - "DD_TRACE_ENABLED": "false", + "DD_TRACE_ENABLED": "true", "DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP": "\d{3}-\d{2}-\d{4}", "DD_TRACE_LOG_DIRECTORY": "/some/temporary/directory", "DD_TRACE_CLIENT_IP_HEADER": "random-header-name", "DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-250", "DD_TRACE_HTTP_SERVER_ERROR_STATUSES": "250-200", "DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false", - # "DD_TRACE_AGENT_URL": "some-host:some-port", # Don't want to configure this, since we need tracer <> agent connection to run these tests! + # "DD_TRACE_AGENT_URL": "http://localhost:8126", # Don't want to configure this, since we need tracer <> agent connection to run these tests! # "DD_TRACE__ENABLED": "N/A", # Skipping because it is blocked by the telemetry intake & this information is already collected through other (non-config) telemetry. } ], @@ -150,18 +150,41 @@ def test_library_settings(self, library_env, test_agent, test_library): configuration = event["payload"]["configuration"] configuration_by_name = {item["name"]: item for item in configuration} - # Check that the tags name match the expected value + # # Check that the tags name match the expected value assert configuration_by_name.get("DD_ENV").get("value") == "dev" assert configuration_by_name.get("DD_SERVICE").get("value") == "service_test" assert configuration_by_name.get("DD_VERSION").get("value") == "5.2.0" - assert configuration_by_name.get("DD_TRACE_RATE_LIMIT").get("value") == 10 + assert configuration_by_name.get("DD_TRACE_RATE_LIMIT").get("value") == "10" assert ( configuration_by_name.get("DD_TRACE_HEADER_TAGS").get("value") == "User-Agent:my-user-agent,Content-Type." ) - assert configuration_by_name.get("DD_TRACE_ENABLED").get("value") == False + assert configuration_by_name.get("DD_TRACE_ENABLED").get("value") == True assert configuration_by_name.get("DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP").get("value") == "\d{3}-\d{2}-\d{4}" - assert configuration_by_name.get("DD_TRACE_LOG_DIRECTORY").get("value") == "/some/temporary/directory" assert configuration_by_name.get("DD_TRACE_CLIENT_IP_HEADER").get("value") == "random-header-name" + + @pytest.mark.parametrize( + "library_env", + [ + { + "DD_TELEMETRY_HEARTBEAT_INTERVAL": "0.1", # Decrease the heartbeat/poll intervals to speed up the tests + "DD_TRACE_LOG_DIRECTORY": "/some/temporary/directory", + "DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-250", + "DD_TRACE_HTTP_SERVER_ERROR_STATUSES": "250-200", + "DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false", + } + ], + ) + @missing_feature(context.library == "nodejs", reason="Not implemented") + @missing_feature(context.library <= "python@2.16.0", reason="Reports configurations with unexpected names") + @bug(context.library > "cpp@0.2.2", reason="APMAPI-833") + def test_library_settings_2(self, library_env, test_agent, test_library): + with test_library.start_span("test"): + pass + event = test_agent.wait_for_telemetry_event("app-started", wait_loops=400) + configuration = event["payload"]["configuration"] + configuration_by_name = {item["name"]: item for item in configuration} + + assert configuration_by_name.get("DD_TRACE_LOG_DIRECTORY").get("value") == "/some/temporary/directory" assert configuration_by_name.get("DD_TRACE_HTTP_CLIENT_ERROR_STATUSES").get("value") == "200-250" assert configuration_by_name.get("DD_TRACE_HTTP_SERVER_ERROR_STATUSES").get("value") == "250-200" assert ( diff --git a/tests/test_config_consistency.py b/tests/test_config_consistency.py index 891591e480..3a6704659b 100644 --- a/tests/test_config_consistency.py +++ b/tests/test_config_consistency.py @@ -3,7 +3,7 @@ # Copyright 2022 Datadog, Inc. import json -from utils import weblog, interfaces, scenarios, features, rfc, irrelevant, context, bug +from utils import weblog, interfaces, scenarios, features, rfc, irrelevant, context, bug, missing_feature @scenarios.default @@ -84,6 +84,7 @@ def setup_query_string_obfuscation_empty_client(self): self.r = weblog.get("/make_distant_call", params={"url": "http://weblog:7777/?key=monkey"}) @bug(context.library == "java", reason="APMAPI-770") + @missing_feature(context.library == "nodejs", reason="Node only obfuscates queries on the server side") def test_query_string_obfuscation_empty_client(self): spans = [s for _, _, s in interfaces.library.get_spans(request=self.r, full_trace=True)] client_span = _get_span_by_tags(spans, tags={"http.url": "http://weblog:7777/?key=monkey"}) diff --git a/utils/_context/_scenarios/__init__.py b/utils/_context/_scenarios/__init__.py index effb2ab221..f6d012cd60 100644 --- a/utils/_context/_scenarios/__init__.py +++ b/utils/_context/_scenarios/__init__.py @@ -460,6 +460,7 @@ def all_endtoend_scenarios(test_object): "DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-201,202", "DD_SERVICE": "service_test", "DD_TRACE_KAFKA_ENABLED": "false", # Using Kafka as is the most common endpoint and integration(missing for PHP). + "DD_TRACE_KAFKAJS_ENABLED": "false", # In Node the integration is kafkajs. "DD_TRACE_PDO_ENABLED": "false", # Use PDO for PHP, }, include_kafka=True, @@ -473,6 +474,7 @@ def all_endtoend_scenarios(test_object): weblog_env={ "DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP": "", "DD_TRACE_KAFKA_ENABLED": "true", + "DD_TRACE_KAFKAJS_ENABLED": "true", "DD_TRACE_PDO_ENABLED": "true", # Use PDO for PHP "DD_TRACE_CLIENT_IP_HEADER": "custom-ip-header", "DD_TRACE_CLIENT_IP_ENABLED": "true", diff --git a/utils/build/docker/nodejs/parametric/server.js b/utils/build/docker/nodejs/parametric/server.js index 3204c09993..6a4afe795a 100644 --- a/utils/build/docker/nodejs/parametric/server.js +++ b/utils/build/docker/nodejs/parametric/server.js @@ -305,6 +305,7 @@ app.get('/trace/config', (req, res) => { 'dd_env': config?.tags?.env !== undefined ? `${config.tags.env}` : 'null', 'dd_version': config?.tags?.version !== undefined ? `${config.tags.version}` : 'null', 'dd_trace_agent_url': config?.url !== undefined ? `${config.url.href}` : 'null', + 'dd_trace_rate_limit': config?.sampler?.rateLimit !== undefined ? `${config?.sampler?.rateLimit}` :'null' } }); });