Skip to content

feat: add a telemetry mode that writes only the artifacts manifest - #554

Merged
Winify merged 21 commits into
mainfrom
otel/2-telemetry-mode
Nov 26, 2026
Merged

Winify merged 21 commits into
mainfrom
otel/2-telemetry-mode

Conversation

@Winify

@Winify Winify commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Stack

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

What

A new mode: 'telemetry' for the WDIO service, Selenium and Nightwatch. It starts no backend and opens no window. It takes no per-action capture, screencast or trace zip. The test lifecycle still runs, and only the artifacts manifest is written at session end. Live and trace modes are unchanged.

Why isn't this in core?

The decision of which modes observe the page is one shared helper, observesPage in packages/shared/src/mode-traits.ts. The per-adapter changes only apply it where each framework starts and stops its own capture: hook registration, backend startup and the screencast. That is framework-specific glue, which the repo's conventions leave in the adapters.

Verification

pnpm build, pnpm test (4056 passed, 4 skipped), pnpm lint (0 errors) and pnpm docs:capabilities --check pass on this branch. In one full run, a backend test (trace-run.test.ts) failed with EADDRINUSE 127.0.0.1:3000 and passed when rerun alone.

🤖 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:51am UTC

Request Review

@plum117

plum117 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Telemetry mode works in all 4 example setups: only the manifest is written, Cucumber lists each scenario once, and an invalid TRACEPARENT gives a warning and the run continues. mode-traits.ts is a good shape.

Small items:

  • The ignoredOptionsWarning noise is fixed with a conditional spread in each example. One config that switches DEVTOOLS_MODE still warns. emitArtifactsManifest is not on the list.
  • screencast-options.ts:26: user is always undefined.
  • test-metadata.ts:66: comments have several lines (CLAUDE.md: one line).

@Winify
Winify marked this pull request as ready for review November 11, 2026 11:59
Winify and others added 3 commits November 12, 2026 10:16
…ifacts manifest

A manifest that lists only test states cannot link a run to the traces it
produced or to a CI parent span. Each attempt now mints its trace and span
id when it starts, and the manifest records the run id and any TRACEPARENT
parent, so an external consumer can address every attempt.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…m the real attempt

A retried Selenium test was listed twice with final on its failed attempt,
because the test uid carried a per-process counter the attempt ledger did not.
A specFileRetries rerun recorded attempt 0, the tracker could renumber an
attempt into a repeat, and only the final attempt kept its error.

Artifact paths are now written relative to the manifest directory so a moved
or downloaded results folder still resolves, and the manifest records cwd and
browser identity for the exporter to slice by.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A retried Mocha test now reuses its first attempt's uid so the artifacts
manifest lists it once. The trace writer keyed a test's group on that uid,
so in a zip holding more than one test both attempts merged into a single
group and the examples smoke check counted one attempt where two ran.

Selenium stamps the attempt on each row of a retried attempt and the group
is keyed on the uid plus that attempt. A first attempt, and every adapter
that sets no attempt, exports exactly as before.

Also fixes the two test files that failed typecheck: a mock read through a
plainly typed hook, and a WebdriverIO-shaped result passed as a literal to
a parameter that deliberately omits the field the service ignores.

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

@plum117 plum117 left a comment

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.

@Winify main was reset to drop 4 malicious wdio-bot commits (40820eb3e6..7573922527). This branch still has them through a merge of the old main. Please rebase onto main (or squash-merge). I set the PR to draft until then.

@plum117
plum117 marked this pull request as draft November 12, 2026 10:37
@Winify

Winify commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@Winify main was reset to drop 4 malicious wdio-bot commits (40820eb3e6..7573922527). This branch still has them through a merge of the old main. Please rebase onto main (or squash-merge). I set the PR to draft until then.

@plum117 Yes! thank you, i have only noticed 1hr ago as well, but i do not have access to a machine for a couple more hours

so if it cannot wait, i would ask you to rebase them kindly

@plum117
plum117 force-pushed the otel/2-telemetry-mode branch from 083a0f5 to 5ff90c7 Compare November 12, 2026 11:03
@plum117

plum117 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Kindly Done 😉

@Winify
Winify marked this pull request as ready for review November 12, 2026 12:14
Winify and others added 2 commits November 13, 2026 09:55
The manifest carries manifestVersion 2, since artifact paths, attempts[]
and specFile changed shape and a reader could not tell the formats apart.
Without a TRACEPARENT every attempt of a test now joins one trace derived
from the run id and the test's uid, so a retried test is not three
unrelated traces, while a large run is not one oversized trace. The
absolute cwd is gone: specFile is written relative to it instead. A final
attempt that matches no recorded attempt is reported, not silently
replaced by the last one.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…field

The shared wire schema gained CommandLog.attempt, and the Python CI job
fails when the generated types are out of date with it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Winify
Winify force-pushed the otel/2-telemetry-mode branch from 5ff90c7 to d337178 Compare November 13, 2026 15:49
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issue remains.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue remains.

Summary

Adds mode: 'telemetry' across WebdriverIO, Selenium and Nightwatch.

  • Telemetry runs keep test details and write an artifacts manifest.
  • Nightwatch keeps test tracking while telemetry turns off page capture.
  • Selenium runs telemetry without reading or capturing the page.
  • The WDIO service runs telemetry without starting page capture.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Adapter receives mode] --> B{Mode}
  B -->|live| C[Start backend and dashboard]
  B -->|trace| D[Capture page and write traces]
  B -->|telemetry| E[Keep test results and attempts]
  E --> F[Write artifacts manifest only]
Loading

Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

...(startsBackend(ctx.options.mode)
? { hostname: ctx.options.hostname, port: ctx.options.port }
: {}),
captureOutput: observesPage(ctx.options.mode)

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 Telemetry still reads the viewport

Selenium still awaits buildDriverMetadata in telemetry mode. That function reads the viewport through executeScript for browsers or getRect for native apps. Every session makes an extra driver request, and Builder.build() waits for it even though the manifest does not use the viewport.

Pass the page-observation flag into buildDriverMetadata and skip readViewport when it is false, as the other adapters do.

Winify and others added 3 commits November 13, 2026 21:11
A retried test's attempts share one uid, and the screenshot was named from the uid and the session alone, so a retry overwrote the earlier attempt's file and the manifest listed one path twice. The file and its artifact key now carry the attempt, the same way the per-test trace slice does.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…cts manifest

The Selenium root suite keeps the working directory as its file, so the scenario under it was read as the feature and no scenario was ever recorded: the manifest listed each step as a test. A suite whose feature file is a .feature now counts as the feature, and the scenario feeds the attempt ledger, so it gets its own attempts and trace ids.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@Winify
Winify force-pushed the otel/2-telemetry-mode branch from d337178 to 2e57161 Compare November 13, 2026 23:16
…before the driver

A scenario started before the driver existed is replayed from pendingScenario.
The replay skipped the root featureFile stamp and the featureFile argument to
startScenarioSuite that startScenario applies, so the scenario sub-suite
inherited the .feature file as its own file and the collector classed it as a
'feature' instead of a 'scenario'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Winify and others added 4 commits November 24, 2026 16:56
Telemetry mode writes only the artifacts manifest, which never uses the
viewport, yet every Selenium session paid a driver round-trip for it. Gate
the read on observesPage(mode), as the Nightwatch adapter already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ettle

afterTest captures endTime before it waits for the command hooks to settle, but
the attempt ledger stamped Date.now() after that wait. attempts[].endTime in the
artifacts manifest therefore ran past the test's own end by the settle time.
recordOutcome now takes the captured endTime, and the service passes it through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… site

Unit tests exercised buildDriverMetadata with observePage passed directly, so a call site that dropped the observesPage(mode) gate would pass them. The new test drives onDriverCreated in both modes and checks the published metadata.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Winify
Winify dismissed plum117’s stale review November 24, 2026 20:59

Rebased onto the reset main on 11-12; the stack no longer contains 40820eb.

Winify and others added 7 commits November 26, 2026 08:34
…-ids

# Conflicts:
#	packages/service/src/index.ts
#	packages/service/src/reporter.ts
#	packages/service/src/test-metadata.ts
#	packages/service/tests/trace-metadata.test.ts
# Conflicts:
#	README.md
#	packages/core/src/trace-finalizer.ts
#	packages/nightwatch-devtools/src/index.ts
#	packages/selenium-devtools/src/index.ts
#	packages/selenium-devtools/src/session-lifecycle.ts
#	packages/selenium-devtools/src/session.ts
#	packages/service/src/index.ts
#	packages/service/src/session.ts
The manifest copies test and attempt errors verbatim, so a configured secret or a learned password in a failure message leaked into the JSON while the trace zips stayed redacted. Run them through the same redactor as the zips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a runner attempt, a same-named test after a failure was taken for a retry and replaced the earlier entry, so a Jest test.each failure followed by a same-named pass reported one passing test. Merge only when the runner passes attempt > 0 (Mocha); Jest exposes no hook-visible retry count, so it never merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jest exposes no retry index to hooks, so after dropping the name heuristic a retryTimes re-run is its own test. Pin that, and fix the attempt option comment that still described the removed heuristic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from otel/1-manifest-trace-ids to main November 26, 2026 08:46
# Conflicts:
#	packages/core/src/trace-finalizer.ts
#	packages/core/tests/trace-finalizer.test.ts
#	packages/service/README.md
@Winify
Winify merged commit 5fa1424 into main Nov 26, 2026
17 checks passed
@Winify
Winify deleted the otel/2-telemetry-mode 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