Skip to content

Commit

Permalink
update weblog sampling_test use sampling rules instead of deprecated …
Browse files Browse the repository at this point in the history
…envvar (#3984)
  • Loading branch information
mabdinur authored Feb 4, 2025
1 parent fc48211 commit 7106f6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/parametric/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def test_library_settings(self, library_env, test_agent, test_library):
@missing_feature(context.library == "php", reason="Not implemented")
@missing_feature(context.library == "cpp", reason="Not implemented")
@missing_feature(
context.library < "[email protected]", reason="OTEL Sampling config is mapped to a different datadog config"
context.library <= "python@3.1.0", reason="OTEL Sampling config is mapped to a different datadog config"
)
@pytest.mark.parametrize(
"library_env",
Expand Down Expand Up @@ -370,7 +370,7 @@ def test_telemetry_otel_env_hiding(self, library_env, test_agent, test_library):
@missing_feature(context.library == "php", reason="Not implemented")
@missing_feature(context.library == "cpp", reason="Not implemented")
@missing_feature(
context.library < "[email protected]", reason="OTEL Sampling config is mapped to a different datadog config"
context.library <= "python@3.1.0", reason="OTEL Sampling config is mapped to a different datadog config"
)
@missing_feature(
context.library == "nodejs", reason="does not collect otel_env.invalid metrics for otel_resource_attributes"
Expand Down
9 changes: 3 additions & 6 deletions utils/_context/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def __init__(
use_proxy=True,
volumes=None,
) -> None:
from utils import weblog, context
from utils import weblog

self.host_port = weblog.port
self.container_port = 7777
Expand Down Expand Up @@ -718,11 +718,8 @@ def __init__(
base_environment["DD_IAST_DEDUPLICATION_ENABLED"] = "false"

if tracer_sampling_rate:
if context.library == "python":
# python3.x dropped support for DD_TRACE_SAMPLE_RATE
base_environment["DD_TRACE_SAMPLING_RULES"] = str([{"sample_rate": tracer_sampling_rate}])
else:
base_environment["DD_TRACE_SAMPLE_RATE"] = str(tracer_sampling_rate)
base_environment["DD_TRACE_SAMPLE_RATE"] = str(tracer_sampling_rate)
base_environment["DD_TRACE_SAMPLING_RULES"] = json.dumps([{"sample_rate": tracer_sampling_rate}])

if use_proxy:
# set the tracer to send data to runner (it will forward them to the agent)
Expand Down

0 comments on commit 7106f6f

Please sign in to comment.