grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
133 stars 20 forks source link

PoC: Limit number of series #912

Open gtk-grafana opened 4 days ago

gtk-grafana commented 4 days ago

The goal of this PR is to bring the UI we show in explore when there are more then X series being rendered in a panel. This was implemented in Explore Logs, but I think this is something that all Scene apps could benefit from to prevent breakdown scenes with many timeseries from eating up browser resources.

This PR:

image image

Current UI in explore:

image

Still WIP, this current implementation is not mergable/reviewable yet. I'm seeing the desired functionality on this PR, but scenes is throwing the SceneObject already has a parent set that is different from the new parent error because the $data is being "moved" from the panel state to the transformer state when the transformer is added to the VizPanel state.

There's probably a better way to go about this, but how?

Example usage:

PanelBuilders.timeseries()
.setData($data)
.setTitleItems([new TimeSeriesLimitSeriesTitleItemScene({
   seriesLimit: 10,
 })])