MCPcopy Index your code
hub / github.com/cortexproject/cortex / RegisterRoutesWithPrefix

Method RegisterRoutesWithPrefix

pkg/api/api.go:213–231  ·  view source on GitHub ↗
(prefix string, handler http.Handler, auth bool, methods ...string)

Source from the content-addressed store, hash-verified

211}
212
213func (a *API) RegisterRoutesWithPrefix(prefix string, handler http.Handler, auth bool, methods ...string) {
214 level.Debug(a.logger).Log("msg", "api: registering route", "methods", strings.Join(methods, ","), "prefix", prefix, "auth", auth)
215 if auth {
216 handler = a.AuthMiddleware.Wrap(handler)
217 }
218
219 if a.cfg.ResponseCompression {
220 handler = gzhttp.GzipHandler(handler)
221 }
222 if a.HTTPHeaderMiddleware != nil {
223 handler = a.HTTPHeaderMiddleware.Wrap(handler)
224 }
225
226 if len(methods) == 0 {
227 a.server.HTTP.PathPrefix(prefix).Handler(handler)
228 return
229 }
230 a.server.HTTP.PathPrefix(prefix).Methods(methods...).Handler(handler)
231}
232
233// RegisterAlertmanager registers endpoints associated with the alertmanager. It will only
234// serve endpoints using the legacy http-prefix if it is not run as a single binary.

Callers 1

RegisterAlertmanagerMethod · 0.95

Calls 3

JoinMethod · 0.80
WrapMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected