Skip to content

BUG-43: cmapi_sync_drift_total and cmapi_namespaces are declared, and no code feeds them #172

Closed

Description

@ephico2real2

Part of #16

What is wrong: Two metrics are in the code and always have no sample. cmapi_sync_drift_total{cluster_id} is the source of the KPI "Drift events", and cmapi_namespaces{cluster_id, state} is the source of "Managed coverage". No code calls .inc() or .set() on either. A dashboard or an alert on them shows nothing, which looks like "no drift".

Where: cmapi/src/cmapi/core/observability.py:44-45 (SYNC_DRIFT, NAMESPACES). grep -rn "SYNC_DRIFT\|NAMESPACES\." cmapi/src finds only the two definitions.

How to prove it: A test of the service suite runs the worker on a cluster that is out of sync with no open request, and reads /metrics. cmapi_sync_drift_total must be 1. A second test reads cmapi_namespaces after the watch cache has listed a managed and an unmanaged namespace.

Measured or inferred: Measured on 2026-11-13 by the search above, at 290ac5f.

Severity: Low.

What must hold after the fix: The worker counts a drift when it sees one, and the registry sets the namespace counts from the watch cache. Or the two definitions are removed until that code exists. docs/17 marks each KPI built when its metric has a sample.

Research: docs/17-kpis.md has the definitions and their sources.

Solution (inline, not applied): Not written here. Where the tag is In-Progress, the fix is on branch kpis.

Class: INV. The fix adds the two measurements.

Activity

  1. added
    bug
    class:INV
    status:open
    sev:low
    Backlog
    on Nov 13, 2026
  2. added a commit that references this issue on Nov 13, 2026
  3. added
    In-QA
    and removed
    Backlog
    on Nov 13, 2026
  4. added
    Done
    and removed
    In-QA
    on Nov 14, 2026
  5. ephico2real2 commented on Nov 14, 2026

    @ephico2real2
    OwnerAuthor

    Done: pull request #203 merged to main (89ecb07). GitHub Actions run 43530250572 was green on the exact head 248f7e2 (six jobs). The merged tree is the tree that the native suite ran on: 716 passed. Native on macOS: test_namespaces_metric.py 3 passed (before, /metrics had only the HELP and TYPE lines of both metrics): one managed, one unmanaged and two reserved namespaces give cmapi_namespaces 1, 1 and 2, and a cluster that is not listed has no sample. cmapi_sync_drift_total is removed until code can see a drift (Argo CD, Wave 2); docs/17 keeps Drift events as designed and marks Managed coverage built (7 live, 4 built, 10 designed). Not measured: a scrape by Prometheus, or any value on a cluster.

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

    Donebugclass:INVsev:lowstatus:open

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions