Adela Jaworowska-Nowak created NIFI-16608:
---------------------------------------------
Summary: Add Gauge store and REST API analogous to Counters
Key: NIFI-16608
URL: https://issues.apache.org/jira/browse/NIFI-16608
Project: Apache NiFi
Issue Type: Improvement
Reporter: Adela Jaworowska-Nowak
Assignee: Adela Jaworowska-Nowak
UpdateCounter records values through ProcessSession.adjustCounter(). Those
values are stored in the framework CounterRepository and are queryable via GET
/nifi-api/counters (and reset via PUT /nifi-api/counters/\{id}).
UpdateGauge records values through ProcessSession.recordGauge(). Those values
are forwarded only to ComponentMetricReporter. If no reporter is configured,
DefaultComponentMetricReporter is used and the gauge is dropped. There is no
framework store and no REST API to read the last recorded gauge value.
This makes counters and gauges inconsistent for local inspection, debugging,
and automated tests. Custom gauges (for example last-ingestion time or latency
recorded by UpdateGauge) cannot be asserted through the NiFi API the way
counters can.
Proposal:
- Persist the latest value for each named gauge when recordGauge() is
committed, using the same commit-timing rules as counters (NOW vs
SESSION_COMMITTED).
- Keep gauge identity as name plus optional metric attributes/labels, matching
how counters are keyed.
- Expose gauges over REST analogously to counters, for example:
- GET /nifi-api/gauges
- optional GET or reset by id if that matches the counters client
- Continue to call ComponentMetricReporter.recordGauge() so OpenTelemetry (or
any other reporter) remains the export path. The store is for local query, not
a replacement for reporting.
This should not change processor behavior or require a ComponentMetricReporter
implementation in order to read gauge values from the running node.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)