feat(server): wire sampler hot-reload callback (ADR-0023 Phase 3, sub-phase 3.3) #49

Merged
arcodange merged 1 commits from feat/adr-0023-phase3c-server-wiring into main 2026-05-05 09:42:39 +02:00
Owner

Closes ADR-0023 hot-reload Phase 3 (telemetry sampler). Final sub-phase of the 3-PR sequence per the Mistral-produced phase plan (Q-037). Wires the SamplerReconfigureCallback in Run() so file changes to telemetry.sampler.type/ratio trigger ReconfigureTracerProvider, swap the global, drain the old. ADR-0023 status updated to Phase 1+2+3 Implemented. api.v2_enabled remains explicitly deferred (router refactor needed). Race-clean on touched packages, full BDD green.

Closes ADR-0023 hot-reload Phase 3 (telemetry sampler). Final sub-phase of the 3-PR sequence per the Mistral-produced phase plan (Q-037). Wires the SamplerReconfigureCallback in Run() so file changes to telemetry.sampler.type/ratio trigger ReconfigureTracerProvider, swap the global, drain the old. ADR-0023 status updated to Phase 1+2+3 Implemented. api.v2_enabled remains explicitly deferred (router refactor needed). Race-clean on touched packages, full BDD green.
arcodange added 1 commit 2026-05-05 09:42:32 +02:00
Closes ADR-0023 hot-reload Phase 3 (telemetry sampler). Last sub-phase
of the 3-PR sequence: 3.1 = ReconfigureTracerProvider in pkg/telemetry
(PR #45), 3.2 = sampler callback plumbing in pkg/config (in main via
PR #47 race-merge — see Q-038 in mistral-quirks.md), 3.3 = wire it in
pkg/server.Run (this PR).

Implementation:
- Capture telemetrySetup pointer (was a local) so it outlives initial
  setup and the sampler callback can mutate it.
- After WatchAndApply registration, register a callback that:
  1. Mutates SamplerType/SamplerRatio on the captured Setup
  2. Calls ReconfigureTracerProvider (which builds the new TP, swaps
     the global, drains the old)
  3. Updates s.tracerProvider so graceful shutdown still drains the
     correct provider.
- Callback only registered if telemetrySetup != nil (telemetry was
  successfully initialized at startup; hot-reloading telemetry-on is
  out of scope per ADR-0023).

ADR-0023 status updated: Phase 1+2+3 Implemented. api.v2_enabled
remains explicitly deferred (router refactor needed; separate ADR).

Race detector clean on touched packages. Full BDD suite green.
arcodange merged commit 92a8027dd4 into main 2026-05-05 09:42:39 +02:00
arcodange deleted branch feat/adr-0023-phase3c-server-wiring 2026-05-05 09:42:39 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: arcodange/dance-lessons-coach#49