|
9 | 9 | "context" |
10 | 10 | "fmt" |
11 | 11 | "io" |
12 | | - "math" |
13 | 12 | "net/http" |
14 | 13 | "os" |
15 | 14 | "path/filepath" |
@@ -1164,12 +1163,7 @@ func (i *Ingester) LabelValues(ctx context.Context, req *client.LabelValuesReque |
1164 | 1163 | return &client.LabelValuesResponse{}, nil |
1165 | 1164 | } |
1166 | 1165 |
|
1167 | | - mint, maxt, err := metadataQueryRange(startTimestampMs, endTimestampMs, db) |
1168 | | - if err != nil { |
1169 | | - return nil, err |
1170 | | - } |
1171 | | - |
1172 | | - q, err := db.Querier(ctx, mint, maxt) |
| 1166 | + q, err := db.Querier(ctx, startTimestampMs, endTimestampMs) |
1173 | 1167 | if err != nil { |
1174 | 1168 | return nil, err |
1175 | 1169 | } |
@@ -1205,11 +1199,6 @@ func (i *Ingester) LabelNames(ctx context.Context, req *client.LabelNamesRequest |
1205 | 1199 | return nil, err |
1206 | 1200 | } |
1207 | 1201 |
|
1208 | | - mint, maxt, err = metadataQueryRange(mint, maxt, db) |
1209 | | - if err != nil { |
1210 | | - return nil, err |
1211 | | - } |
1212 | | - |
1213 | 1202 | q, err := db.Querier(ctx, mint, maxt) |
1214 | 1203 | if err != nil { |
1215 | 1204 | return nil, err |
@@ -1247,11 +1236,7 @@ func (i *Ingester) MetricsForLabelMatchers(ctx context.Context, req *client.Metr |
1247 | 1236 | return nil, err |
1248 | 1237 | } |
1249 | 1238 |
|
1250 | | - mint, maxt, err := metadataQueryRange(req.StartTimestampMs, req.EndTimestampMs, db) |
1251 | | - if err != nil { |
1252 | | - return nil, err |
1253 | | - } |
1254 | | - |
| 1239 | + mint, maxt := req.StartTimestampMs, req.EndTimestampMs |
1255 | 1240 | q, err := db.Querier(ctx, mint, maxt) |
1256 | 1241 | if err != nil { |
1257 | 1242 | return nil, err |
@@ -2370,33 +2355,6 @@ func (i *Ingester) FlushHandler(w http.ResponseWriter, r *http.Request) { |
2370 | 2355 | w.WriteHeader(http.StatusNoContent) |
2371 | 2356 | } |
2372 | 2357 |
|
2373 | | -// metadataQueryRange returns the best range to query for metadata queries based on the timerange in the ingester. |
2374 | | -func metadataQueryRange(queryStart, queryEnd int64, db *userTSDB) (mint, maxt int64, err error) { |
2375 | | - // Ingesters are run with limited retention and we don't support querying the store-gateway for labels yet. |
2376 | | - // This means if someone loads a dashboard that is outside the range of the ingester, and we only return the |
2377 | | - // data for the timerange requested (which will be empty), the dashboards will break. To fix this we should |
2378 | | - // return the "head block" range until we can query the store-gateway. |
2379 | | - |
2380 | | - // Now the question would be what to do when the query is partially in the ingester range. I would err on the side |
2381 | | - // of caution and query the entire db, as I can't think of a good way to query the head + the overlapping range. |
2382 | | - mint, maxt = queryStart, queryEnd |
2383 | | - |
2384 | | - lowestTs, err := db.StartTime() |
2385 | | - if err != nil { |
2386 | | - return mint, maxt, err |
2387 | | - } |
2388 | | - |
2389 | | - // Completely outside. |
2390 | | - if queryEnd < lowestTs { |
2391 | | - mint, maxt = db.Head().MinTime(), db.Head().MaxTime() |
2392 | | - } else if queryStart < lowestTs { |
2393 | | - // Partially inside. |
2394 | | - mint, maxt = 0, math.MaxInt64 |
2395 | | - } |
2396 | | - |
2397 | | - return |
2398 | | -} |
2399 | | - |
2400 | 2358 | func wrappedTSDBIngestErr(ingestErr error, timestamp model.Time, labels []mimirpb.LabelAdapter) error { |
2401 | 2359 | if ingestErr == nil { |
2402 | 2360 | return nil |
|
0 commit comments