Skip to content

feat(otel): add a CLI that pushes artifacts manifests as OTLP spans - #555

Merged
Winify merged 7 commits into
otel/2-telemetry-modefrom
otel/3-otel-push-cli
Nov 26, 2026
Merged

Winify merged 7 commits into
otel/2-telemetry-modefrom
otel/3-otel-push-cli

Conversation

@Winify

@Winify Winify commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Stack

Part 3 of 4 of the OpenTelemetry export, replacing #485. Stacked on part 2.

What

A new package, @wdio/opentelemetry, with a wdio-otel push CLI. It pushes the tests listed in artifacts manifests to an OTLP collector as spans.

  • Each attempt is a root span carrying its status, duration, failure and the ids recorded at the attempt's start. When the run had a TRACEPARENT, each attempt is a child of the CI span instead.
  • --trace-zips reads the final attempt's trace zip and pushes its actions as child spans. An earlier attempt's zip is never used in place of the final one.
  • Under retain-on-failure every test still gets its span. A zip the policy dropped gets no link and no action spans.
  • --artifact-base-url adds each zip's URL as devtools.artifact.url.

Verification

pnpm build, pnpm test (4159 passed, 4 skipped), pnpm lint (0 errors), pnpm docs:capabilities --check and the packages/otel typecheck pass on this branch. packages/otel/dist imports none of the private workspace packages.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devtools Ready Ready Preview Nov 26, 2026 8:52am UTC

Request Review

@plum117

plum117 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Works: same ids on re-push, CI parent and TRACESTATE kept, exit 1 when the collector is down or answers 500, 10k tests in 0.2 s.

  1. Push cut at 30 batches (providers.ts:26): 40k spans → 15,360 arrive, then "Concurrent export limit reached". With --trace-zips, about 770 tests reach this limit. Flush in steps.
  2. supersededFinals hides real failures (to-telemetry.ts:468): Chrome fails, then Firefox passes later (maxInstances: 1) → the Chrome failure gets final_attempt=false.
  3. A test with no state is dropped silently (manifest.ts:117): an interrupted test is read as an old Cucumber step.
  4. Parallel browsers give identical spans. Add browser.name, the session id and devtools.test.uid.
  5. test.suite.name is the absolute local path. History does not match across machines, and the user name is visible.
  6. Only the final attempt gets its zip link; zips of earlier attempts are kept but not linked.
  7. When several runs are pushed together without --run-id, each manifest's runId is replaced by a joined id.
  8. An unsampled CI parent gives orphan spans (AlwaysOnSampler). A README note would help.
  9. A missing final reports "neither a test nor a step"; it would help to name the cause.
  10. Idea: span links between the attempts of a test.

Nit: cli.ts repeats error formatting; describe() already does this.

@Winify
Winify marked this pull request as ready for review November 11, 2026 11:59
@plum117
plum117 force-pushed the otel/3-otel-push-cli branch from 94a51a5 to c0341b3 Compare November 12, 2026 11:03
@Winify
Winify force-pushed the otel/3-otel-push-cli branch from c0341b3 to f5e4399 Compare November 13, 2026 15:49
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · Fix final-result selection for whole-spec retries before merging.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR adds an opt-in path for test data to reach an OpenTelemetry collector.

Fix final-result selection for whole-spec retries before merging.

Findings

  1. P1 Retried specs keep duplicate finals ▶

Summary

Adds @wdio/opentelemetry and the wdio-otel push CLI.

  • Each recorded test attempt becomes its own OpenTelemetry span.
  • Retained trace zips can add action spans under each test.
  • The wdio-otel push command sends manifests to a collector.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Artifacts manifests] --> B[Check manifests and sampling]
  B --> C[Compare final attempts]
  C --> D[Prepare attempt spans]
  E[Retained trace zips] -->|Optional| D
  D --> F[Sequential OTLP batches]
  F --> G[Collector]
Loading

Reviews (6) · Last reviewed commit: "fix(otel): link a session or spec zip to..." · Reviewed by Greptile

Comment thread packages/otel/src/artifact-sources.ts Outdated
Comment on lines +37 to +38
const attempt = finalAttemptOf(test)
return candidates.find((artifact) => retryOf(artifact) === attempt)

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.

P2 Retried tests lose replay links

Retained session- and spec-scope zips contain the final attempt but do not use a -retryN folder, so retryOf(artifact) returns 0. When the final attempt is greater than 0, this lookup selects nothing. As a result, --artifact-base-url silently omits devtools.artifact.url, leaving users without a replay link despite the retained zip.

Match shared artifacts by their scope and covered test. Keep exact-attempt matching for per-test zips.

@Winify
Winify force-pushed the otel/3-otel-push-cli branch from f5e4399 to db9942a Compare November 13, 2026 23:16
Winify and others added 7 commits November 26, 2026 09:52
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
A push above about 15,000 spans started more than 30 exports at once, the
exporter refused the rest, and half the run was lost behind an exit code.
Batches now go one at a time and a failure says how many spans arrived.

Spans carry the session, browser, test uid and CI commit, branch and pipeline,
and test.suite.name is relative to where the tests ran, so history matches
across machines. A failure in one browser is no longer superseded by a later
pass in another, a test with no outcome is pushed instead of dropped, and a
malformed manifest names the field at fault.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…he run

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An end-to-end run showed the attempt span marked failed with no
error.message: mocha only sets the error on a test it reports as failed,
and a retried attempt is never reported.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The reader accepts only manifestVersion 2, checks it before anything
else, and no longer needs cwd. Sampling follows the parent unless
--ignore-parent-sampling is given, and a manifest skipped for that reason
is reported. Console text is exported only with --console-messages and is
capped. A zip outside the manifest directory, by path or through a
symlink, is not read. Manifests keep their own run ids, and a push of
spans older than an hour says so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Only a per-test zip names its attempt in its folder. A session or spec zip covers every attempt of its tests, but was matched as attempt 0, so a test that passed on a retry got no replay link and nothing said so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Winify
Winify force-pushed the otel/3-otel-push-cli branch from 5ef75be to 384ce6f Compare November 26, 2026 08:52
for (const finals of byTest.values()) {
for (const earlier of finals) {
if (
earlier.state === STATE_FAILED &&

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.

P1 Retried specs keep duplicate finals

When specFileRetries reruns a spec because one test failed, it also reruns tests that passed. These tests keep the same uid, run id and browser, but supersededFinals only clears the earlier final flag for failures. A test that passes twice gets two spans with devtools.test.final_attempt=true. A test that passes then fails gets conflicting final results. This breaks the documented filter for counting each test once.

Use the recorded spec attempt number to identify replaced results regardless of their earlier status, while keeping independent browser runs separate.

@Winify
Winify merged commit 0260fa4 into main Nov 26, 2026
15 checks passed
@Winify
Winify deleted the otel/3-otel-push-cli branch November 26, 2026 09:06
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