-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return build info under /loki/api/v1/status/buildinfo
.
#3972
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉. One small comment!
docs/sources/api/_index.md
Outdated
@@ -823,6 +824,12 @@ and the current are returned. A value of `defaults` returns the default configur | |||
|
|||
In microservices mode, the `/config` endpoint is exposed by all components. | |||
|
|||
## `GET /version` | |||
|
|||
`/version` exposes the build information in a JSON object. The fields are `version`, `revision ``build_date`, `build_user`, and `revision`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revision is repeated twice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but can we mimic the same path that Prometheus uses (GET /loki/api/v1/status/buildinfo
in our case)?
https://prometheus.io/docs/prometheus/latest/querying/api/#build-information
Nit: we can probably use the same version struct Prometheus uses.
/version
./loki/api/v1/status/buildinfo
.
pkg/util/build/build.go
Outdated
@@ -20,4 +21,5 @@ func init() { | |||
version.Branch = Branch | |||
version.BuildUser = BuildUser | |||
version.BuildDate = BuildDate | |||
version.GoVersion = "???" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I access the Go version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the runtime
package: https://golang.org/pkg/runtime/#Version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how Prometheus does it as well: https://github.com/prometheus/common/blob/main/version/info.go#L33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs look good to me.
What this PR does / why we need it:
This changes introduces the
/version
endpoint for all components. It returns the build info in JSON. This should ease debugging.Which issue(s) this PR fixes:
Fixes #3221
Checklist