Skip to content
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

Merged
merged 8 commits into from
Jul 9, 2021

Conversation

jeschkies
Copy link
Contributor

@jeschkies jeschkies commented Jul 8, 2021

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

  • Documentation added
  • Tests updated

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Contributor

@kavirajk kavirajk left a 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!

@@ -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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revision is repeated twice!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link
Member

@owen-d owen-d left a 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.

@jeschkies jeschkies changed the title Return build info under /version. Return build info under /loki/api/v1/status/buildinfo. Jul 8, 2021
@@ -20,4 +21,5 @@ func init() {
version.Branch = Branch
version.BuildUser = BuildUser
version.BuildDate = BuildDate
version.GoVersion = "???"
Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@KMiller-Grafana KMiller-Grafana left a 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.

@owen-d owen-d merged commit af45204 into grafana:main Jul 9, 2021