(minT, maxT, limit int64, label string, blockIDs []ulid.ULID, matchers ...*labels.Matcher)
| 1139 | } |
| 1140 | |
| 1141 | func 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 | |
| 1171 | func convertULIDsToString(ids []ulid.ULID) []string { |
| 1172 | res := make([]string, len(ids)) |
no test coverage detected