state represents the Alertmanager silences and notification log internal state.
| 35 | |
| 36 | // state represents the Alertmanager silences and notification log internal state. |
| 37 | type state struct { |
| 38 | services.Service |
| 39 | |
| 40 | userID string |
| 41 | logger log.Logger |
| 42 | reg prometheus.Registerer |
| 43 | |
| 44 | settleReadTimeout time.Duration |
| 45 | storeReadTimeout time.Duration |
| 46 | |
| 47 | mtx sync.Mutex |
| 48 | states map[string]cluster.State |
| 49 | |
| 50 | replicationFactor int |
| 51 | replicator Replicator |
| 52 | store alertstore.AlertStore |
| 53 | |
| 54 | partialStateMergesTotal *prometheus.CounterVec |
| 55 | partialStateMergesFailed *prometheus.CounterVec |
| 56 | stateReplicationTotal *prometheus.CounterVec |
| 57 | stateReplicationFailed *prometheus.CounterVec |
| 58 | fetchReplicaStateTotal prometheus.Counter |
| 59 | fetchReplicaStateFailed prometheus.Counter |
| 60 | initialSyncTotal prometheus.Counter |
| 61 | initialSyncCompleted *prometheus.CounterVec |
| 62 | initialSyncDuration prometheus.Histogram |
| 63 | |
| 64 | msgc chan *clusterpb.Part |
| 65 | } |
| 66 | |
| 67 | // newReplicatedStates creates a new state struct, which manages state to be replicated between alertmanagers. |
| 68 | func newReplicatedStates(userID string, rf int, re Replicator, st alertstore.AlertStore, l log.Logger, r prometheus.Registerer) *state { |
nothing calls this directly
no outgoing calls
no test coverage detected