-
Notifications
You must be signed in to change notification settings - Fork 2
Build Info & /version Endpoint #44
Copy link
Copy link
Labels
area/apiHTTP handlers, routing, middlewareHTTP handlers, routing, middlewarearea/observabilityMetrics, logs, traces, health, profilingMetrics, logs, traces, health, profilingdocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Activity
Metadata
Metadata
Assignees
Labels
area/apiHTTP handlers, routing, middlewareHTTP handlers, routing, middlewarearea/observabilityMetrics, logs, traces, health, profilingMetrics, logs, traces, health, profilingdocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Problem
When troubleshooting a deployed instance, it's currently difficult to know exactly which Git commit or version is running.
Proposed Solution
Use ldflags during the build process to inject the Version, Commit Hash, and Build Time into the binary. Expose this data via a public /version API endpoint and include it in the initial startup logs.
Current Status
MakefiledefinesVERSION_LDFLAGS := -X main.Version=$(VERSION) -X main.GitCommit=$(COMMIT) -X main.BuildTime=$(BUILD_TIME)and applies it on every build target (debug, release, cover).cmd/wavehouse/main.gologs the three values at startup (logger.Info("starting WaveHouse", "version", Version, "build_time", BuildTime, "git_commit", GitCommit))./versionHTTP endpoint not shipped. Remaining work.Alternatives Considered
None
Additional Context
For the endpoint, recommend returning a small JSON document with
version,git_commit,build_time, and (optionally)go_versionfromruntime.Version(). Wire it into the router alongside the existing health endpoints; no auth gate (the values are non-sensitive and already in logs).