Skip to content

Commit 7bf7701

Browse files
postnaticlaude
andcommitted
Simplify searchAndIndexShardCountPanel by removing default values
Updated searchAndIndexShardCountPanel (opensearch-mixin/panels.libsonnet:1020-1037): - Added intervalFactor(2) to the shards_per_index target - Removed all default values (color mode, axis config, legend, tooltip) - Kept only meaningful customizations: unit('shards'), thresholds - Added field override to hide series with all-zero values from legend/tooltip The panel has been reduced from 37 lines to 17 lines while maintaining identical functionality to the legacy panel. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0040de5 commit 7bf7701

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

opensearch-mixin/panels.libsonnet

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,40 +1020,20 @@ local utils = commonlib.utils;
10201020
searchAndIndexShardCountPanel:
10211021
g.panel.timeSeries.new('Shard count')
10221022
+ g.panel.timeSeries.panelOptions.withDescription('The number of index shards for the selected index.')
1023-
+ g.panel.timeSeries.queryOptions.withTargets([signals.indexing.shards_per_index.asTarget()])
1023+
+ g.panel.timeSeries.queryOptions.withTargets([
1024+
signals.indexing.shards_per_index.asTarget()
1025+
+ g.query.prometheus.withIntervalFactor(2),
1026+
])
10241027
+ g.panel.timeSeries.standardOptions.withUnit('shards')
1025-
+ g.panel.timeSeries.standardOptions.color.withMode('palette-classic')
1026-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisCenteredZero(false)
1027-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisColorMode('text')
1028-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('')
1029-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisPlacement('auto')
1030-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withBarAlignment(0)
1031-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('line')
1032-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0)
1033-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none')
1034-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('linear')
1035-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(1)
1036-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withPointSize(5)
1037-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withScaleDistribution({ type: 'linear' })
1038-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('auto')
1039-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false)
1040-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withStacking({ group: 'A', mode: 'none' })
1041-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withThresholdsStyle({ mode: 'off' })
10421028
+ g.panel.timeSeries.standardOptions.thresholds.withSteps([
10431029
g.panel.timeSeries.standardOptions.threshold.step.withColor('green')
10441030
+ g.panel.timeSeries.standardOptions.threshold.step.withValue(null),
10451031
g.panel.timeSeries.standardOptions.threshold.step.withColor('red')
10461032
+ g.panel.timeSeries.standardOptions.threshold.step.withValue(80),
10471033
])
1048-
+ g.panel.timeSeries.options.withLegend({
1049-
calcs: [],
1050-
displayMode: 'list',
1051-
placement: 'bottom',
1052-
showLegend: true,
1053-
})
1054-
+ g.panel.timeSeries.options.withTooltip({
1055-
mode: 'single',
1056-
sort: 'none',
1057-
}),
1034+
+ g.panel.timeSeries.standardOptions.withOverrides([
1035+
g.panel.timeSeries.fieldOverride.byValue.new({op: 'gte', reducer: 'allIsZero', value: 0})
1036+
+ g.panel.timeSeries.fieldOverride.byValue.withProperty('custom.hideFrom', {legend: true, tooltip: true, viz: false}),
1037+
]),
10581038
},
10591039
}

0 commit comments

Comments
 (0)