Skip to content

feat: export jussi_build_info on /metrics so the live build is verifiable - #271

Merged
ety001 merged 1 commit into
nextfrom
feat/build-info-metric
Sep 29, 2026
Merged

ety001 merged 1 commit into
nextfrom
feat/build-info-metric

Conversation

@ety001

@ety001 ety001 commented Sep 29, 2026

Copy link
Copy Markdown
Member

Why

/health and / redact source_commit / docker_tag to the literal "unknown" unless JUSSI_EXPOSE_VERSION=true, so a public deployment does not fingerprint itself. That literal is also what a build without CI build args produces, which means a redacted deployment and a metadata-less image look identical from outside — and there is currently no non-public channel that reports which commit is running.

What

  • internal/telemetry/buildinfo.go: new jussi_build_info{commit,tag} gauge (value always 1; the information is in the labels). SetBuildInfo resets first, so re-setting inside one process never leaves the previous build's labels exportable.
  • internal/app/app.go: publish it once at startup from the same SOURCE_COMMIT / DOCKER_TAG values the health handler already receives.
  • internal/handlers/health_test.go: pins the redaction contract and the JUSSI_EXPOSE_VERSION=true override.
  • Docs: docs/METRICS.md (new Build Metrics section, including why the metric and not /health), docs/CONFIGURATION.md, docs/AI-driver/07-errors-and-observability.md.

No change to the / and /health payloads, and no new dependency: only prometheus/testutil (part of client_golang) is used in tests.

Verification

  • go vet ./... and go test ./... -race -count=1 pass.

  • Real process run with the build metadata set: /metrics exposes

    jussi_build_info{commit="404bc29",tag="next-404bc29"} 1
    

    while /health keeps reporting "unknown" unless JUSSI_EXPOSE_VERSION=true.

Notes

/metrics keeps its existing access control (prometheus.localhost_only, then prometheus.allowed_ips), so deployments that keep the default redaction do not publish their build metadata anywhere new.

…able

/health and / redact source_commit/docker_tag to the literal "unknown"
unless JUSSI_EXPOSE_VERSION=true. That literal is the same string a build
without CI build args produces, so a redacted deployment and a
metadata-less image are indistinguishable from outside — and nothing
internal reports the running commit either.

Export the metadata on the access-restricted /metrics endpoint instead:
a new jussi_build_info{commit,tag} gauge, set once at startup from the
same SOURCE_COMMIT/DOCKER_TAG values the health handler receives. The
redaction behaviour of / and /health is unchanged, and there is no new
dependency beyond prometheus/testutil in tests.
@ety001
ety001 merged commit cac45f7 into next Sep 29, 2026
2 checks passed
@ety001
ety001 deleted the feat/build-info-metric branch September 29, 2026 15:50
ety001 added a commit that referenced this pull request Sep 30, 2026
…ss docs (#272)

Follow-ups from the audit of #271.

- The /metrics allowlist could not be configured from the environment:
  JUSSI_PROMETHEUS_ALLOWED_IPS was not bound anywhere, so a deployment
  that disables localhost_only had no way to restrict the endpoint — the
  variable was silently ignored and (because SetupRouter only mounts the
  whitelist middleware when the list is non-empty) no access control was
  applied at all. Bind it to prometheus.allowed_ips and split the value
  after unmarshal, mirroring JUSSI_SERVER_TRUSTED_PROXIES.
- The docs described /metrics as access-restricted. With
  localhost_only=false and an empty allowlist no middleware is mounted,
  so state the actual semantics in CONFIGURATION.md, METRICS.md and the
  agent-facing observability notes, and document the new variable.
- Add the tests this was missing: config env parsing, and the app wiring
  that publishes jussi_build_info (the unit test of SetBuildInfo cannot
  catch a dropped call in SetupRouter) — including that a non-loopback
  client is admitted when neither knob is set and rejected once an
  allowlist exists.
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