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

Function createLabelValuesRequest

pkg/querier/blocks_store_queryable.go:1141–1169  ·  view source on GitHub ↗
(minT, maxT, limit int64, label string, blockIDs []ulid.ULID, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

1139}
1140
1141func createLabelValuesRequest(minT, maxT, limit int64, label string, blockIDs []ulid.ULID, matchers ...*labels.Matcher) (*storepb.LabelValuesRequest, error) {
1142 req := &storepb.LabelValuesRequest{
1143 Start: minT,
1144 End: maxT,
1145 Limit: limit,
1146 Label: label,
1147 Matchers: convertMatchersToLabelMatcher(matchers),
1148 }
1149
1150 // Selectively query only specific blocks.
1151 hints := &hintspb.LabelValuesRequestHints{
1152 BlockMatchers: []storepb.LabelMatcher{
1153 {
1154 Type: storepb.LabelMatcher_RE,
1155 Name: block.BlockIDLabel,
1156 Value: strings.Join(convertULIDsToString(blockIDs), "|"),
1157 },
1158 },
1159 }
1160
1161 anyHints, err := types.MarshalAny(hints)
1162 if err != nil {
1163 return nil, errors.Wrapf(err, "failed to marshal label values request hints")
1164 }
1165
1166 req.Hints = anyHints
1167
1168 return req, nil
1169}
1170
1171func convertULIDsToString(ids []ulid.ULID) []string {
1172 res := make([]string, len(ids))

Callers 1

Calls 3

convertULIDsToStringFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected