Skip to content

feat: export a span for every dev command - #42

Merged
StevenTCramer merged 5 commits into
masterfrom
task/029-enable-dev-cli-telemetry-with-usetelemetry
Nov 8, 2026
Merged

StevenTCramer merged 5 commits into
masterfrom
task/029-enable-dev-cli-telemetry-with-usetelemetry

Conversation

@StevenTCramer

Copy link
Copy Markdown
Contributor

Summary

tools/dev-cli/dev.cs calls UseTelemetry with the literal service name timewarp-source-generators-dev. IncomingTraceContext.Restore() wraps RunAsync. The file matches timewarp-nuru tools/dev-cli/endpoints/incoming-trace-context.cs. A search of *.cs found no ActivitySource, so none is registered. tools/dev-cli/telemetry.md names OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, TRACEPARENT, TRACESTATE, and OTEL_EXPORTER_OTLP_PROTOCOL. This repo's workflow command does not emit stage spans, so the doc does not copy the timewarp-nuru stage table.

self-install failed once with MSB3030 because repo-wide GenerateDocumentationFile made the AOT publish look for bin/release/dev.xml. tools/dev-cli/Directory.Build.props now sets GenerateDocumentationFile to false, matching timewarp-terminal. The retry installed bin/dev (ELF x86-64).

./bin/dev --capabilities exited 0 and listed build, test, verify-samples, workflow, check-version, clean, release, and self-install. ./bin/dev build exited 0 (Release, 0 warnings, 0 errors). ./bin/dev --help with the endpoint unset sent nothing to the collector.

A local OTLP HTTP listener on 127.0.0.1:14318 received exports from that AOT binary with OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf set. The check-version span (DevCli route) and the build span both used service timewarp-source-generators-dev and source TimeWarp.Nuru.Behavior, and each had a nuru.behavior.commands.duration metric. Both trace payloads contained trace id 02902902902902902902902902902902 and parent span id b029b029b029b029 from TRACEPARENT. check-version exited 1 because version 1.0.0-beta.11 is already published; the span still arrived.

ganda repo audit reported one advisory (vscode-window-icon). ganda repo audit --fix wrote a gitignored .vscode/settings.json window title and re-ran self-install. The follow-up audit passed 37 checks, failed 0, skipped 3.

Test plan

Smoke: from the repo root, point OTEL_EXPORTER_OTLP_ENDPOINT at an HTTP protobuf collector (for example http://127.0.0.1:14318), set OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf and TRACEPARENT=00-02902902902902902902902902902902-b029b029b029b029-01, then run ./bin/dev build.

Expect: the command exits 0 and prints Build completed successfully! with 0 warnings. The collector receives a /v1/traces payload whose service name is timewarp-source-generators-dev, whose span name is build, whose activity source is TimeWarp.Nuru.Behavior, and whose bytes include that trace id and parent span id. A nuru.behavior.commands.duration metric for build arrives on /v1/metrics. With OTEL_EXPORTER_OTLP_ENDPOINT unset, the same command exports nothing.

Kanban task 029
Session: 01a1bc72-7aef-7672-80f6-714e4eb5efc4

Fleet walks need to see which dev commands are slow. UseTelemetry opts this CLI in at compile time, and TRACEPARENT is restored so those spans nest under the caller. Export stays off unless an OTLP endpoint is set. XML docs are off for this runfile because AOT publish otherwise fails looking for dev.xml.
@StevenTCramer
StevenTCramer merged commit 139ab1b into master Nov 8, 2026
1 check passed
@StevenTCramer
StevenTCramer deleted the task/029-enable-dev-cli-telemetry-with-usetelemetry branch November 8, 2026 18:58
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.

1 participant