| 1117 | } |
| 1118 | |
| 1119 | func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ...Option) (model.Value, Warnings, error) { |
| 1120 | u := h.client.URL(epQueryRange, nil) |
| 1121 | q := u.Query() |
| 1122 | |
| 1123 | q.Set("query", query) |
| 1124 | q.Set("start", formatTime(r.Start)) |
| 1125 | q.Set("end", formatTime(r.End)) |
| 1126 | q.Set("step", strconv.FormatFloat(r.Step.Seconds(), 'f', -1, 64)) |
| 1127 | |
| 1128 | opt := &apiOptions{} |
| 1129 | for _, o := range opts { |
| 1130 | o(opt) |
| 1131 | } |
| 1132 | |
| 1133 | d := opt.timeout |
| 1134 | if d > 0 { |
| 1135 | q.Set("timeout", d.String()) |
| 1136 | } |
| 1137 | |
| 1138 | _, body, warnings, err := h.client.DoGetFallback(ctx, u, q) |
| 1139 | if err != nil { |
| 1140 | return nil, warnings, err |
| 1141 | } |
| 1142 | |
| 1143 | var qres queryResult |
| 1144 | |
| 1145 | return qres.v, warnings, json.Unmarshal(body, &qres) |
| 1146 | } |
| 1147 | |
| 1148 | func (h *httpAPI) Series(ctx context.Context, matches []string, startTime, endTime time.Time) ([]model.LabelSet, Warnings, error) { |
| 1149 | u := h.client.URL(epSeries, nil) |