docs(telemetry): add instrumentation conventions, align telemetry to them#996
Merged
Conversation
13ac79c to
df89efa
Compare
This was referenced Jun 9, 2026
df89efa to
ca8c7ec
Compare
andrewdennis117
approved these changes
Jun 10, 2026
…e keys Add src/instrumentation/CONVENTIONS.md documenting how telemetry is structured (explicit span threading, imperative setProperty, event/attribute naming, namespace grouping, properties vs measurements) and link it from CONTRIBUTING. Align existing instrumentation with the OTel naming convention: - rename caller-supplied property/measurement keys from camelCase to snake_case (auth, ssh, workspace, activation, websocket, cli.download); - strip unit suffixes from exported metric names into the OTLP unit field (latency_ms -> metric latency, unit ms) so Prometheus suffixes cleanly; - group the token-refresh span under its namespace (auth.token_refreshed -> auth.token_refresh.completed) next to auth.token_refresh.deduped. Framework-managed result/durationMs are left unchanged.
- rename the trace outcome hook fail() -> error() and the category fetch_failed -> fetch_error to match the recordError vocabulary - name count measurements <entity>.count (agent.count, workspace.count, event.count, interval.count) per OTel, replacing flat _count keys - set error.type on auth error spans (login/logout exceptions, auth_failed) and split auth outcomes so errors carry error.type, aborts carry reason - fold the general telemetry review findings into CONVENTIONS.md and trim for conciseness
32dddf7 to
e1eb693
Compare
…udit - rename command.invoked commandId -> command_id and CliCacheSource values to snake_case (file_path, not_found) - lowercase ConnectionState values on connection.state_transitioned; rename the caller-set result key on connection.reconnect_resolved to outcome so result stays framework-managed - thrown aborts mark spans aborted instead of error.type="aborted" (workspace.open, dev container open, credential store/clear) - type the diagnostic export format as ExportFormat, wrap auth.session_lookup in AuthTelemetry, resolve _seconds measurement suffixes to an OTLP unit
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Establishes a shared style for local telemetry instrumentation and brings every existing event into line with it.
src/instrumentation/CONVENTIONS.md(linked fromCONTRIBUTING.md) covering the framework vs per-domain-instrumentation split, threading (spans passed explicitly, attributes set imperatively viasetProperty, never return a value purely to log it), naming per the OTel convention, properties vs measurements, outcome/error/abort semantics, and secret safety.cache_source,workspace_name,command_id, …); enumerated values are lowercase snake_case unions (file_path/not_found,idle/connecting/… connection states); counts are named<entity>.count(agent.count,workspace.count); unit suffixes (_ms,_seconds,_mbits) resolve into the OTLP unit field so Prometheus suffixes cleanly. Framework-managedresult/durationMsare left as-is.resultstays framework-managed — the caller-set key onconnection.reconnect_resolvedbecomes a domainoutcome; thrown aborts mark spans aborted instead of recordingerror.type="aborted"(workspace open, dev containers, credential store/clear); errors carryerror.type, aborts carryreason/abort_stage, never both.auth.session_lookupmoves behindAuthTelemetry.traceSessionLookup, and the diagnostic exportformatproperty is typed as the closedExportFormatunion.Why
Telemetry is local-only and unreleased, so unifying the naming now is free. Merging this first gives the other telemetry branches a conformant base to rebase onto and a doc to follow.