MCPcopy
hub / github.com/prometheus/client_golang / QueryRange

Method QueryRange

api/prometheus/v1/api.go:1173–1189  ·  view source on GitHub ↗
(ctx context.Context, query string, r Range, opts ...Option)

Source from the content-addressed store, hash-verified

1171}
1172
1173func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range, opts ...Option) (model.Value, Warnings, error) {
1174 u := h.client.URL(epQueryRange, nil)
1175 q := addOptionalURLParams(u.Query(), opts)
1176
1177 q.Set("query", query)
1178 q.Set("start", formatTime(r.Start))
1179 q.Set("end", formatTime(r.End))
1180 q.Set("step", strconv.FormatFloat(r.Step.Seconds(), 'f', -1, 64))
1181
1182 _, body, warnings, err := h.client.DoGetFallback(ctx, u, q)
1183 if err != nil {
1184 return nil, warnings, err
1185 }
1186
1187 var qres queryResult
1188 return qres.v, warnings, json.Unmarshal(body, &qres)
1189}
1190
1191func (h *httpAPI) Series(ctx context.Context, matches []string, startTime, endTime time.Time, opts ...Option) ([]model.LabelSet, Warnings, error) {
1192 u := h.client.URL(epSeries, nil)

Callers 1

TestAPIsFunction · 0.95

Calls 6

addOptionalURLParamsFunction · 0.85
formatTimeFunction · 0.85
URLMethod · 0.65
QueryMethod · 0.65
SetMethod · 0.65
DoGetFallbackMethod · 0.65

Tested by 1

TestAPIsFunction · 0.76