| 1025 | } |
| 1026 | |
| 1027 | func (h *httpAPI) LabelNames(ctx context.Context, matches []string, startTime, endTime time.Time, opts ...Option) ([]string, Warnings, error) { |
| 1028 | u := h.client.URL(epLabels, nil) |
| 1029 | q := addOptionalURLParams(u.Query(), opts) |
| 1030 | |
| 1031 | if !startTime.IsZero() { |
| 1032 | q.Set("start", formatTime(startTime)) |
| 1033 | } |
| 1034 | if !endTime.IsZero() { |
| 1035 | q.Set("end", formatTime(endTime)) |
| 1036 | } |
| 1037 | for _, m := range matches { |
| 1038 | q.Add("match[]", m) |
| 1039 | } |
| 1040 | |
| 1041 | _, body, w, err := h.client.DoGetFallback(ctx, u, q) |
| 1042 | if err != nil { |
| 1043 | return nil, w, err |
| 1044 | } |
| 1045 | var labelNames []string |
| 1046 | err = json.Unmarshal(body, &labelNames) |
| 1047 | return labelNames, w, err |
| 1048 | } |
| 1049 | |
| 1050 | func (h *httpAPI) LabelValues(ctx context.Context, label string, matches []string, startTime, endTime time.Time, opts ...Option) (model.LabelValues, Warnings, error) { |
| 1051 | u := h.client.URL(epLabelValues, map[string]string{"name": label}) |