prometheus / prometheus/alertmanager

Add internal alert ingest queue

Open
#1,832 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/storage help wanted
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

Currently, every alert received via the API is sent directly to the internal memory store for alerts:

API: https://github.com/prometheus/alertmanager/blob/8ca1f66a2dd4bd97c1db9602342e6c4a135d5459/api/v2/api.go#L348

Memory store: https://github.com/prometheus/alertmanager/blob/8ca1f66a2dd4bd97c1db9602342e6c4a135d5459/provider/mem/mem.go#L149-L180

Every set locks the internal store, which can become a performance issue (cf. https://github.com/prometheus/alertmanager/issues/1201). Prometheus sends messages in batches of 50, but there's no enforcing of this on the alertmanager end. Anecdotally, I've seen a single alertmanager become unresponsive when receiving ~50 ingest requests per second, with each request containing a single message.

Batching at the store level is probably the right place to implement this:

https://github.com/prometheus/alertmanager/blob/8ca1f66a2dd4bd97c1db9602342e6c4a135d5459/store/store.go#L95

Adding a basic benchmark and a receive queue would be a good first step.

This is more or less inspired by common sense and being reminded of how kafka ingests messages.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the API path in api/v2/api.go, the memory-store Set implementation in provider/mem/mem.go, and the store entry point in store/store.go. Review the locking behavior and existing issue context, then add a receive queue and a basic benchmark demonstrating the batching behavior and its completed performance impact.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.