You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI metrics table renders blank cells for counters and histograms #221
MetricsReporter only knows how to render Metrics.Timer. Both table paths in cli/src/main/java/io/github/open_policy_agent/opa/cli/MetricsReporter.java
test instanceof Metrics.Timer and leave everything else as the empty string:
printSingleMetricsTable (lines 39-43 and 56-61) initialises String value = ""
and only fills it in for a timer.
printStatisticalMetricsTable (line 74) collects values only for timers, so
non-timer metrics are dropped from that table entirely.
Until #216, SimpleMetrics.all() returned only timers, so this was unreachable.
That PR makes all() return counters and histograms too, so a metric registered
via Metrics.counter(...) or Metrics.histogram(...) now reaches the reporter and
prints as a row with a blank cell under TIME.
Nothing in the repo registers a counter or histogram yet, so this is not visible
in normal CLI use today — it only shows up for an embedder that registers one on
the Metrics instance passed to an evaluation. It seemed better as a follow-up
than as scope added to #216.
Suggested fix
Handle the other two types the way MetricsPrinter already does
(opa-evaluator/src/main/java/io/github/open_policy_agent/opa/metrics/MetricsPrinter.java:78-87):
counters print their integer value, histograms explode into one row per stat.
The TIME column header also stops being accurate once non-timers can appear.
Activity