Repository navigation
feat(observability): wire OpenTelemetry tracing+metrics across all Go binaries (ADR-0782) - #191
Conversation
a0bfc9a to
76e0134
Compare
|
Contaminated (178 files) — needs reconstruction, skipping rebase per session policy |
|
Closing as part of marathon cleanup 2026-05-31 (150 PRs merged today). Content likely superseded by sibling merges. Reopen if specific finding still needs work; bigger PRs preferred going forward per session feedback. |
… binaries (ADR-0782) Add OTel span instrumentation across all four VMAFX Go binaries (vmafx-controller, vmafx-node, vmafx-server, vmafx-mcp). Rebased onto master; keeps existing InitOTel API (ADR-0927), integrates ADR-0782 instruments as a pure addition. Span coverage: - vmafx.job.submit: controller SubmitJob gRPC handler (grpc_server.go) - vmafx.scoring / vmafx.frame.extraction: node scoring pipeline - vmafx.onnx.inference: AI path on vmafx-node OTel metrics (pkg/observability/otel_instruments.go, new): - vmafx.jobs.queued / vmafx.jobs.in_flight (UpDownCounters) - vmafx.score_latency_ms (histogram, p50/p99 buckets) - vmafx.frames_per_second / vmafx.gpu_utilization Prometheus additions to pkg/observability.Metrics: - JobsSubmitted / JobsCompleted / JobsFailed struct fields added (missing on master, causing compile failure — supersedes PR #534) Infrastructure: - go.mod/go.sum: fix tab-concatenated lines (pre-existing corruption); add modernc.org/sqlite v1.51.0 (required by vmafx-controller/queue) - cmd/vmafx-controller/queue: add Depth() method (QueueDepthProvider) - deploy/grafana/vmafx-overview.json: Grafana dashboard (new) - deploy/helm/vmafx: optional otel-collector sidecar + values.yaml - docs/observability/otel.md: quick-start, env vars, span names, metrics - ADR-0782; changelog fragment; rebase-notes.md entry All OTel init is non-fatal: missing OTLP collector never blocks startup. go build ./cmd/... and go vet ./cmd/... (exc. pre-existing stale executor_test.go API mismatch in vmafx-node) pass cleanly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
76e0134 to
d0b4712
Compare
There was a problem hiding this comment.
Pull request overview
This PR rolls out OpenTelemetry-based observability across the VMAFX Go services, adding a shared instrumentation surface (span names/attrs + metric instruments), wiring OTel init into the binaries, and shipping Helm/Grafana/docs updates to support deployment and visualization.
Changes:
- Add canonical OTel span/attribute definitions and OTel metric instrument registration helpers in
pkg/observability. - Initialize OTel in
vmafx-server,vmafx-node, andvmafx-mcp; add spans around controller submit and node scoring/AI execution paths. - Add Helm values + ConfigMap for an optional collector sidecar, plus docs/ADR/changelog and a Grafana dashboard.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/observability/otel_instruments.go | New shared constants and helpers for spans and OTel-native metric instruments. |
| pkg/observability/observability.go | Extends Prometheus Metrics with controller job lifecycle counters. |
| cmd/vmafx-controller/grpc_server.go | Adds vmafx.job.submit span around enqueue path. |
| cmd/vmafx-node/executor.go | Adds spans for scoring, frame extraction, and ONNX inference paths. |
| cmd/vmafx-node/main.go | Boots OTel early in node startup. |
| cmd/vmafx-server/main.go | Boots OTel early in server startup. |
| cmd/vmafx-mcp/main.go | Boots OTel early in MCP startup. |
| cmd/vmafx-controller/queue/queue.go | Adds Depth() convenience method (but comment currently references a nonexistent interface). |
| cmd/vmafx-controller/main.go | Updates file header ADR list to include ADR-0782. |
| deploy/helm/vmafx/values.yaml | Adds otelCollector configuration block and default collector config (currently mismatched to exporter protocol). |
| deploy/helm/vmafx/templates/otel-collector-sidecar.yaml | New ConfigMap template for collector config when enabled. |
| deploy/grafana/vmafx-overview.json | New Grafana dashboard (currently references some Prometheus metric names that aren’t registered). |
| docs/observability/otel.md | New operator-facing OTel setup docs (currently mismatched to the repo’s HTTP-based InitOTel wiring). |
| docs/adr/0782-otel-tracing.md | New ADR describing OTel rollout (currently mismatched to InitOTel protocol/signature). |
| docs/adr/README.md | Registers ADR-0782 in the ADR index. |
| docs/rebase-notes.md | Notes rebase impact and touched files for the rollout. |
| changelog.d/added/otel-tracing-0782.md | Changelog entry for OTel tracing/metrics rollout (currently lists nonexistent Prometheus gauge names). |
| go.mod | Fixes tab-concatenation corruption and adds indirect deps (incl. modernc.org/sqlite chain). |
| go.sum | Fixes tab-concatenation corruption and adds missing sums for new deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Depth satisfies observability.QueueDepthProvider (ADR-0782). | ||
| // Returns the current number of PENDING jobs — equivalent to PendingCount. | ||
| func (q *SQLiteQueue) Depth() int { return q.PendingCount() } |
| VMAFX exports distributed traces and metrics via the OpenTelemetry SDK | ||
| (v1.44) over OTLP/gRPC. All four Go binaries participate: | ||
| `vmafx-controller`, `vmafx-node`, `vmafx-server`, and `vmafx-mcp`. |
| docker run -p 4317:4317 -p 16686:16686 \ | ||
| jaegertracing/all-in-one:latest | ||
|
|
||
| # Run vmafx-controller with tracing enabled | ||
| OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317 \ | ||
| ./vmafx-controller --port 8080 |
| The sidecar listens on `localhost:4317` inside the pod; the VMAFX binary | ||
| connects there automatically (the default endpoint matches). | ||
|
|
|
|
||
| | Variable | Default | Description | | ||
| | --- | --- | --- | | ||
| | `OTEL_EXPORTER_OTLP_ENDPOINT` | `localhost:4317` | OTLP/gRPC collector endpoint. Set to `""` to disable (no-op providers are used). | |
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: "0.0.0.0:4317" |
| "targets": [ | ||
| { | ||
| "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, | ||
| "expr": "vmafx_controller_jobs_queued", |
| "targets": [ | ||
| { | ||
| "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" }, | ||
| "expr": "vmafx_controller_nodes_active", |
| - **Prometheus additions**: `vmafx_controller_jobs_submitted_total`, | ||
| `vmafx_controller_jobs_completed_total`, `vmafx_controller_jobs_failed_total`, | ||
| `vmafx_controller_jobs_queued` (gauge), `vmafx_controller_nodes_active` (gauge). |
| JobsFailed prometheus.Counter | ||
| } | ||
|
|
||
| // NewMetrics registers and returns the vmafx-server Prometheus metrics. |
#534) (#534) The core fix (JobsSubmitted/Failed/Completed fields added to Metrics struct) was merged via PR #191 (feat(observability): wire OpenTelemetry). This commit adds the missing changelog fragment for PR #534 that was blocked by conflicts. Co-authored-by: Lusoris <lusoris@pm.me> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
binaries: `vmafx-controller`, `vmafx-node`, `vmafx-server`, `vmafx-mcp`.
`vmafx.onnx.inference`, `vmafx.encoder.dispatch`.
(histogram with p50/p99 buckets), `vmafx.frames_per_second`, `vmafx.gpu_utilization`.
`pkg/observability.Metrics` struct (supersedes PR fix(observability): add missing controller Prometheus fields (JobsSubmitted/Failed/Completed) #534 — fields were missing on master).
Rebase notes
This PR was rebased onto master (2026-06-03). It keeps master's `InitOTel`
signature (ADR-0927 HTTP exporters) and adds `otel_instruments.go` as a pure
new file with span names, attribute keys, `OTelMetrics` struct, and
`StartSpan`/`EndSpan` helpers.
Deliverables checklist (ADR-0108)
User-discoverable surface docs (ADR-0100 §r10)
State.md (ADR-0165 §r13)
no state.md impact: this PR opens no bugs and closes no bugs.
ffmpeg-patches (ADR-0186 §r14)
no ffmpeg-patches impact: no libvmaf C-API surface touched.
go build / go vet
`go build ./cmd/...` and `go vet ./cmd/...` (exc. pre-existing
`executor_test.go` stale API mismatch in `vmafx-node` present on master before
this PR) pass cleanly.
Key files
🤖 Generated with Claude Code