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

Method Snapshot

api/prometheus/v1/api.go:1215–1236  ·  view source on GitHub ↗
(ctx context.Context, skipHead bool)

Source from the content-addressed store, hash-verified

1213}
1214
1215func (h *httpAPI) Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error) {
1216 u := h.client.URL(epSnapshot, nil)
1217 q := u.Query()
1218
1219 q.Set("skip_head", strconv.FormatBool(skipHead))
1220
1221 u.RawQuery = q.Encode()
1222
1223 req, err := http.NewRequest(http.MethodPost, u.String(), nil)
1224 if err != nil {
1225 return SnapshotResult{}, err
1226 }
1227
1228 _, body, _, err := h.client.Do(ctx, req)
1229 if err != nil {
1230 return SnapshotResult{}, err
1231 }
1232
1233 var res SnapshotResult
1234 err = json.Unmarshal(body, &res)
1235 return res, err
1236}
1237
1238func (h *httpAPI) Rules(ctx context.Context) (RulesResult, error) {
1239 u := h.client.URL(epRules, nil)

Callers 1

TestAPIsFunction · 0.95

Calls 5

URLMethod · 0.65
QueryMethod · 0.65
SetMethod · 0.65
DoMethod · 0.65
StringMethod · 0.45

Tested by 1

TestAPIsFunction · 0.76