Skip to content

test(accounting): [cg] Check every context-guru operator outside the registry in accounting.Components #2111

Done

Description

@boazdavid

Problem

Cortex's metrics sink allows only the names in accounting.Components (core/accounting/metrics.go) as the component label. The accountant sink pushes any other operator name as component="other". core/accounting must not import context-guru, so the list is a hand-written copy of context-guru's operator names.

The list is correct today. The risk is drift: if context-guru adds an operator, the copy does not change, and the new operator goes to other. The central dashboard (#2064) then counts it under the wrong source in "Net saved by source".

TestComponentsCoverTheRegistry (core/plugins/contextguru/components_test.go, in #2062) is the guard. It has two gaps:

  1. It checks the operators outside the registry against a fixed list of six: toolfilter, toolschema, headttl, cachesplit, expand, adjudicate. It does not check tailbreakpoint, tooldefer, expand_restore or keeper.
  2. Because the list is fixed, it cannot catch a new context-guru operator.

Fix

  1. Now, in feat(accounting): [cg] Push the accountant's metrics to a central collector #2062: add tailbreakpoint, tooldefer, expand_restore and keeper to the fixed list.
  2. After a context-guru release that includes fix(metrics): Push operators outside the registry under their own component context-guru#1362:
    1. Bump github.com/rossoctl/context-guru in core/go.mod.
    2. Replace the fixed list with accwire.OperatorsOutsideRegistry().

rossoctl/context-guru#1362 adds accwire.OperatorsOutsideRegistry(). The function lists every operator context-guru books that is not a registered component, and a context-guru test keeps it complete. Cortex cannot call it until it is released. The latest release is v0.7.7, which is from before #1362.

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions