stacklok / stacklok/toolhive

stacklok.build_info exports as stacklok_build_info_ratio (drop WithUnit("1") upstream)

Open
#6,170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

coremetrics.RegisterBuildInfo sets metric.WithUnit("1") (toolhive-core@v0.0.37/telemetry/metrics/buildinfo.go:50). The OTel Prometheus translator appends a unit suffix to a dimensionless gauge, so the metric exports as:

stacklok_build_info_ratio{commit="...",component="toolhive",version="..."} 1

Two problems:

  1. _ratio is semantically wrong. build_info is an identity gauge that always observes 1; the identity lives entirely in its labels. It is not a ratio. Prometheus convention for this shape is a bare *_build_info (go_build_info, node_exporter_build_info).
  2. The name is easy to get wrong in queries. A dashboard joining on stacklok_build_info returns empty. require.Contains(body, "stacklok_build_info") also passes on the suffixed name by substring, so a naive test asserts nothing — that bit us in #5956 (now anchored at line start).
Fix

Drop metric.WithUnit("1") in toolhive-core so the gauge exports unitless as stacklok_build_info, then bump the pin in toolhive and drop the (_ratio)? accommodation from the test regex and the docs note.

This cannot be fixed from the toolhive repo — RegisterBuildInfo lives in toolhive-core, so it needs a core release plus a pin bump here.

Interim

docs/observability.md documents the actual exported _ratio name so operators query something that exists. RFC §3.4 / AT #2 is satisfied either way (the gauge is present with component/version/commit); this is about the name customers will put in dashboards, so it's worth fixing before the vocabulary spreads.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RegisterBuildInfo in toolhive-core@v0.0.37/telemetry/metrics/buildinfo.go, then inspect the toolhive pin, the metric-name test regex, and docs/observability.md. The fix is complete when a core release without WithUnit("1") is pinned here, the test and documentation expect stacklok_build_info, and the exported gauge retains its component, version, and commit labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.