Dashboards: Add a config setting that limits the number of series that will be displayed in a panel. Users can opt in to render all series. (#103405)

* Limit series in panels in dashboards

* fix mangled comment
This commit is contained in:
Oscar Kilhed
2025-04-11 13:56:58 +02:00
committed by GitHub
parent 906004c7ae
commit 50499fa749
9 changed files with 13 additions and 0 deletions
+3
View File
@@ -472,6 +472,9 @@ default_home_dashboard_path =
# Dashboards UIDs to report performance metrics for. * can be used to report metrics for all dashboards
dashboard_performance_metrics =
# Maximum number of series that will be showed in a single panel. Users can opt in to rendering all series. Default is 0 (unlimited).
panel_series_limit =
################################### Data sources #########################
[datasources]
# Upper limit of data sources that Grafana will return. This limit is a temporary configuration and it will be deprecated when pagination will be introduced on the list data sources API.
@@ -227,6 +227,7 @@ export interface GrafanaConfig {
rudderstackIntegrationsUrl: string | undefined;
analyticsConsoleReporting: boolean;
dashboardPerformanceMetrics: string[];
panelSeriesLimit: number;
sqlConnectionLimits: SqlConnectionLimits;
sharedWithMeFolderUID?: string;
rootFolderUID?: string;
+1
View File
@@ -184,6 +184,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
rudderstackIntegrationsUrl: undefined;
analyticsConsoleReporting = false;
dashboardPerformanceMetrics: string[] = [];
panelSeriesLimit = 0;
sqlConnectionLimits = {
maxOpenConns: 100,
maxIdleConns: 100,
+1
View File
@@ -194,6 +194,7 @@ type FrontendSettingsDTO struct {
AnalyticsConsoleReporting bool `json:"analyticsConsoleReporting"`
DashboardPerformanceMetrics []string `json:"dashboardPerformanceMetrics"`
PanelSeriesLimit int `json:"panelSeriesLimit"`
FeedbackLinksEnabled bool `json:"feedbackLinksEnabled"`
ApplicationInsightsConnectionString string `json:"applicationInsightsConnectionString"`
+1
View File
@@ -216,6 +216,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
RudderstackIntegrationsUrl: hs.Cfg.RudderstackIntegrationsURL,
AnalyticsConsoleReporting: hs.Cfg.FrontendAnalyticsConsoleReporting,
DashboardPerformanceMetrics: hs.Cfg.DashboardPerformanceMetrics,
PanelSeriesLimit: hs.Cfg.PanelSeriesLimit,
FeedbackLinksEnabled: hs.Cfg.FeedbackLinksEnabled,
ApplicationInsightsConnectionString: hs.Cfg.ApplicationInsightsConnectionString,
ApplicationInsightsEndpointUrl: hs.Cfg.ApplicationInsightsEndpointUrl,
+2
View File
@@ -226,6 +226,7 @@ type Cfg struct {
MinRefreshInterval string
DefaultHomeDashboardPath string
DashboardPerformanceMetrics []string
PanelSeriesLimit int
// Auth
LoginCookieName string
@@ -1149,6 +1150,7 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
cfg.MinRefreshInterval = valueAsString(dashboards, "min_refresh_interval", "5s")
cfg.DefaultHomeDashboardPath = dashboards.Key("default_home_dashboard_path").MustString("")
cfg.DashboardPerformanceMetrics = util.SplitString(dashboards.Key("dashboard_performance_metrics").MustString(""))
cfg.PanelSeriesLimit = dashboards.Key("panel_series_limit").MustInt(0)
if err := readUserSettings(iniFile, cfg); err != nil {
return err
@@ -67,6 +67,7 @@ export function buildVizPanel(panel: PanelKind, id?: number): VizPanel {
displayMode: panel.spec.transparent ? 'transparent' : 'default',
hoverHeader: !panel.spec.title && !timeOverrideShown,
hoverHeaderOffset: 0,
seriesLimit: config.panelSeriesLimit,
$data: createPanelDataProvider(panel),
titleItems,
$behaviors: [],
@@ -106,6 +107,7 @@ export function buildLibraryPanel(panel: LibraryPanelKind, id?: number): VizPane
const vizPanelState: VizPanelState = {
key: getVizPanelKeyForPanelId(id ?? panel.spec.id),
titleItems,
seriesLimit: config.panelSeriesLimit,
$behaviors: [
new LibraryPanelBehavior({
uid: panel.spec.libraryPanel.uid,
@@ -322,6 +322,7 @@ export function buildGridItemForPanel(panel: PanelModel): DashboardGridItem {
options: panel.options ?? {},
fieldConfig: panel.fieldConfig,
pluginVersion: panel.pluginVersion,
seriesLimit: config.panelSeriesLimit,
displayMode: panel.transparent ? 'transparent' : undefined,
// To be replaced with it's own option persited option instead derived
hoverHeader: !panel.title && !timeOverrideShown,
@@ -328,6 +328,7 @@ export function getDefaultVizPanel(): VizPanel {
return new VizPanel({
title: newPanelTitle,
pluginId: defaultPluginId,
seriesLimit: config.panelSeriesLimit,
titleItems: [new VizPanelLinks({ menu: new VizPanelLinksMenu({}) })],
hoverHeaderOffset: 0,
$behaviors: [],