Skip to content

Commit

Permalink
Merge pull request #35 from metalmatze/legacy-endpoints-verbs
Browse files Browse the repository at this point in the history
Add query and query_range as generic handlers forwarding all verbs
  • Loading branch information
metalmatze authored Apr 23, 2020
2 parents 77bda8c + ea31261 commit 1f9458d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ func New(logger log.Logger, reg *prometheus.Registry, opts ...Option) Server {
promhttp.InstrumentMetricHandler(reg, promhttp.HandlerFor(reg, promhttp.HandlerOpts{})).ServeHTTP(w, r)
})

{
// Legacy endpoints
r.Handle("/api/v1/query",
ins.newHandler("query_legacy", proxy.New(logger, "/api/v1", options.metricsReadEndpoint, options.proxyOptions...)),
)
r.Handle("/api/v1/query_range",
ins.newHandler("query_range_legacy", proxy.New(logger, "/api/v1", options.metricsReadEndpoint, options.proxyOptions...)),
)
}

if options.metricsUIEndpoint != nil {
uiPath := "/ui/metrics/v1"

Expand All @@ -93,10 +103,6 @@ func New(logger log.Logger, reg *prometheus.Registry, opts ...Option) Server {
}
}

r.Get("/api/v1/query",
ins.newHandler("query_legacy", proxy.New(logger, "/api/v1", options.metricsReadEndpoint, options.proxyOptions...)),
)

namespace := "/api/metrics/v1"
r.Route(namespace, func(r chi.Router) {
if options.metricsReadEndpoint != nil {
Expand Down

0 comments on commit 1f9458d

Please sign in to comment.