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

Method GetRulesConfig

pkg/configs/db/postgres/postgres.go:194–204  ·  view source on GitHub ↗

GetRulesConfig gets the latest alertmanager config for a user.

(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

192
193// GetRulesConfig gets the latest alertmanager config for a user.
194func (d DB) GetRulesConfig(ctx context.Context, userID string) (userconfig.VersionedRulesConfig, error) {
195 current, err := d.GetConfig(ctx, userID)
196 if err != nil {
197 return userconfig.VersionedRulesConfig{}, err
198 }
199 cfg := current.GetVersionedRulesConfig()
200 if cfg == nil {
201 return userconfig.VersionedRulesConfig{}, sql.ErrNoRows
202 }
203 return *cfg, nil
204}
205
206// SetRulesConfig sets the current alertmanager config for a user.
207func (d DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig userconfig.RulesConfig) (bool, error) {

Callers

nothing calls this directly

Implementers 4

timedpkg/configs/db/timed.go
tracedpkg/configs/db/traced.go
DBpkg/configs/db/postgres/postgres.go
DBpkg/configs/db/memory/memory.go

Calls 2

GetConfigMethod · 0.95

Tested by

no test coverage detected