Skip to content

prometheus: observe and reconcile against Alertmanager and the Mimir, Cortex and Loki rulers #3371

Closed

Description

@lex00

Part of #2989 (section 9).

Neither otel nor prometheus implements describeResources, observeResourcesDeep or exportResources. Both have parsers that reconcile can reuse. grafana is the model (#2946: lexicons/grafana/src/plugin.ts:181-196).

Reconcile first

  • Alertmanager: GET /api/v2/status returns config.original, the stored YAML, which the existing parser takes as is.
  • Mimir ruler: GET /prometheus/config/v1/rules[/{namespace}] returns rule groups as YAML, with X-Scope-OrgID. Loki: /loki/api/v1/rules. Cortex: /api/v1/rules (Mimir does not register that path).
  • Plain Prometheus: /api/v1/rules returns evaluated rules (query, duration, labels, annotations, health, lastError), not file contents, so it needs a mapping to RuleGroupConfig. Second.

src/import/slo.ts already rebuilds an Slo when the groups match it, so live import keeps composites.

Observe

describeResources keyed by rule group for targets with an API, and by the Alertmanager config.

Ownership

Rule files carry no marker (src/serializer.ts:20). On a ruler, the namespaces the project declares are the boundary, as a stack bounds CloudFormation deletes.

Acceptance criteria

  • chant import --from <env> reconciles Alertmanager config and ruler groups into prometheus source.
  • describeResources reports declared groups and their health.

Activity

  1. added
    enhancement
    area:lifecycle
    area:otel
    followup:lexicon-maturity
    on Oct 3, 2026
  2. lex00 commented on Oct 6, 2026

    @lex00
    ContributorAuthor

    Done in #3580 (343154d) and #3583 (e71e9ee, two test expectations): chant import --from <env> reads Mimir, Cortex and Loki ruler groups and the Alertmanager config (/api/v2/status, or Mimir/Cortex /api/v1/alerts) into prometheus source, groups an Slo built coming back as Slo(...); plain Prometheus /api/v1/rules is mapped too, lossy, with a warning. describeResources reports each declared RuleGroup's health, first rule error and firing/pending counts. The declared ruler namespaces (prometheus.profiles.<env>.ruler) bound every read. At v0.34.1 /api/v2/status returns the loaded config with defaults filled in and secrets masked, not the stored YAML; the importer strips the added defaults (--verbatim keeps them) and warns on each masked secret. The client is @intentius/chant-lexicon-prometheus/api, which #3372 reuses. Tests pass on main against fake rulers and Alertmanagers on localhost: describe-resources, export-resources, alertmanager-live, evaluated, config, plugin (6 files, 75 tests). Not run against a real Mimir or Alertmanager.

  3. lex00 commented on Oct 6, 2026

    @lex00
    ContributorAuthor

    Released in chant 0.107.1 (npm). 0.107.0 was tagged at fae3aae but never published: its publish gate timed out waiting for CI on a commit whose tests were red. #3589, #3590 and #3591 fixed the tests, and 0.107.1 published from e4b2d42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lifecyclearea:otelenhancementfollowup:lexicon-maturity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions