Skip to content

chore: extract shared e2e telemetry checker#2369

Merged
ava-silver merged 3 commits into
masterfrom
ava.silver/chore/shared-e2e-telemetry-checker
Jun 22, 2026
Merged

chore: extract shared e2e telemetry checker#2369
ava-silver merged 3 commits into
masterfrom
ava.silver/chore/shared-e2e-telemetry-checker

Conversation

@ava-silver

@ava-silver ava-silver commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What and why?

The Lambda, Cloud Run, and Container App e2e suites all need to poll Datadog for spans and logs filtered by a run-specific identity. That polling logic was being copied per suite. This extracts it into one runner-agnostic helper so every suite shares a single implementation.

Base of the serverless e2e stack (Lambda → sidecar idempotency → Container App → AAS build on top of this).

How?

  • Add e2e/helpers/telemetry-checker.ts: polls spans and logs (15s × 20 attempts) for a TelemetryIdentity (service plus optional env / version / tags), building the span (@-prefixed attributes) and log query forms from the same identity.
  • Refactor e2e/helpers/cloud-run-telemetry-checker.ts to delegate to the shared checker, keeping its existing serviceName signature.
  • Add e2e/helpers/http.ts triggerTraffic: polls an HTTP endpoint until it serves successful responses, so a freshly deployed app has time to cold-start before we assert telemetry. Adopt it in the Cloud Run suite (replacing a single un-retried fetch); Container App and AAS use it too.
  • Add the shared helpers to the Cloud Run CI path filter.

Test plan

  • Exercised by the consuming e2e suites (Cloud Run today; Lambda/Container App/AAS in the PRs stacked on top).

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

ava-silver commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@ava-silver
ava-silver marked this pull request as ready for review June 17, 2026 18:24
@ava-silver
ava-silver requested a review from a team as a code owner June 17, 2026 18:24
@ava-silver ava-silver added the serverless Related to [aas, cloud-run, lambda, stepfunctions] label Jun 17, 2026
@ava-silver ava-silver added the chores Related to the CI or developer experience label Jun 17, 2026 — with Graphite App
@ava-silver
ava-silver requested a review from a team as a code owner June 17, 2026 20:37
@ava-silver
ava-silver force-pushed the ava.silver/chore/shared-e2e-telemetry-checker branch from 8cbadb2 to 83da7dd Compare June 17, 2026 20:45
Comment thread e2e/helpers/traffic.ts
console.log(`[traffic] attempt ${attempt}/${attempts} returned ${response.status}`)
if (response.ok) {
successfulRequests++
if (successfulRequests >= requiredSuccesses) {

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.

Do these kinds of services not have a clean transition from not ready -> ready where we need to get multiple successful responses?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right -- there's no clean client-observable ready transition. During cold start these apps interleave timeouts/403s/503s with the occasional 200, so a single success can be a fluke.

But the bigger reason for requiring multiple successes is telemetry generation, not just readiness. The trace/log pipeline (the serverless-init sidecar on Linux, the site-extension on Windows) warms up a beat after the app starts serving HTTP, so the earliest requests' spans get dropped. Empirically on the AAS suite: 3 successes produced telemetry the checker never found in 5 min, while ~10 successes over ~100s landed spans+logs within seconds -- which is why the AAS tests pass {requiredSuccesses: 10}.

So the loop does double duty: confirm the app is reliably up and drive enough sustained load that telemetry actually flows before we assert. I've tightened the comment to call that out.

@ava-silver
ava-silver requested a review from avangelillo June 18, 2026 22:33
@ava-silver
ava-silver merged commit 253375f into master Jun 22, 2026
33 checks passed
@ava-silver
ava-silver deleted the ava.silver/chore/shared-e2e-telemetry-checker branch June 22, 2026 15:25
ava-silver pushed a commit that referenced this pull request Jun 22, 2026
### What and why?

Adds real AWS Lambda e2e coverage for `datadog-ci lambda instrument` and `datadog-ci lambda uninstrument`. The tests are gated in CI, target `eu-central-1`, and use the `nodejs24.x` runtime.

Stacked on #2369 (shared telemetry checker).

### How?

- Adds a Lambda e2e test that creates a temporary `one-e2e-ci-lambda-*` function with the AWS CLI, instruments it, verifies the AWS configuration, invokes it and asserts telemetry flows, re-instruments and asserts idempotency (exactly one of each Datadog layer), uninstruments, verifies cleanup, and deletes it.
- Adds a Lambda verifier for the Datadog Node/Extension layers, handler restoration, Datadog env vars, and the `dd_sls_ci` tag.
- Asserts telemetry **identity** (service + env + version) via the shared telemetry checker rather than mere existence; the unique per-run function name doubles as the run-id marker.
- Updates GitHub Actions with a Lambda path filter, conditional AWS OIDC auth, Lambda e2e env vars, and Windows/standalone skips.
- Allows quoted values in `e2e/.env.local`, matching the local e2e docs.
- Adds CODEOWNERS coverage for the new Lambda e2e files.

### Test plan

- See test run in GitHub Actions: https://github.com/DataDog/datadog-ci/actions/runs/27034018380/job/79794038275

### Review checklist

- [x] Feature or bugfix MUST have appropriate tests (unit, integration)
@ava-silver ava-silver mentioned this pull request Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chores Related to the CI or developer experience serverless Related to [aas, cloud-run, lambda, stepfunctions]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants