Skip to content

test(otel): cover OTEL_METRIC_EXPORT_TIMEOUT parametrically - #7682

Open
vpellan wants to merge 1 commit into
mainfrom
vpellan/OTEL_METRIC_EXPORT_TIMEOUT
Open

test(otel): cover OTEL_METRIC_EXPORT_TIMEOUT parametrically#7682
vpellan wants to merge 1 commit into
mainfrom
vpellan/OTEL_METRIC_EXPORT_TIMEOUT

Conversation

@vpellan

@vpellan vpellan commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Motivation

Add specification-based parametric coverage for OTEL_METRIC_EXPORT_TIMEOUT.

Tracks APMAPI-2397.

Changes

  • Test representative values, unset, empty and default values, and configuration
    precedence.
  • Declare support in every tracer manifest from the configuration registry.
  • Declare spec default as irrelevant for all SDKs but PHP

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from
      R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛏 #apm-shared-testing 🛏

Reviewer checklist

  • Anything but tests/ or manifests/ is modified? I have the approval
    from R&P team
  • A docker base image is modified?
    • The relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@vpellan
vpellan requested review from a team as code owners September 9, 2026 12:15
@vpellan
vpellan requested review from mtoffl01 and removed request for a team September 9, 2026 12:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T12:23:28.345135Z 4ecff7c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py       @DataDog/system-tests-core @DataDog/apm-sdk-capabilities
manifests/cpp.yml                                                       @DataDog/system-tests-reviewers
manifests/dotnet.yml                                                    @DataDog/system-tests-reviewers
manifests/golang.yml                                                    @DataDog/system-tests-reviewers
manifests/java.yml                                                      @DataDog/system-tests-reviewers
manifests/nodejs.yml                                                    @DataDog/system-tests-reviewers
manifests/php.yml                                                       @DataDog/system-tests-reviewers
manifests/python.yml                                                    @DataDog/system-tests-reviewers
manifests/ruby.yml                                                      @DataDog/system-tests-reviewers
manifests/rust.yml                                                      @DataDog/system-tests-reviewers

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 9, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 19 Pipeline jobs failed

Testing the test | System Tests (dotnet, dev) / parametric / parametric (2) — ❌ 3 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

3 failed tests. Assertion Error: assert 'env_var' == 'default' at tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py:91.

Showing tests most relevant to this failure.

❌ tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT.test_invalid_values_use_default[negative, parametric-dotnet] from system_tests_suite
AssertionError: assert 'env_var' == 'default'
  - default
  + env_var

self = <tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT object at 0x7fe61571ed20>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7fe61465efc0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7fe61465ddc0>

    @pytest.mark.parametrize("library_env", INVALID_VALUES)
    def test_invalid_values_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
...
❌ tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT.test_invalid_values_use_default[not-an-integer, parametric-dot... from system_tests_suite
AssertionError: assert 'env_var' == 'default'
  - default
  + env_var

self = <tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT object at 0x7fe61571f3b0>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7fe61465efc0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7fe614c5b230>

    @pytest.mark.parametrize("library_env", INVALID_VALUES)
    def test_invalid_values_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
...
❌ tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT.test_unset_and_empty_use_default[empty, parametric-dotnet] from system_tests_suite
AssertionError: assert 'env_var' == 'default'
  - default
  + env_var

self = <tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT object at 0x7fe61571fc20>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7fe61465efc0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7fe614c5a840>

    @pytest.mark.parametrize("library_env", UNSET_AND_EMPTY_VALUES)
    def test_unset_and_empty_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
...
Testing the test | System Tests (golang, dev) / parametric / parametric (2) — ❌ 1 test failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Test run failed in tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py: ValueError: Number (1) of metrics not available from test agent, got 0; AssertionError: assert 'env_var' == 'default'

Showing tests most relevant to this failure.

❌ tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT.test_stable_values[minimum-finite, parametric-golang] from system_tests_suite
ValueError: Number (1) of metrics not available from test agent, got 0

self = <tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT object at 0x7f27c2284a10>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f27c0ce1be0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f27c16be5d0>

    @pytest.mark.parametrize(("library_env", "expected"), STABLE_VALUES)
    def test_stable_values(
        self,
        test_agent: TestAgentAPI,
...
Testing the test | System Tests (golang, prod) / parametric / parametric (1) — ❌ 1 test failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

1 failed test. Assertion Error: assert 'env_var' == 'default' in tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py:91.

Showing tests most relevant to this failure.

❌ tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT.test_invalid_values_use_default[negative, parametric-golang] from system_tests_suite
AssertionError: assert 'env_var' == 'default'
  - default
  + env_var

self = <tests.parametric.otel_env_vars.test_otel_metric_export_timeout.Test_OTEL_METRIC_EXPORT_TIMEOUT object at 0x7fadcc6a3560>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7fadcb2ddb50>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7fadcbbf57f0>

    @pytest.mark.parametrize("library_env", INVALID_VALUES)
    def test_invalid_values_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
...

View all 19 failed jobs.

📋 Copy fix prompt
CI on my pull request is failing. Help me find and fix the root cause of each failing job below — they were flagged as caused by changes in this PR, so focus on the diff. For each job, explain the failure and propose a fix.

Before you start, set up the Datadog software-delivery tooling so you can
query the CI data yourself:

1. Check whether you already have the Datadog software-delivery MCP tools
   (e.g. a `search_datadog_ci_pipeline_events` tool) and the `unblock-pr` skill.
2. If either is missing, STOP and ask me for permission before installing
   anything. Do not install or run anything until I have said yes.
3. Only with my explicit approval, set up the Datadog software-delivery MCP
   server and skills by following:
     https://docs.datadoghq.com/getting_started/software_delivery_mcp_tools/
   then restart so the skill is picked up.
4. If I decline, skip all of the above and work from the context below alone.

Then run /unblock-pr — it will pull the CI data itself. The job context below is what we already know.

If /unblock-pr is not available — because I declined the setup above, or it did not install — work from the context below instead.

Datadog has already classified this failure as caused by changes in this PR.
Take that as given and work the fix:

1. Locate the change. Diff this branch against its base and find the change
   that produces this error. Explain the mechanism, don't just name a file:
     git fetch origin && git diff $(git merge-base origin/main HEAD)...HEAD
2. Reproduce it locally. Run the failing job's command or test before
   proposing anything.
3. Propose the smallest fix that addresses the root cause — not a workaround,
   not a broadened assertion, not a disabled or skipped test.
4. Re-run the same command to confirm, and say exactly what you ran.
5. If the failure turns out to be intermittent rather than deterministic, say
   so plainly instead of "fixing" it — that is a flaky test, and patching it
   hides the problem.

If the right move is to re-run the job rather than change code, use the job
link in the context below. For GitHub Actions: `gh run rerun <run-id> --failed`,
where the run ID is the number after `/runs/` in that URL (not the trailing
number, which is the job ID).

Branch: vpellan/OTEL_METRIC_EXPORT_TIMEOUT

Testing the test | System Tests (dotnet, dev) / parametric / parametric (2)
Commit: f017470edbb88e95f6c9c8770369ab7fadef5fbb
Error (code / test):
3 failed tests. Assertion Error: assert 'env_var' == 'default' at tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py:91.
CI job: https://github.com/DataDog/system-tests/actions/runs/34349988784/job/102461577495

Testing the test | System Tests (golang, dev) / parametric / parametric (2)
Commit: f017470edbb88e95f6c9c8770369ab7fadef5fbb
Error (code / test):
2 failed tests in tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py: ValueError: Number (1) of metrics not available from test agent, got 0; AssertionError: assert 'env_var' == 'default'
CI job: https://github.com/DataDog/system-tests/actions/runs/34349988784/job/102461527093

Testing the test | System Tests (golang, prod) / parametric / parametric (1)
Commit: f017470edbb88e95f6c9c8770369ab7fadef5fbb
Error (code / test):
1 failed test. Assertion Error: assert 'env_var' == 'default' in tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py:91.
CI job: https://github.com/DataDog/system-tests/actions/runs/34349988784/job/102461516335

Plus 8 more failing jobs not shown here.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4ecff7c | Docs | View more details | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ecff7c4ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

library.otel_get_meter(meter_name, "1.0.0", "", {})
library.otel_create_counter(meter_name, instrument_name, "1", "Metric SDK initialization")
library.otel_counter_add(meter_name, instrument_name, "1", "Metric SDK initialization", 1, {})
library.otel_metrics_force_flush()

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 Avoid exporting with the timeout under test

When the minimum-finite parameter sets OTEL_METRIC_EXPORT_TIMEOUT=1, this force flush may time out before the metric crosses the container network; its Boolean result is ignored, and the subsequent wait_for_num_otlp_metrics(num=1) then fails after eight seconds without ever checking telemetry. Initialize the metrics SDK without making test progress depend on an export governed by the value being inspected.

Useful? React with 👍 / 👎.

def test_unset_and_empty_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
config = _metric_export_timeout_configuration(test_agent, test_library)
assert config.get("origin") == "default"
assert _metric_export_timeout(config) >= 0

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 Assert the actual fallback timeout

For the unset and empty inputs, this accepts every nonnegative timeout, including an erroneous fallback such as 0 or 1, so the test can pass even though its name says the default is used. The commit already identifies the expected defaults as 30000 ms for PHP and 7500 ms for the other enabled SDKs; assert those exact values, with separately manifest-activated methods if necessary. The identical >= 0 check in test_invalid_values_use_default has the same false-pass behavior.

Useful? React with 👍 / 👎.

Comment thread manifests/php.yml
tests/otel_tracing_e2e/test_e2e.py::Test_OTelLogE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelMetricE2E: irrelevant
tests/otel_tracing_e2e/test_e2e.py::Test_OTelTracingE2E: irrelevant
tests/parametric/otel_env_vars/test_otel_metric_export_timeout.py::Test_OTEL_METRIC_EXPORT_TIMEOUT: v1.23.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That entry probably should be incomplete_test_app (/metrics/otel/force_flush endpoint is not implemented)


STABLE_VALUES = [
pytest.param({**DEFAULT_ENVIRONMENT, "OTEL_METRIC_EXPORT_TIMEOUT": "0"}, 0, id="zero-unlimited"),
pytest.param({**DEFAULT_ENVIRONMENT, "OTEL_METRIC_EXPORT_TIMEOUT": "1"}, 1, id="minimum-finite"),

@MilanGarnier MilanGarnier Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe testing for 1 is not necessary if we test a bigger value. It might be flaky

@pytest.mark.parametrize("library_env", INVALID_VALUES)
def test_invalid_values_use_default(self, test_agent: TestAgentAPI, test_library: APMLibrary) -> None:
config = _metric_export_timeout_configuration(test_agent, test_library)
assert config.get("origin") == "default"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not exactly sure why it is set "env_var" instead of "origin" in practice.
Is there a way to check this differently ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants