feat: add copilot window for stats#338
Conversation
Add a copilot window to look at collected stats. To see window in any mode but play click on the bar-graph observability button.
0327148 to
be4bf59
Compare
| LoggerFactory.getLogger(ObservabilityDevToolsClient.class).warn( | ||
| "Could not load observability-kit dev-tools panel code", e); | ||
| } | ||
| } |
There was a problem hiding this comment.
This duplicates almost verbatim this ensureClientLoaded method:
I suggest to extract e.g. a injectClientResource(UI, key, resource) to avoid duplication.
There was a problem hiding this comment.
Extracted to Util for reuse when needed.
| } else if (meter instanceof Counter counter) { | ||
| entry.put("count", (long) counter.count()); | ||
| } else if (meter instanceof FunctionCounter counter) { | ||
| entry.put("count", (long) counter.count()); |
There was a problem hiding this comment.
Why casting these two counters to long, while DistributionSummary below is kept double?
There was a problem hiding this comment.
DistributionSummary.count() actually returns long and not double where as counter and functionCounter return double so they are cast to long to normalize the value to integer for the panel.
| // Per-meter ring buffer of recent trend values, keyed by name+tags. Survives | ||
| // panel close/reopen (module scope) so the sparkline keeps its history. | ||
| var history = {}; |
There was a problem hiding this comment.
Do we need to evict history at some point?
There was a problem hiding this comment.
The buffers themselves are set to 20 items, but a key is not removed at any point after it has been added. The list is thus persisted for the page lifetime.
Not certain if we need to clean it with the current key amount, but could be something to think about.
Add a copilot window to look at
collected stats.
To see window in any mode but play
click on the bar-graph observability
button.