Skip to content

Telemetry: instrument startup path (activation, remote setup, CLI binary) #904

@EhabY

Description

@EhabY

Part of the Telemetry Phase A rollout. See the RFC in Linear: #849.

Instruments the startup path from extension activation through workspace readiness.

Implementation PR: #943.

Events

  • activation with result, authState, measurement durationMs.
    • Does not include activation phase properties.
  • activation.deployment_init for stored deployment initialization, with result, authState, measurement durationMs.
    • This preserves the existing fire-and-forget initialization behavior.
  • remote.setup (parent) with result, measurement durationMs.
    • Wrapped in TelemetryService.trace("remote.setup", ...) so all child phases share a traceId.
  • Remote setup phases emit as hierarchical child events, not as remote.setup.phase with a phase property:
    • remote.setup.auth_retrieval
    • remote.setup.workspace_lookup
    • remote.setup.workspace_ready
    • remote.setup.agent_ready
    • remote.setup.ssh_config_write
    • Each child event includes result, measurement durationMs, shared traceId, and parentEventId.
  • cli.download with result, reason (missing, version_mismatch), measurement durationMs.
    • downloadedBytes is emitted when response body bytes are written, including failed downloads that wrote a partial body.
    • HTTP 304 emits cli.download but omits downloadedBytes because no response body bytes are written.
    • There is no true forced path in the current CLI manager flow.
  • cli.verify with result, measurement durationMs.

Sites

  • src/extension.ts activation function and stored deployment initialization.
  • src/remote/remote.ts setup flow.
  • src/core/cliManager.ts download and verify paths.
  • src/instrumentation/activation.ts and src/instrumentation/remoteSetup.ts keep startup instrumentation helpers out of the main flows.
  • src/telemetry/span.ts and src/telemetry/service.ts provide span-owned property/measurement mutation for values discovered during traced work.

Tests

  • Use a TestSink injected via the service container.
  • Happy path emits the expected event names.
  • Remote phase events share a traceId with the parent and include parentEventId.
  • Mid-phase failure emits error on the failing phase and success on prior phases.
  • cli.download emits downloadedBytes for HTTP 200 downloads, includes partial bytes on failed downloads after bytes were written, and omits it for HTTP 304.
  • cli.verify failure emits the correct error fields.
  • Span-owned mutations are included in emitted events, and later caller-owned object mutations are not observed.

Depends on #900, #902.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions