RegisterDistributor registers the endpoints associated with the distributor.
(d *distributor.Distributor, pushConfig distributor.Config, overrides *validation.Overrides, reg prometheus.Registerer)
| 284 | |
| 285 | // RegisterDistributor registers the endpoints associated with the distributor. |
| 286 | func (a *API) RegisterDistributor(d *distributor.Distributor, pushConfig distributor.Config, overrides *validation.Overrides, reg prometheus.Registerer) { |
| 287 | distributorpb.RegisterDistributorServer(a.server.GRPC, d) |
| 288 | |
| 289 | requestTotal := promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ |
| 290 | Namespace: "cortex", |
| 291 | Name: "distributor_push_requests_total", |
| 292 | Help: "Total number of push requests by type.", |
| 293 | }, []string{"type"}) |
| 294 | |
| 295 | a.RegisterRoute("/api/v1/push", push.Handler(pushConfig.RemoteWriteV2Enabled, pushConfig.AcceptUnknownRemoteWriteContentType, pushConfig.MaxRecvMsgSize, overrides, a.sourceIPs, a.cfg.wrapDistributorPush(d), requestTotal), true, "POST") |
| 296 | a.RegisterRoute("/api/v1/otlp/v1/metrics", push.OTLPHandler(pushConfig.OTLPMaxRecvMsgSize, overrides, pushConfig.OTLPConfig, a.sourceIPs, a.cfg.wrapDistributorPush(d), requestTotal), true, "POST") |
| 297 | |
| 298 | a.indexPage.AddLink(SectionAdminEndpoints, "/distributor/ring", "Distributor Ring Status") |
| 299 | a.indexPage.AddLink(SectionAdminEndpoints, "/distributor/all_user_stats", "Usage Statistics") |
| 300 | a.indexPage.AddLink(SectionAdminEndpoints, "/distributor/ha_tracker", "HA Tracking Status") |
| 301 | |
| 302 | a.RegisterRoute("/distributor/ring", d, false, "GET", "POST") |
| 303 | a.RegisterRoute("/distributor/all_user_stats", http.HandlerFunc(d.AllUserStatsHandler), false, "GET") |
| 304 | a.RegisterRoute("/distributor/ha_tracker", d.HATracker, false, "GET") |
| 305 | |
| 306 | // Legacy Routes |
| 307 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/push"), push.Handler(pushConfig.RemoteWriteV2Enabled, pushConfig.AcceptUnknownRemoteWriteContentType, pushConfig.MaxRecvMsgSize, overrides, a.sourceIPs, a.cfg.wrapDistributorPush(d), requestTotal), true, "POST") |
| 308 | a.RegisterRoute("/all_user_stats", http.HandlerFunc(d.AllUserStatsHandler), false, "GET") |
| 309 | a.RegisterRoute("/ha-tracker", d.HATracker, false, "GET") |
| 310 | } |
| 311 | |
| 312 | // Ingester is defined as an interface to allow for alternative implementations |
| 313 | // of ingesters to be passed into the API.RegisterIngester() method. |
no test coverage detected