Skip to content

fix(ci): retry fakeintake fetches in datadog-metrics e2e test#25784

Open
thomasqueirozb wants to merge 5 commits into
masterfrom
fix/e2e-datadog-metrics-retry
Open

fix(ci): retry fakeintake fetches in datadog-metrics e2e test#25784
thomasqueirozb wants to merge 5 commits into
masterfrom
fix/e2e-datadog-metrics-retry

Conversation

@thomasqueirozb

Copy link
Copy Markdown
Member

Summary

The datadog-metrics e2e test used a single fixed 2-second sleep before fetching metric payloads from fakeintake, with no retry on the fetch itself. Under load this window isn't always enough for events to flow through the agent -> fakeintake pipeline, causing intermittent assertion failed: !series.is_empty() failures.

This applies the same retry pattern already used by the datadog-logs e2e test: poll fakeintake up to 10 times (1s apart) until data shows up, instead of a single fixed-delay fetch.

Vector configuration

NA

How did you test this PR?

Ran cargo check / cargo clippy --test e2e --no-default-features --features e2e-tests-datadog locally to verify the change compiles cleanly. The e2e suite itself requires Docker-based fakeintake/agent services in CI.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

NA

@thomasqueirozb thomasqueirozb added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Jul 8, 2026
@datadog-vectordotdev

datadog-vectordotdev Bot commented Jul 8, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 2 Pipeline jobs failed

Test Suite | Check code format   View in Datadog   GitHub Actions

Test Suite | Test Suite   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: be1e956 | Docs | Give us feedback!

@thomasqueirozb thomasqueirozb marked this pull request as ready for review July 8, 2026 20:27
@thomasqueirozb thomasqueirozb requested a review from a team as a code owner July 8, 2026 20:27
@thomasqueirozb thomasqueirozb enabled auto-merge July 8, 2026 20:28

@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: a9f65d73a2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/e2e/datadog/metrics/series.rs Outdated
Comment thread tests/e2e/datadog/metrics/series.rs Outdated
Comment thread tests/e2e/datadog/metrics/sketches.rs Outdated
@thomasqueirozb thomasqueirozb added the preview: website Deploy a vector.dev preview site for this PR label Jul 8, 2026

@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: 3e3d46b47f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/e2e/datadog/metrics/mod.rs Outdated
@thomasqueirozb thomasqueirozb disabled auto-merge July 8, 2026 20:49
// whether the series intake looks complete, i.e. every expected metric type
// has arrived. Used to decide whether it's worth continuing to poll fakeintake.
fn series_intake_is_complete(series: &SeriesIntake) -> bool {
!series.is_empty() && found_metric_types(series).iter().all(|(found, _)| *found)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this the case because of our test setup? It feels like a brittle predicate.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's tied to the test's dogstatsd emitter (tests/e2e/datadog-metrics/dogstatsd_client/client.py), which sends exactly these four metric types (rate, gauge, set, histogram) once per run, deterministically.

If changes to client.py are made this would also need to keep track/in sync

Comment thread tests/e2e/datadog/metrics/mod.rs

@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: 0d90cbb371

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// "wait until this test's data is complete" API of its own, so we have to infer readiness
// from what the emitter is known to send.
fn series_intake_is_complete(series: &SeriesIntake) -> bool {
!series.is_empty() && found_metric_types(series).iter().all(|(found, _)| *found)

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 Wait for series intake to stabilize

Fresh evidence: this new completeness predicate still only waits for the four metric-name prefixes, but the DogStatsD client emits those same four metrics on every one of its 50 iterations (tests/e2e/datadog-metrics/dogstatsd_client/client.py:38-54). If the Agent flushes while that loop is still running, the first partial flush already satisfies this predicate; the agent snapshot can be taken before later flushes while the vector snapshot is fetched afterward and includes additional buckets, causing the exact context/sum comparisons below to fail intermittently. Wait for the intake to stabilize or for the expected sample/payload count instead of only checking prefixes.

Useful? React with 👍 / 👎.

// test's data is complete" API of its own, so we have to infer readiness from what the emitter
// is known to send.
fn sketch_intake_is_complete(sketches: &SketchIntake) -> bool {
!sketches.is_empty() && has_distribution(sketches)

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 Wait for all sketch samples before comparing

Fresh evidence: the new readiness check still treats the first distribution context as complete, while the emitter sends 50 distribution samples (tests/e2e/datadog-metrics/dogstatsd_client/client.py:38-54). In runs where the Agent produces an early sketch flush before the emitter finishes, agent_sketches can return a partial snapshot; the vector path is fetched later and may include subsequent fakeintake payloads, so the exact sketch equality check fails even though the pipeline is correct. Poll until the sketch data is stable or the expected amount of data has arrived.

Useful? React with 👍 / 👎.

@thomasqueirozb thomasqueirozb removed the preview: website Deploy a vector.dev preview site for this PR label Jul 9, 2026
@thomasqueirozb thomasqueirozb added preview: website Deploy a vector.dev preview site for this PR and removed preview: website Deploy a vector.dev preview site for this PR labels Jul 9, 2026

@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: be1e95623d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/e2e/datadog/mod.rs
}
}

panic!("{last_error} after {MAX_FETCH_ATTEMPTS} attempts");

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 Let outer polling retry fakeintake startup failures

Fresh evidence: this helper now retries connection/JSON errors internally, but it still panics after 10 attempts, so the 45-attempt metrics polling budget in tests/e2e/datadog/metrics/mod.rs is never reached when fakeintake is simply unavailable for more than ~10s. I checked tests/e2e/datadog-metrics/config/compose.yaml and the fakeintake services have no healthcheck/readiness gate, so a slow container startup can still abort the test before the data-arrival retry loop has a chance to continue.

Useful? React with 👍 / 👎.

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

Labels

no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants