Skip to content

Commit c5ab581

Browse files
committed
Move telemetry plan to plans/ with descriptive name
Renamed PLAN.md to plans/cli_mcp_telemetry_instrumentation_plan.md. Consolidated duplicate file change entries, added key source files reference table for implementer orientation. https://claude.ai/code/session_01Y2eJZgKG78nDyN6Uw2tWQx
1 parent 34ba04f commit c5ab581

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

PLAN.md renamed to plans/cli_mcp_telemetry_instrumentation_plan.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,19 +304,17 @@ Not in scope for this CLI PR, but documents the expected server-side changes:
304304

305305
## File Change Summary
306306

307-
| File | Change | Complexity |
308-
|------|--------|-----------|
309-
| `pkg/hookdeck/telemetry.go` | Add fields, invocation ID generator | Small |
310-
| `pkg/hookdeck/telemetry_test.go` | Update tests for new fields | Small |
311-
| `pkg/hookdeck/client.go` | Add `Telemetry` field, `WithTelemetry()`, update `PerformRequest` | Small |
312-
| `pkg/cmd/root.go` | Add `PersistentPreRun` with `initTelemetry()` | Small |
313-
| `pkg/cmd/connection.go` | Call `initTelemetry()` in existing `PersistentPreRun` | Trivial |
314-
| `pkg/gateway/mcp/server.go` | Capture MCP client info, store on Server struct | Small |
315-
| `pkg/gateway/mcp/tools.go` | Add telemetry wrapping in tool dispatch | Medium |
316-
| `pkg/hookdeck/sdkclient.go` | No changes needed (already reads singleton) | None |
317-
| `pkg/config/config.go` | Add `TelemetryDisabled` field, read from viper in `constructConfig()` | Small |
318-
| `pkg/hookdeck/telemetry.go` | Update `telemetryOptedOut()` to accept config flag; add `DetectEnvironment()` for CI detection; add `Environment` field | Small |
319-
| `pkg/hookdeck/client.go` | Add `TelemetryDisabled` field, thread through opt-out check | Small |
307+
| File | Change | Phase | Complexity |
308+
|------|--------|-------|-----------|
309+
| `pkg/hookdeck/telemetry.go` | Add `Source`, `Environment`, `InvocationID` fields; `NewInvocationID()` generator; `DetectEnvironment()` for CI; update `telemetryOptedOut()` to accept config flag | 1, 5 | Small |
310+
| `pkg/hookdeck/telemetry_test.go` | Update tests for new fields, opt-out with config flag, environment detection | 1, 5 | Small |
311+
| `pkg/hookdeck/client.go` | Add `Telemetry` field + `TelemetryDisabled` field; `WithTelemetry()` clone method; update `PerformRequest` to use per-request telemetry override and config-based opt-out | 2, 5 | Small |
312+
| `pkg/cmd/root.go` | Add `PersistentPreRun` with `initTelemetry()` helper | 1 | Small |
313+
| `pkg/cmd/connection.go` | Call `initTelemetry()` in existing `PersistentPreRun` | 1 | Trivial |
314+
| `pkg/gateway/mcp/server.go` | Capture MCP client info, store on Server struct | 2 | Small |
315+
| `pkg/gateway/mcp/tools.go` | Add telemetry wrapping in tool dispatch (central `WithTelemetry` per tool call) | 2 | Medium |
316+
| `pkg/hookdeck/sdkclient.go` | Add `TelemetryDisabled` field, thread through opt-out check | 5 | Small |
317+
| `pkg/config/config.go` | Add `TelemetryDisabled` field, read from viper in `constructConfig()` | 5 | Small |
320318

321319
## Risks and Edge Cases
322320

@@ -455,6 +453,22 @@ func DetectEnvironment() string {
455453

456454
This integrates cleanly with Phase 1's telemetry struct as a new `environment` field. Server-side, PostHog dashboards get two clean dimensions to slice by.
457455

456+
## Key Source Files
457+
458+
These are the files an implementer needs to read before starting:
459+
460+
| File | What it contains |
461+
|------|-----------------|
462+
| `pkg/hookdeck/telemetry.go` | `CLITelemetry` struct, singleton `GetTelemetryInstance()`, `getTelemetryHeader()`, `telemetryOptedOut()` — all telemetry logic lives here |
463+
| `pkg/hookdeck/client.go` | Internal HTTP client, `PerformRequest()` where telemetry header is set per-request (line ~107) |
464+
| `pkg/hookdeck/sdkclient.go` | `CreateSDKClient()` where telemetry header is baked in at construction (line ~39) |
465+
| `pkg/config/config.go` | `Config` struct, `InitConfig()`, `constructConfig()` with viper precedence chain, `getConfigPath()` for local/global config resolution |
466+
| `pkg/config/profile.go` | `Profile` struct, save/load/remove profile, field getter helpers |
467+
| `pkg/cmd/root.go` | Root cobra command, `cobra.OnInitialize` wiring, where `PersistentPreRun` should be added |
468+
| `pkg/cmd/connection.go` | Has its own `PersistentPreRun` (deprecation warning) — must be updated to call shared `initTelemetry()` |
469+
| `pkg/gateway/mcp/server.go` | MCP server setup, `Server.Run()`, session management |
470+
| `pkg/gateway/mcp/tools.go` | MCP tool dispatch — where per-tool-call telemetry wrapping goes |
471+
458472
## Testing Strategy
459473

460474
1. **Unit tests for telemetry struct**: Verify JSON serialization includes new fields

0 commit comments

Comments
 (0)