Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,7 @@ manifest:
: "irrelevant (\"Go tracer decided to always set _dd1.sr.eausr: 1 for truthy analytics.event inputs, else 0\")"
tests/parametric/test_otel_span_with_baggage.py::Test_Otel_Span_With_Baggage: missing_feature
tests/parametric/test_otlp_trace_metrics.py: missing_feature
tests/parametric/test_otlp_trace_metrics.py::Test_FR08_AdditionalTags: missing_feature (DD_TAGS are not yet emitted as datadog.<key> resource attributes; support coming in a future PR)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Quote manifest values containing angle brackets

The manifest syntax rule in .cursor/rules/pr-review.mdc requires values with special YAML characters such as < and > to be quoted. This new declaration contains <key> unquoted (and the same value was added in the Java, Node.js, and Python manifests), so it violates the repo's manifest format contract even though the current parser accepts it; quote the scalar to keep manifest formatting consistent.

Useful? React with 👍 / 👎.

tests/parametric/test_parametric_endpoints.py::TestRemoteConfigApplyEndpoint: incomplete_test_app (POST /trace/remote-config/apply only implemented in the python parametric app)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDSpan_Add_Link: missing_feature (add_link endpoint is not implemented)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDSpan_Set_Resource: missing_feature (does not support setting a resource name after span creation)
Expand Down
1 change: 1 addition & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3910,6 +3910,7 @@ manifest:
- declaration: missing_feature (OTel resource naming implemented in 1.24.0)
component_version: <=1.23.0
tests/parametric/test_otlp_trace_metrics.py: missing_feature
tests/parametric/test_otlp_trace_metrics.py::Test_FR08_AdditionalTags: missing_feature (DD_TAGS are not yet emitted as datadog.<key> resource attributes; support coming in a future PR)
tests/parametric/test_parametric_endpoints.py::TestRemoteConfigApplyEndpoint: incomplete_test_app (POST /trace/remote-config/apply only implemented in the python parametric app)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDSpan_Add_Link: incomplete_test_app (add_link endpoint is not implemented)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDTrace_Baggage: # Modified by easy win activation script
Expand Down
1 change: 1 addition & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,7 @@ manifest:
tests/parametric/test_otlp_trace_metrics.py: *ref_5_111_0
tests/parametric/test_otlp_trace_metrics.py::Test_FR05_Sampling_Independence::test_fr05_1_metrics_computed_before_sampling: missing_feature (nodejs does not drop sampled-out traces when client-side stats are computed)
tests/parametric/test_otlp_trace_metrics.py::Test_FR06_Otel_Resource_Attributes::test_fr06_10_hostname: irrelevant (DD_HOSTNAME is only supported in Python)
tests/parametric/test_otlp_trace_metrics.py::Test_FR08_AdditionalTags: missing_feature (DD_TAGS are not yet emitted as datadog.<key> resource attributes; support coming in a future PR)
tests/parametric/test_otlp_trace_metrics.py::Test_FR08_Datadog_Attributes::test_fr08_5_top_level_child_different_service: missing_feature (nodejs does not tag child spans with a different service than their parent as top-level)
tests/parametric/test_parametric_endpoints.py::TestRemoteConfigApplyEndpoint: incomplete_test_app (POST /trace/remote-config/apply only implemented in the python parametric app)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDSpan_Set_Resource: incomplete_test_app (set_resource endpoint is not implemented)
Expand Down
1 change: 1 addition & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1995,6 +1995,7 @@ manifest:
tests/parametric/test_otel_span_with_baggage.py::Test_Otel_Span_With_Baggage: v2.18.0
tests/parametric/test_otel_tracer.py::Test_Otel_Tracer: v2.8.0
tests/parametric/test_otlp_trace_metrics.py: missing_feature
tests/parametric/test_otlp_trace_metrics.py::Test_FR08_AdditionalTags: missing_feature (DD_TAGS are not yet emitted as datadog.<key> resource attributes; support coming in a future PR)
tests/parametric/test_parametric_endpoints.py::Test_Parametric_DDTrace_Baggage: v2.16.0
tests/parametric/test_parametric_endpoints.py::Test_Parametric_FFE_Start: v4.0.0
tests/parametric/test_parametric_endpoints.py::Test_Parametric_Otel_Baggage: v2.16.0
Expand Down
113 changes: 107 additions & 6 deletions tests/parametric/test_otlp_trace_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
FR06 OTel semantic-convention attributes wherever applicable Test_FR06_Otel_Span_Attributes,
Test_FR06_Otel_Resource_Attributes
FR07 DD_TRACE_OTEL_SEMANTICS_ENABLED=true -> only OTel attributes Test_FR07_Otel_Semantics_Mode
FR08 DD_TRACE_OTEL_SEMANTICS_ENABLED=false (default) -> datadog.* allowed Test_FR08_Datadog_Attributes
FR08 DD_TRACE_OTEL_SEMANTICS_ENABLED=false (default) -> datadog.* allowed Test_FR08_Datadog_Attributes,
DD_TAGS / OTEL_RESOURCE_ATTRIBUTES / DD_TRACE_STATS_ADDITIONAL_TAGS Test_FR08_AdditionalTags
FR09 Derive request/span count, error count, and duration Test_FR09_Red_Metric_Derivation
FR10 Transport over OTLP HTTP/JSON (set in _BASE_ENVVARS, exercised by every test)
FR11 SDKs without client-side stats are out of scope (handled by manifests / @features gating)
Expand Down Expand Up @@ -157,6 +158,8 @@ def _attr_value(item: dict) -> Any: # noqa: ANN401
return int(value["intValue"])
if "doubleValue" in value:
return value["doubleValue"]
if "arrayValue" in value:
return [_attr_value({"value": element}) for element in value["arrayValue"].get("values", [])]
return None


Expand Down Expand Up @@ -1162,11 +1165,8 @@ def test_fr08_9_top_level_not_mixed_with_measured(
test_agent: TestAgentAPI,
test_library: APMLibrary,
):
"""A top-level and a non-top-level span with identical dimensions bucket separately.

The measured child (selected per FR04) shares every aggregation dimension with its top-level root,
yet the two must yield separate data points -- one datadog.span.top_level=true, one false -- rather
than being merged into a single bucket mislabeled false.
"""A top-level and a non-top-level (measured) span with identical dimensions must bucket separately,
each keeping its own datadog.span.top_level flag rather than merging into one bucket mislabeled false.
"""
with test_library as t:
with (
Expand All @@ -1190,6 +1190,107 @@ def test_fr08_9_top_level_not_mixed_with_measured(
)


@scenarios.parametric
@features.client_side_stats_supported
class Test_FR08_AdditionalTags:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark additional-tags test missing for Ruby

For Ruby versions that satisfy manifests/ruby.yml's tests/parametric/test_otlp_trace_metrics.py: '>=2.35.0' rule, this new class has no Ruby-specific manifest entry, while the existing Ruby manifest still marks the explicit enablement test and all FR08 Datadog-attribute tests as missing_feature. That means Test_FR08_AdditionalTags becomes active for Ruby 2.35+ and will run with DEFAULT_ENVVARS, even though the trace-metrics export it depends on is still marked unsupported there, causing Ruby parametric runs to fail unless a matching Ruby manifest skip is added.

Useful? React with 👍 / 👎.

"""FR08: DD_TAGS (tracer_dd_tags) / OTEL_RESOURCE_ATTRIBUTES surface as resource attributes and
DD_TRACE_STATS_ADDITIONAL_TAGS (additional_metric_tags) as data-point attributes (support pending in some SDKs).
"""

@pytest.mark.parametrize(
"library_env",
[
{
**DEFAULT_ENVVARS,
"DD_TAGS": (
"team:apm,tier:backend,"
"service:ignored-svc,env:ignored-env,version:ignored-ver,runtime_id:ignored-rid"
),
Comment on lines +1205 to +1208

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the reserved runtime-id tag

This test asserts that datadog.runtime-id is absent, but the only runtime tag it injects through DD_TAGS is runtime_id, so the hyphenated reserved-key check is vacuous. If an SDK filters runtime_id but still leaks DD_TAGS=runtime-id:... as datadog.runtime-id, this test would pass; include a runtime-id entry in DD_TAGS so the asserted reserved form is actually covered.

Useful? React with 👍 / 👎.

}
],
)
def test_fr08_10_dd_tags_resource_attributes(
self,
otlp_trace_metrics_library_env: dict[str, str], # noqa: ARG002
test_agent: TestAgentAPI,
test_library: APMLibrary,
):
"""Global DD_TAGS surface as the tracer_dd_tags resource-attribute container (repeated key:value
strings) in default mode; reserved service/env/version/runtime_id keys are ignored.
"""
with test_library as t:
with t.dd_start_span(name="web.request", service=SERVICE, typestr="web"):
pass
t.dd_flush()

metrics = test_agent.wait_for_num_otlp_metrics(num=1)
resource_attrs = _resource_attributes(metrics)
tracer_dd_tags = resource_attrs.get("tracer_dd_tags") or []
assert "team:apm" in tracer_dd_tags, f"Expected team:apm in tracer_dd_tags, got: {resource_attrs}"
assert "tier:backend" in tracer_dd_tags, f"Expected tier:backend in tracer_dd_tags, got: {resource_attrs}"
for reserved in ("service", "env", "version", "runtime_id", "runtime-id"):
assert not any(str(entry).startswith(f"{reserved}:") for entry in tracer_dd_tags), (
f"Reserved DD_TAGS key {reserved!r} must be ignored, got: {tracer_dd_tags}"
)
assert resource_attrs.get("service.name") == SERVICE, (
f"DD_TAGS service must not override configured service.name={SERVICE}, got: {resource_attrs}"
)

@pytest.mark.parametrize(
"library_env",
[{**DEFAULT_ENVVARS, "OTEL_RESOURCE_ATTRIBUTES": "team=apm,deployment.region=us-east-1"}],
)
def test_fr08_11_otel_resource_attributes_env(
self,
otlp_trace_metrics_library_env: dict[str, str], # noqa: ARG002
test_agent: TestAgentAPI,
test_library: APMLibrary,
):
"""OTEL_RESOURCE_ATTRIBUTES is an alias for DD_TAGS, so its entries also surface in the
tracer_dd_tags resource-attribute container.
"""
with test_library as t:
with t.dd_start_span(name="web.request", service=SERVICE, typestr="web"):
pass
t.dd_flush()

metrics = test_agent.wait_for_num_otlp_metrics(num=1)
tracer_dd_tags = _resource_attributes(metrics).get("tracer_dd_tags") or []
assert "team:apm" in tracer_dd_tags, f"Expected team:apm in tracer_dd_tags, got: {tracer_dd_tags}"
assert "deployment.region:us-east-1" in tracer_dd_tags, (
f"Expected deployment.region:us-east-1 in tracer_dd_tags, got: {tracer_dd_tags}"
)

@pytest.mark.parametrize(
"library_env",
[{**DEFAULT_ENVVARS, "DD_TRACE_STATS_ADDITIONAL_TAGS": "customer.tier,region"}],
)
def test_fr08_12_stats_additional_tags(
self,
otlp_trace_metrics_library_env: dict[str, str], # noqa: ARG002
test_agent: TestAgentAPI,
test_library: APMLibrary,
):
"""Span tags named in DD_TRACE_STATS_ADDITIONAL_TAGS surface as the additional_metric_tags
data-point container (repeated key:value strings), since their values vary per span.
"""
with test_library as t:
with t.dd_start_span(name="web.request", service=SERVICE, typestr="web") as span:
span.set_meta("customer.tier", "gold")
span.set_meta("region", "us-east-1")
t.dd_flush()

metrics = test_agent.wait_for_num_otlp_metrics(num=1)
attrs = _data_point_attrs(_duration_data_points(metrics)[0])
additional_metric_tags = attrs.get("additional_metric_tags") or []
assert "customer.tier:gold" in additional_metric_tags, (
f"Expected customer.tier:gold in additional_metric_tags, got: {attrs}"
)
assert "region:us-east-1" in additional_metric_tags, (
f"Expected region:us-east-1 in additional_metric_tags, got: {attrs}"
)


@scenarios.parametric
@features.client_side_stats_supported
class Test_FR09_Red_Metric_Derivation:
Expand Down
Loading