Skip to content

Commit

Permalink
fix: Restore /config endpoint and correct handlerFunc for buildinfo (#…
Browse files Browse the repository at this point in the history
…4027)

As far as I can tell from reading the "next" documentation, the
/loki/api/v1/status/buildinfo endpoint should return the build
information. The /version endpoint is also listed further down in the
documentation but from the code prior to this change, it looks like it
should perform the same function as buildinfo endpoint so I have
removed it.

I've updated the documentation to reflect my changes.

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
  • Loading branch information
jdbaldry authored Jul 22, 2021
1 parent bfb24e6 commit e22e666
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions docs/sources/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ These endpoints are exposed by all components:
- [`GET /ready`](#get-ready)
- [`GET /metrics`](#get-metrics)
- [`GET /config`](#get-config)
- [`GET /loki/api/v1/status/buildinfo`](#get-buildinfo)
- [`GET /loki/api/v1/status/buildinfo`](#get-lokiapiv1statusbuildinfo)

These endpoints are exposed by the querier and the frontend:

Expand Down Expand Up @@ -824,12 +824,10 @@ 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 buildinfo`
## `GET /loki/api/v1/status/buildinfo`

`/loki/api/v1/status/buildinfo` exposes the build information in a JSON object. The fields are `version`, `revision`, `branch`, `buildDate`, `buildUser`, and `goVersion`.

In microservices mode, the `/version` endpoint is exposed by all components.

## Series

The Series API is available under the following:
Expand Down
4 changes: 2 additions & 2 deletions pkg/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ func (t *Loki) Run() error {
t.Server.HTTP.Path("/ready").Handler(t.readyHandler(sm))

// This adds a way to see the config and the changes compared to the defaults
t.Server.HTTP.Path("/loki/api/v1/status/buildinfo").HandlerFunc(configHandler(t.Cfg, newDefaultConfig()))
t.Server.HTTP.Path("/config").HandlerFunc(configHandler(t.Cfg, newDefaultConfig()))

// Each component serves its version.
t.Server.HTTP.Path("/version").HandlerFunc(versionHandler())
t.Server.HTTP.Path("/loki/api/v1/status/buildinfo").HandlerFunc(versionHandler())

t.Server.HTTP.Path("/debug/fgprof").Handler(fgprof.Handler())

Expand Down

0 comments on commit e22e666

Please sign in to comment.