Skip to content
Draft
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: 0 additions & 1 deletion manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ tests/:
test_otel_env_vars.py:
Test_Otel_Env_Vars: v1.1.0
test_otel_logs.py: missing_feature
test_otel_metrics.py: missing_feature
test_otel_span_methods.py:
Test_Otel_Span_Methods: v0.94.0
test_otel_span_with_baggage.py:
Expand Down
59 changes: 43 additions & 16 deletions tests/parametric/test_otel_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def get_expected_bucket_counts(entries: list[int], bucket_boundaries: list[float
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Configuration_Enabled:
Expand Down Expand Up @@ -270,7 +269,6 @@ def test_otlp_metrics_disabled(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Api_MeterProvider:
Expand Down Expand Up @@ -344,7 +342,6 @@ def test_otel_get_meter_by_distinct(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Api_Meter:
Expand All @@ -358,6 +355,7 @@ class Test_Otel_Metrics_Api_Meter:
"""

@pytest.mark.parametrize("library_env", [{**DEFAULT_ENVVARS}])
@missing_feature(context.library == "php", reason="min max bug in otel php", force_skip=True)
def test_otel_create_instruments_by_distinct(
self, test_agent: TestAgentAPI, test_library: APMLibrary, library_env: dict[str, str]
):
Expand Down Expand Up @@ -565,7 +563,6 @@ def test_otel_create_instruments_by_distinct(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Api_Instrument:
Expand All @@ -580,6 +577,7 @@ class Test_Otel_Metrics_Api_Instrument:
"""

@pytest.mark.parametrize("library_env", [{**DEFAULT_ENVVARS}])
@missing_feature(context.library == "php", reason="otel php does not follow this", force_skip=True)
def test_otel_counter_add_non_negative_and_negative_values(
self, test_agent: TestAgentAPI, test_library: APMLibrary
):
Expand Down Expand Up @@ -874,6 +872,7 @@ def test_otel_gauge_record_multiple_values_with_different_tags(
assert_gauge_aggregation(metric["gauge"], second_value, NON_DEFAULT_MEASUREMENT_ATTRIBUTES)

@pytest.mark.parametrize("library_env", [{**DEFAULT_ENVVARS}])
@missing_feature(context.library == "php", reason="otel php does not follow this", force_skip=True)
def test_otel_histogram_add_non_negative_and_negative_values(
self, test_agent: TestAgentAPI, test_library: APMLibrary
):
Expand Down Expand Up @@ -937,6 +936,7 @@ def test_otel_histogram_add_non_negative_and_negative_values(
)

@pytest.mark.parametrize("library_env", [{**DEFAULT_ENVVARS}])
@missing_feature(context.library == "php", reason="min max bug in otel php", force_skip=True)
def test_otel_histogram_add_non_negative_values_with_different_tags(
self, test_agent: TestAgentAPI, test_library: APMLibrary
):
Expand Down Expand Up @@ -1109,7 +1109,6 @@ def test_otel_asynchronous_gauge_constant_callback_value(self, test_agent: TestA
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Configuration_Temporality_Preference:
Expand All @@ -1132,6 +1131,7 @@ class Test_Otel_Metrics_Configuration_Temporality_Preference:
],
ids=["default", "delta", "cumulative"],
)
@missing_feature(context.library == "php", reason="min max bug in otel php", force_skip=True)
def test_otel_aggregation_temporality(
self, library_env: dict[str, str], test_agent: TestAgentAPI, test_library: APMLibrary
):
Expand Down Expand Up @@ -1302,7 +1302,6 @@ def test_otel_aggregation_temporality(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Configuration_OTLP_Exporter_Metrics_Endpoint:
Expand Down Expand Up @@ -1419,6 +1418,7 @@ def test_otlp_metrics_custom_endpoint_http_protobuf(
assert scope_metrics is not None

@missing_feature(context.library == "nodejs", reason="Does not support grpc")
@missing_feature(context.library == "php", reason="otel php does not follow this", force_skip=True)
@pytest.mark.parametrize(
("library_env", "endpoint_env", "test_agent_otlp_grpc_port"),
[
Expand Down Expand Up @@ -1461,7 +1461,6 @@ def test_otlp_metrics_custom_endpoint_grpc(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Configuration_OTLP_Exporter_Metrics_Headers:
Expand Down Expand Up @@ -1544,7 +1543,6 @@ def test_custom_metrics_http_headers_included_in_otlp_export(
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Configuration_OTLP_Exporter_Metrics_Protocol:
Expand Down Expand Up @@ -1623,7 +1621,6 @@ def test_otlp_protocol_grpc(self, test_agent: TestAgentAPI, test_library: APMLib
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "nodejs", reason="Does not support DD_HOSTNAME")
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Host_Name:
Expand All @@ -1641,6 +1638,7 @@ class Test_Otel_Metrics_Host_Name:
**DEFAULT_ENVVARS,
"DD_HOSTNAME": "ddhostname",
"DD_TRACE_REPORT_HOSTNAME": "true",
"OTEL_PHP_DETECTORS": "all",
},
],
)
Expand All @@ -1655,7 +1653,12 @@ def test_hostname_from_dd_hostname(

metrics_data = test_agent.wait_for_num_otlp_metrics(num=1)
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}

assert actual_attributes.get("host.name") == "ddhostname"

Expand Down Expand Up @@ -1684,7 +1687,12 @@ def test_hostname_from_otel_resources(

metrics_data = test_agent.wait_for_num_otlp_metrics(num=1)
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}

assert actual_attributes.get(host_attribute) == "otelenv-host"

Expand Down Expand Up @@ -1713,7 +1721,12 @@ def test_hostname_omitted(self, test_agent: TestAgentAPI, test_library: APMLibra

metrics_data = test_agent.wait_for_num_otlp_metrics(num=1)
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value (skip non-string attributes like telemetry.distro.version)
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}

assert "host.name" not in actual_attributes

Expand All @@ -1724,7 +1737,6 @@ def test_hostname_omitted(self, test_agent: TestAgentAPI, test_library: APMLibra
@missing_feature(context.library == "dotnet", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "golang", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "java", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "php", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "ruby", reason="Not yet implemented", force_skip=True)
@missing_feature(context.library == "rust", reason="Not yet implemented", force_skip=True)
class Test_Otel_Metrics_Resource_Attributes:
Expand Down Expand Up @@ -1761,7 +1773,12 @@ def test_otel_resource_attributes(self, test_agent: TestAgentAPI, test_library:

# Assert that the ResourceMetrics has the expected resources
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value (skip non-string attributes like telemetry.distro.version)
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}
assert expected_attributes.items() <= actual_attributes.items()

# Add separate assertion for the DD_ENV mapping, whose semantic convention was updated in 1.27.0
Expand Down Expand Up @@ -1822,7 +1839,12 @@ def test_otel_resource_attributes_populated_by_dd_otel_envs(

# Assert that the ResourceMetrics has the expected resources
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value (skip non-string attributes like telemetry.distro.version)
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}
assert expected_attributes.items() <= actual_attributes.items()

# Add separate assertion for the DD_ENV mapping, whose semantic convention was updated in 1.27.0
Expand Down Expand Up @@ -1860,7 +1882,12 @@ def test_dd_env_vars_override_otel(self, test_agent: TestAgentAPI, test_library:

# Assert that the ResourceMetrics has the expected resources
resource = metrics_data[0]["resource_metrics"][0]["resource"]
actual_attributes = {item["key"]: item["value"]["string_value"] for item in resource["attributes"]}
# Only extract attributes that have string_value (skip non-string attributes like telemetry.distro.version)
actual_attributes = {
item["key"]: item["value"]["string_value"]
for item in resource["attributes"]
if "string_value" in item["value"]
}
assert expected_attributes.items() <= actual_attributes.items()

# Add separate assertion for the DD_ENV mapping, whose semantic convention was updated in 1.27.0
Expand Down
2 changes: 1 addition & 1 deletion utils/_context/_scenarios/parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, name: str, doc: str) -> None:
doc=doc,
github_workflow="parametric",
scenario_groups=(scenario_groups.parametric,),
agent_image="ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.32.0",
agent_image="ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.37.0",
)
self._parametric_tests_confs = ParametricScenario.PersistentParametricTestConf(self)

Expand Down
4 changes: 2 additions & 2 deletions utils/build/docker/php/parametric/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

FROM datadog/dd-trace-ci:php-8.2_buster
FROM datadog/dd-trace-ci:php-8.2_bookworm-5
RUN switch-php nts
WORKDIR /binaries
ENV DD_TRACE_CLI_ENABLED=1
ADD utils/build/docker/php/parametric/composer.json .
ADD utils/build/docker/php/parametric/composer.lock .
RUN echo "extension=grpc" > "$(php-config --ini-dir)/grpc.ini"
RUN composer install
ADD utils/build/docker/php/parametric/../common/install_ddtrace.sh .
COPY binaries /binaries
Expand Down
15 changes: 9 additions & 6 deletions utils/build/docker/php/parametric/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
"minimum-stability":"dev",
"require": {
"league/uri-components": "^2",
"amphp/http-server": "3.x-dev",
"amphp/http-server-router": "2.x-dev",
"amphp/log": "2.x-dev",
"open-telemetry/sdk": "^1.0.0",
"symfony/http-client": "6.4.x-dev",
"amphp/http-server": "^3",
"amphp/http-server-router": "^2",
"amphp/log": "^2",
"open-telemetry/sdk": "2.x-dev",
"open-telemetry/exporter-otlp": "2.x-dev",
"open-telemetry/transport-grpc": "2.x-dev",
"symfony/http-client": "^6.4",
"nyholm/psr7": "^1.8@dev"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
"php-http/discovery": true,
"tbachert/spi": true
}
}
}
Loading
Loading