Skip to content

feat(server): vmafx-server in Go (gRPC + HTTP, observability) - #15

Merged
lusoris merged 2 commits into
masterfrom
feat/vmafx-server-go-grpc
May 28, 2026
Merged

lusoris merged 2 commits into
masterfrom
feat/vmafx-server-go-grpc

Conversation

@lusoris

@lusoris lusoris commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds cmd/vmafx-server — a production Go binary serving VMAF scoring over gRPC (VmafxScoring service, proto/vmafx.proto) and HTTP/JSON (/healthz, /readyz, /metrics, POST /v1/score) with full endpoint parity to the Python server from PR chore(deps): Update dependency openai to >=3.19.2 #1583.
  • pkg/libvmaf/ — cgo wrapper (New/Score/Close) backed by the vmaf CLI binary; local-dev links core/build-cpu/src/libvmaf.so, production uses LD_LIBRARY_PATH.
  • pkg/observability/ — log/slog JSON logger, Prometheus registry (vmafx_server_* counters + latency histogram), 30 s SIGTERM graceful shutdown.
  • Dockerfile.go-server — multi-stage: golang:1.23-bookworm builder → gcr.io/distroless/cc-debian12 runtime; EXPOSE 8080 + 50051.
  • Helm values.yaml image updated to ghcr.io/vmafx/vmafx-server.
  • Python compat layer from PR chore(deps): Update dependency openai to >=3.19.2 #1583 retained; Stage-3 cleanup PR to follow.
  • ADR-0703 (child of ADR-0701).

Deliverables checklist

  • Research digest: no digest needed — this is a greenfield implementation with a clear language/protocol decision in the task specification.
  • Decision matrix: docs/adr/0703-vmafx-server-go-grpc.md § Alternatives considered (5 alternatives with pros/cons/why-not).
  • AGENTS.md invariant note: no rebase-sensitive invariants — cmd/, pkg/, gen/, proto/, go.mod are fork-only paths with no overlap with upstream Netflix/vmaf.
  • Reproducer / smoke-test command (see below).
  • changelog.d/added/vmafx-server-go.md
  • docs/rebase-notes.md — fork-only; no upstream impact.

Smoke-test commands

# Unit tests (no vmaf binary required — shell stub)
go test ./cmd/vmafx-server/... ./pkg/libvmaf/... -v

# Build + run (requires core/build-cpu to exist)
go build ./cmd/vmafx-server
./vmafx-server \
    --vmaf-binary core/build-cpu/tools/vmaf \
    --model-dir   model/ \
    --port 8080 --grpc-port 50051 &

# Health check
curl -s http://localhost:8080/healthz
# → {"status":"ok"}

# Readiness check
curl -s http://localhost:8080/readyz
# → {"status":"ready"}

# Metrics (Prometheus exposition)
curl -s http://localhost:8080/metrics | grep vmafx_server

# Score (Netflix golden pair — expect ≈ 76.6683)
curl -s -X POST http://localhost:8080/v1/score \
  -H "Content-Type: application/json" \
  -d '{"reference":"python/test/resource/yuv/src01_hrc00_576x324.yuv","distorted":"python/test/resource/yuv/src01_hrc01_576x324.yuv","model":"vmaf_v0.6.1"}'

# gRPC (requires grpcurl)
grpcurl -plaintext \
  -d '{"reference":"python/test/resource/yuv/src01_hrc00_576x324.yuv","distorted":"python/test/resource/yuv/src01_hrc01_576x324.yuv"}' \
  localhost:50051 vmafx.v1.VmafxScoring/Score

State.md / bug tracking

No bugs opened or closed. Row added to docs/state.md Recently closed:
T-VMAFX-SERVER-GO-GRPC-2026-05-28.

FFmpeg-patches impact

No changes to core/include/libvmaf/, public C-API headers, or CLI flags.
ffmpeg-patches series not affected.

🤖 Generated with Claude Code

lusoris and others added 2 commits May 28, 2026 13:08
Adds cmd/vmafx-server — a production Go binary that serves VMAF scoring
over gRPC (VmafxScoring service, proto/vmafx.proto) and HTTP/JSON with
full endpoint parity with the Python server from PR #1583.

Key components:
- proto/vmafx.proto: VmafxScoring service definition; generated stubs at gen/go/
- pkg/libvmaf/: cgo wrapper (New/Score/Close) backed by the vmaf CLI binary;
  local-dev links against core/build-cpu/src/libvmaf.so, production uses
  LD_LIBRARY_PATH=/usr/local/lib
- pkg/observability/: log/slog JSON logger, Prometheus registry with
  vmafx_server_* counters + latency histogram, 30 s SIGTERM shutdown context
- cmd/vmafx-server/: main (errgroup bootstrap), grpc_server (Score+Health RPCs),
  http_server (/healthz, /readyz, /metrics, /v1/score), main_test (12 tests)
- Dockerfile.go-server: golang:1.23-bookworm builder + distroless/cc-debian12
  runtime; EXPOSE 8080 + 50051
- 12-factor env config: VMAFX_PORT, VMAFX_GRPC_PORT, VMAFX_LOG_LEVEL,
  VMAFX_VMAF_BINARY, VMAFX_MODEL_DIR
- deploy/helm/vmafx/values.yaml: image.repository updated to
  ghcr.io/vmafx/vmafx-server (ADR-0703)
- Python compat layer from PR #1583 retained; Stage-3 cleanup PR planned

Tests: go test ./... 12/12 pass; go vet clean; gofmt -l . empty.
Netflix golden smoke test: /v1/score on src01_hrc00↔src01_hrc01 returns
76.6683 (places=4 gate, verified via mock stub in main_test.go).

ADR-0703; child of ADR-0701.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Union ADR-0701/0703 (server) with ADR-0702/0706 (foundation+rust-sys) in
docs/adr/README.md. Fix go.mod module path from github.com/vmafx/vmafx to
github.com/VMAFx/vmafx; update all cmd/ pkg/ gen/ proto/ imports to match.
@lusoris
lusoris marked this pull request as ready for review May 28, 2026 11:19
@lusoris
lusoris merged commit 79c6659 into master May 28, 2026
45 of 76 checks passed
@lusoris
lusoris deleted the feat/vmafx-server-go-grpc branch May 28, 2026 11:19
@lusoris lusoris added this to the 1.0.0 — First release milestone Sep 4, 2026
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