MCPcopy Create free account
hub / github.com/cortexproject/cortex / DeleteSilence

Method DeleteSilence

integration/e2ecortex/client.go:1224–1246  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

1222}
1223
1224func (c *Client) DeleteSilence(ctx context.Context, id string) error {
1225 u := c.alertmanagerClient.URL(fmt.Sprintf("api/prom/api/v2/silence/%s", url.PathEscape(id)), nil)
1226
1227 req, err := http.NewRequest(http.MethodDelete, u.String(), nil)
1228 if err != nil {
1229 return fmt.Errorf("error creating request: %v", err)
1230 }
1231
1232 resp, body, err := c.alertmanagerClient.Do(ctx, req)
1233 if err != nil {
1234 return err
1235 }
1236
1237 if resp.StatusCode == http.StatusNotFound {
1238 return ErrNotFound
1239 }
1240
1241 if resp.StatusCode != http.StatusOK {
1242 return fmt.Errorf("deleting silence failed with status %d and error %v", resp.StatusCode, string(body))
1243 }
1244
1245 return nil
1246}
1247
1248func (c *Client) GetReceivers(ctx context.Context) ([]string, error) {
1249 u := c.alertmanagerClient.URL("api/prom/api/v2/receivers", nil)

Callers 1

TestAlertmanagerShardingFunction · 0.95

Calls 2

StringMethod · 0.65
DoMethod · 0.65

Tested by 1

TestAlertmanagerShardingFunction · 0.76