Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions pkg/alertmanager/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,31 @@ func New(cfg *Config) (*Alertmanager, error) {
stop: make(chan struct{}),
}

// TODO(cortex): Build a registry that can merge metrics from multiple users.
// For now, these metrics are ignored, as we can't register the same
// metric twice with a single registry.
localRegistry := prometheus.NewRegistry()

am.wg.Add(1)
nflogID := fmt.Sprintf("nflog:%s", cfg.UserID)
var err error
am.nflog, err = nflog.New(
nflog.WithRetention(cfg.Retention),
nflog.WithSnapshot(filepath.Join(cfg.DataDir, nflogID)),
nflog.WithMaintenance(notificationLogMaintenancePeriod, am.stop, am.wg.Done),
// TODO(cortex): Build a registry that can merge metrics from multiple users.
// For now, these metrics are ignored, as we can't register the same
// metric twice with a single registry.
nflog.WithMetrics(prometheus.NewRegistry()),
nflog.WithMetrics(localRegistry),
nflog.WithLogger(log.With(am.logger, "component", "nflog")),
)
if err != nil {
return nil, fmt.Errorf("failed to create notification log: %v", err)
}
if cfg.Peer != nil {
c := cfg.Peer.AddState("nfl:"+cfg.UserID, am.nflog, localRegistry)
am.nflog.SetBroadcast(c.Broadcast)
}

am.marker = types.NewMarker()

// TODO(cortex): Build a registry that can merge metrics from multiple users.
// For now, these metrics are ignored, as we can't register the same
// metric twice with a single registry.
localRegistry := prometheus.NewRegistry()

silencesID := fmt.Sprintf("silences:%s", cfg.UserID)
am.silences, err = silence.New(silence.Options{
SnapshotFile: filepath.Join(cfg.DataDir, silencesID),
Expand Down