prometheus / prometheus/alertmanager

API v3alpha: add shared contracts and reusable infrastructure

Open
#5,479 0 comments 0 reactions 1 assignee View on GitHub

@siavashs is already working on this.

Since Aug 29, 2026.

component/api kind/enhancement
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

Parent: #5450

Summary

Establish the shared common.v3alpha protobuf contracts and reusable Connect API infrastructure needed by AlertService, SilenceService, ReceiverService, and NotificationService.

Public handlers and conversion code must use internal Alertmanager types rather than generated API v2 OpenAPI models.

Shared protobuf contracts

Add common.v3alpha messages for:

  • Matcher.
  • OR-of-AND MatcherSet.
  • Receiver identity and labels where shared between services.
  • State-filter primitives.
  • Pagination request and response fields.
  • Structured validation details.
  • Partial-result details.
  • Required-feature details.

Keep this package minimal because it becomes a dependency of independently versioned services.

Pagination

Define one live-view pagination contract for list RPCs:

  • Deterministic resource-specific sort keys.
  • A unique ID or fingerprint tie-breaker.
  • Opaque tokens bound to resource type, sort cursor, and filter digest.
  • Default and maximum page sizes.
  • InvalidArgument for negative sizes and malformed, mismatched, or expired tokens.
  • Explicit documentation that concurrent mutation may move records between pages and tokens do not provide snapshot isolation.

Reusable infrastructure

  • Add matcher, filtering, conversion, pagination, and token helpers over internal Alertmanager types.
  • Wire featurecontrol.Flagger through app, API, and Connect options.
  • Support disabled-by-default capability flags that reject incompatible operations with structured FailedPrecondition details naming the required feature.
  • Expand the Connect options structure for alert, silence, group, receiver, feature, and future notification dependencies.
  • Publish one immutable reload snapshot containing configuration, routes, receiver metadata, and the reload-safe alert-status callback.
  • Never hold configuration or reload locks while scanning stores or sending stream messages.
  • Centralize stable Connect error translation for InvalidArgument, NotFound, ResourceExhausted, Unavailable, FailedPrecondition, Aborted, and Internal, while preserving cancellation and deadline codes.

Acceptance criteria

  • common.v3alpha source and generated bindings are Buf-compliant and reproducible.
  • Shared messages have documented ownership and compatibility semantics.
  • Pagination tokens are opaque, filter-bound, deterministic, and covered for invalid inputs.
  • Capability gating returns machine-readable FailedPrecondition details.
  • Reload snapshots are immutable and race-safe.
  • Shared helpers do not depend on generated API v2 models.
  • A second make common-proto run produces no diff.
  • Ginkgo/Gomega specs cover matchers, pagination, errors, feature gating, and reloads.

Related work

Coordinate handler-level resource and transport policy with #5478.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.