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

Method stopping

pkg/alertmanager/multitenant.go:776–794  ·  view source on GitHub ↗

stopping runs when MultitenantAlertmanager transitions to Stopping state.

(_ error)

Source from the content-addressed store, hash-verified

774
775// stopping runs when MultitenantAlertmanager transitions to Stopping state.
776func (am *MultitenantAlertmanager) stopping(_ error) error {
777 am.alertmanagersMtx.Lock()
778 for _, am := range am.alertmanagers {
779 am.StopAndWait()
780 }
781 am.alertmanagersMtx.Unlock()
782 if am.peer != nil { // Tests don't setup any peer.
783 err := am.peer.Leave(am.cfg.Cluster.PeerTimeout)
784 if err != nil {
785 level.Warn(am.logger).Log("msg", "failed to leave the cluster", "err", err)
786 }
787 }
788
789 if am.subservices != nil {
790 // subservices manages ring and lifecycler, if sharding was enabled.
791 _ = services.StopManagerAndAwaitStopped(context.Background(), am.subservices)
792 }
793 return nil
794}
795
796// loadAlertmanagerConfigs Loads (and filters) the alertmanagers configuration from object storage, taking into consideration the sharding strategy. Returns:
797// - The list of discovered users (all users with a configuration in storage)

Callers

nothing calls this directly

Calls 3

StopAndWaitMethod · 0.80
LogMethod · 0.45

Tested by

no test coverage detected