MCPcopy Create free account
hub / github.com/cortexproject/cortex / createPrometheusAPI

Function createPrometheusAPI

pkg/querier/error_translate_queryable_test.go:158–202  ·  view source on GitHub ↗
(q storage.SampleAndChunkQueryable, engine promql.QueryEngine)

Source from the content-addressed store, hash-verified

156}
157
158func createPrometheusAPI(q storage.SampleAndChunkQueryable, engine promql.QueryEngine) *route.Router {
159 api := v1.NewAPI(
160 engine,
161 q,
162 nil,
163 nil,
164 func(ctx context.Context) v1.ScrapePoolsRetriever { return nil },
165 func(context.Context) v1.TargetRetriever { return &DummyTargetRetriever{} },
166 func(context.Context) v1.AlertmanagerRetriever { return &DummyAlertmanagerRetriever{} },
167 func() config.Config { return config.Config{} },
168 map[string]string{}, // TODO: include configuration flags
169 v1.GlobalURLOptions{},
170 func(f http.HandlerFunc) http.HandlerFunc { return f },
171 nil, // Only needed for admin APIs.
172 "", // This is for snapshots, which is disabled when admin APIs are disabled. Hence empty.
173 false, // Disable admin APIs.
174 promslog.NewNopLogger(),
175 func(context.Context) v1.RulesRetriever { return &DummyRulesRetriever{} },
176 0, 0, 0, // Remote read samples and concurrency limit.
177 false,
178 regexp.MustCompile(".*"),
179 func() (v1.RuntimeInfo, error) { return v1.RuntimeInfo{}, errors.New("not implemented") },
180 &v1.PrometheusVersion{},
181 nil,
182 nil,
183 prometheus.DefaultGatherer,
184 nil,
185 nil,
186 false,
187 nil,
188 false,
189 false,
190 false,
191 false,
192 5*time.Minute,
193 false,
194 false,
195 nil,
196 )
197
198 promRouter := route.New().WithPrefix("/api/v1")
199 api.Register(promRouter)
200
201 return promRouter
202}
203
204type errorTestQueryable struct {
205 q storage.Querier

Callers 1

TestApiStatusCodesFunction · 0.85

Calls 1

RegisterMethod · 0.80

Tested by

no test coverage detected