Skip to content

feat(telemetry): add export command#953

Merged
EhabY merged 3 commits into
mainfrom
feat/issue-903-export-telemetry
Jun 4, 2026
Merged

feat(telemetry): add export command#953
EhabY merged 3 commits into
mainfrom
feat/issue-903-export-telemetry

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented May 13, 2026

Summary

  • add the coder.exportTelemetry command UI flow
  • register the command through CommandManager and package contributions
  • connect date-range selection, format selection, save dialog, export progress, and telemetry flushing

Closes #903.
Follow-up: #952 tracks adding recent local telemetry to support bundles.

Stack: 4 / 4. Base: #961.

Review follow-up

  • adds TelemetryService.flush()
  • flushes buffered local telemetry before discovering and reading telemetry files so recent events are included

Generated by Coder Agents.

@EhabY EhabY self-assigned this May 13, 2026
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 35eba99 to 821a950 Compare May 13, 2026 14:37
@EhabY EhabY force-pushed the feat/issue-906-auth-workspace-telemetry branch 5 times, most recently from 18ab98f to 5523f85 Compare May 15, 2026 10:01
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 821a950 to 728e014 Compare May 15, 2026 10:06
@EhabY EhabY changed the base branch from feat/issue-906-auth-workspace-telemetry to main May 15, 2026 10:06
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 728e014 to c450036 Compare May 17, 2026 17:09
@EhabY EhabY changed the title feat(telemetry): export local telemetry feat(telemetry): add export command May 17, 2026
@EhabY EhabY changed the base branch from main to feat/issue-903-export-telemetry-otlp-writer May 17, 2026 17:10
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from c450036 to 4daf2f8 Compare May 17, 2026 19:42
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from ab7dcf4 to acadd7e Compare May 17, 2026 19:42
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 4daf2f8 to 9534418 Compare May 18, 2026 17:03
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch 5 times, most recently from 539131f to fe6675e Compare May 20, 2026 10:29
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch 2 times, most recently from 25db18c to d70fc4b Compare May 20, 2026 10:45
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch 2 times, most recently from 55cccf2 to 71bcce7 Compare May 21, 2026 09:55
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch 2 times, most recently from e762a74 to 1a94594 Compare May 21, 2026 10:33
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from 7ce5f22 to d9f955a Compare May 21, 2026 15:14
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 1a94594 to 5439875 Compare May 21, 2026 15:15
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from d9f955a to f7308bf Compare May 21, 2026 16:00
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 5bae441 to e3bdba2 Compare May 26, 2026 20:35
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from 593ee03 to d8aa467 Compare May 26, 2026 20:37
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch 2 times, most recently from 227c58d to 581f2a3 Compare May 26, 2026 21:31
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from d8aa467 to 4929d92 Compare May 26, 2026 22:19
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 581f2a3 to 31ddd07 Compare May 26, 2026 22:19
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from 4929d92 to 22d73a9 Compare May 26, 2026 22:27
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 31ddd07 to 7416865 Compare May 26, 2026 22:27
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from 22d73a9 to addc6b9 Compare May 31, 2026 11:51
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 7416865 to d877986 Compare May 31, 2026 12:29
@EhabY EhabY requested a review from DanielleMaywood May 31, 2026 12:32
Comment thread test/mocks/vscode.runtime.ts
Comment thread src/telemetry/export/command.ts Outdated
Comment thread src/telemetry/export/command.ts Outdated
Comment thread src/telemetry/export/command.ts Outdated
Comment thread src/telemetry/export/command.ts Outdated
Comment thread test/unit/telemetry/export/command.test.ts Outdated
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry-otlp-writer branch from aa47ba1 to 3afed75 Compare June 2, 2026 17:13
Base automatically changed from feat/issue-903-export-telemetry-otlp-writer to main June 2, 2026 17:17
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from d877986 to 9b6bc7e Compare June 2, 2026 17:18
@EhabY EhabY requested a review from DanielleMaywood June 3, 2026 08:37
EhabY added 2 commits June 4, 2026 11:13
Adds the "Coder: Export Telemetry" command that lets users save
recorded telemetry as a JSON array or an OTLP/JSON zip. The flow
prompts for a date range, a format, and a save location, then streams
events from the on-disk sink through the chosen writer inside a
cancellable progress notification.

TelemetryService gains public getContext() and flush() methods so the
command can attach an export-time snapshot to the OTLP zip and drain
pending events before listing files. #emit routes through getContext()
so the snapshot stays in sync with what events carry.

Flush and file-listing run inside withCancellableProgress so the
on-disk snapshot is taken right before streaming; the AbortSignal is
threaded through the event iterator and into the OTLP writer. Reveal
errors are swallowed locally so a missing revealFileInOS handler
(web/remote hosts) does not report "Telemetry export failed" after a
successful save. Writer failures show a single error notification
instead of re-throwing into the wrapping command.invoked trace (which
would leak the user's chosen save path via buildErrorBlock). Prompts
set ignoreFocusOut so an accidental focus loss does not silently
abort, and the custom-date prompt states the current UTC date
explicitly. The empty-events case removes the empty output file and
shows an info notification.

Adds unit tests for command orchestration, TelemetryService.getContext
/ flush, plus a Uri.fsPath getter on the vscode test mock so fsPath
template-literal interpolations stop rendering "undefined".
@EhabY EhabY force-pushed the feat/issue-903-export-telemetry branch from 1d897e9 to 738d19a Compare June 4, 2026 08:15
…peline

Separate the export command into focused modules: a VS Code shell
(command.ts), input gathering (prompts.ts), and a UI-free orchestration
pipeline (pipeline.ts). Unify the JSON and OTLP writers behind a single
ExportWriter contract selected via createExportWriter, so the pipeline is
format-agnostic and ExportRuntime carries one cleanup callback.

Move empty-export cleanup out of the shell into the pipeline, make
writeAtomically's cleanup callback optional, and polish notifications
(proper pluralization, one clear empty-state message).

Rewrite the tests to mock only each module's real seam, drop side-effect
logging assertions in favor of behavior, and add focused pipeline,
prompts, and writer-factory suites.
@EhabY EhabY merged commit bea4059 into main Jun 4, 2026
13 checks passed
@EhabY EhabY deleted the feat/issue-903-export-telemetry branch June 4, 2026 12:43
EhabY added a commit that referenced this pull request Jun 4, 2026
Follow-up hardening on top of the Coder telemetry export command (#953):

- Surface a non-blocking warning when the pre-export flush does not fully
  succeed, so a successful-looking export no longer hides missing events.
- Add a self-describing manifest.json to OTLP/JSON exports: manifest and
  telemetry schema versions, date range, source file and event counts, and
  per-signal record counts.
- Make JSON exports cancellable and reject non-file save destinations.
- Version telemetry rows with schema_version and export span logs as linked
  OTLP log records.
- Harden HTTP route normalization for telemetry.
- Assert the exporter resource carries per-event provenance, tighten
  comments, and remove em-dashes from comments and test names.
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.

Telemetry: coder.exportTelemetry command (Logs, Traces, and Metrics OTLP/JSON)

2 participants