Skip to content

feat(fastdeploy): OpenTelemetry instrumentation for fast-deploy (deco.deploy.*) - #35

Open
hugo-ccabral wants to merge 5 commits into
mainfrom
feat/fastdeploy-otel-instrumentation
Open

feat(fastdeploy): OpenTelemetry instrumentation for fast-deploy (deco.deploy.*)#35
hugo-ccabral wants to merge 5 commits into
mainfrom
feat/fastdeploy-otel-instrumentation

Conversation

@hugo-ccabral

@hugo-ccabral hugo-ccabral commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Instruments the tanstack-kv fast-deploy pipeline with OpenTelemetry (traces +
metrics), following the deco o11y model (decocms/context 04_engineering/o11y
deco.deploy.*). Signals export to the in-cluster gateway collector and land
in ClickHouse/ClickStack + Grafana.

Fail-open: inert unless OTEL_EXPORTER_OTLP_ENDPOINT is set — no behavior
change without a collector.

What

  • internal/telemetry: opt-in OTLP SDK bootstrap; custom ID generator so the
    operator + syncer form one distributed trace; fast-deploy instruments.
  • Metrics (100%, alert source): deco.deploy.duration (Job created →
    terminal, incl. k8s setup), deco.deploy.schedule.duration (scheduling +
    cold start, from the Pod), deco.deploy.count{status}, deco.deploy.active.
    Labels site / status / target. Recorded once on the Syncing→terminal
    transition (guarded, no double-count).
  • Trace: mints a TRACEPARENT, injects it + the OTLP endpoint into the sync
    Job; emits deco.deploy root + deco.deploy.schedule child with explicit
    timestamps from the Job/Pod. The syncer (separate PR) continues the trace.
  • Docs: docs/fast-deploy-webhook.md §4 (activation) + docs/fast-deploy-dashboard.md (dashboard/alert spec).

Activate

Set on the operator (deco-operator SM secret, envFrom wires it):
OTEL_EXPORTER_OTLP_ENDPOINT=http://gateway-otlp.opentelemetry-collector:4317
(+ optional CLUSTER_NAME).

Paired PRs

  • decocms/infra_applications: decofile-syncer spans
  • decocms/context: deco.deploy.* conventions

Build, vet, and tests pass.

🤖 Generated with Claude Code


Summary by cubic

Adds OpenTelemetry traces and metrics to fast-deploy (deco.deploy.*) and exports to the in-cluster OTLP collector; inert unless OTEL_EXPORTER_OTLP_ENDPOINT is set. Propagates a TRACEPARENT and the OTLP endpoint to the sync Job so operator and syncer share one distributed trace, and ships an importable Grafana dashboard.

  • New Features

    • Opt-in OTel SDK bootstrap (traces + metrics) under internal/telemetry/*; non-fatal on init errors.
    • Metrics: deco.deploy.duration, deco.deploy.schedule.duration, deco.deploy.count{status}, deco.deploy.active with labels site, status, target; recorded once on the Syncing→terminal transition.
    • Traces: operator mints TRACEPARENT, injects it into Job env and deco.cx/traceparent; emits deco.deploy root and deco.deploy.schedule child with explicit timestamps; custom ID generator keeps operator + syncer in one trace.
    • Sync Job receives OTEL_EXPORTER_OTLP_ENDPOINT and optional CLUSTER_NAME so the syncer exports to the same collector.
    • Docs: activation in docs/fast-deploy-webhook.md; dashboard + alerts spec in docs/fast-deploy-dashboard.md; importable Grafana dashboard JSON in docs/fast-deploy-dashboard.json with example alert queries.
  • Migration

    • Set OTEL_EXPORTER_OTLP_ENDPOINT=http://gateway-otlp.opentelemetry-collector:4317 on the operator; optionally set CLUSTER_NAME.
    • No behavior change without the endpoint.

Written for commit edb9045. Summary will update on new commits.

Review in cubic

hugo-ccabral and others added 5 commits July 16, 2026 15:52
Add OTLP traces + metrics for the tanstack-kv fast-deploy pipeline, following
the deco o11y model (deco.deploy.*). Signals export to the in-cluster gateway
collector (OTEL_EXPORTER_OTLP_ENDPOINT) and land in ClickHouse/ClickStack.

- internal/telemetry: opt-in, fail-open OTel SDK bootstrap (no-op when no
  endpoint is set), custom ID generator so the operator + syncer form one
  distributed trace, and the fast-deploy instruments/recorders.
- Metrics (100%, alert source): deco.deploy.duration (end-to-end incl. k8s
  setup), deco.deploy.schedule.duration (scheduling + cold start, from the
  Pod), deco.deploy.count{status}, deco.deploy.active.
- Trace: operator mints a traceparent, injects it into the sync Job env +
  annotation, and emits root (deco.deploy) + schedule child spans with explicit
  timestamps derived from the Job/Pod. The syncer continues the same trace.
- Recording is guarded to the Syncing→terminal transition (no double count).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The syncer Job is created dynamically by the operator, so it can't get
OTEL_EXPORTER_OTLP_ENDPOINT from Helm. Propagate the operator's endpoint (and
CLUSTER_NAME) into the Job env so the syncer exports its spans to the same
in-cluster collector and joins the operator's trace. Gated on the endpoint
being set, so both stay no-ops without a collector.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ready-to-build panel + alert spec (build needs the Grafana MCP / live datasource).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant