(ctx context.Context, hints *storage.LabelHints, matchers ...*labels.Matcher)
| 263 | } |
| 264 | |
| 265 | func (q *distributorQuerier) LabelNames(ctx context.Context, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) { |
| 266 | partialDataEnabled := q.partialDataEnabled(ctx) |
| 267 | |
| 268 | if len(matchers) > 0 && !q.labelNamesMatchers { |
| 269 | return q.labelNamesWithMatchers(ctx, hints, partialDataEnabled, matchers...) |
| 270 | } |
| 271 | |
| 272 | log, ctx := spanlogger.New(ctx, "distributorQuerier.LabelNames") |
| 273 | defer log.Finish() |
| 274 | |
| 275 | var ( |
| 276 | ln []string |
| 277 | err error |
| 278 | ) |
| 279 | |
| 280 | if q.streamingMetadata { |
| 281 | ln, err = q.labelsWithRetry(ctx, func() ([]string, error) { |
| 282 | return q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...) |
| 283 | }) |
| 284 | } else { |
| 285 | ln, err = q.labelsWithRetry(ctx, func() ([]string, error) { |
| 286 | return q.distributor.LabelNames(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...) |
| 287 | }) |
| 288 | } |
| 289 | |
| 290 | if partialdata.IsPartialDataError(err) { |
| 291 | warnings := annotations.Annotations(nil) |
| 292 | return ln, warnings.Add(err), nil |
| 293 | } |
| 294 | |
| 295 | return ln, nil, err |
| 296 | } |
| 297 | |
| 298 | func (q *distributorQuerier) labelsWithRetry(ctx context.Context, labelsFunc func() ([]string, error)) ([]string, error) { |
| 299 | if q.ingesterQueryMaxAttempts <= 1 { |
nothing calls this directly
no test coverage detected