Skip to content

Commit 848c264

Browse files
postnaticlaude
andcommitted
Simplify documentsIndexedPanel by removing default values
Updated the documentsIndexedPanel to match the legacy panel configuration by removing all default values per .clauderc guidelines. Panel changes (opensearch-mixin/panels.libsonnet:880-897): - Added intervalFactor(2) to target (was missing) - Removed all default values: color mode, axis config, legend, tooltip options - Added field override to hide series with all-zero values from legend/tooltip - Reduced from 38 lines to 18 lines while maintaining identical functionality The indexing_count signal was already modernized in commit 570c7ba to use signal framework helpers (type: 'gauge' with aggLevel: 'group'). Verified by comparing generated JSON with legacy panel - all significant fields match, only acceptable differences (default values) remain. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 570c7ba commit 848c264

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
@@ -880,41 +880,21 @@ local utils = commonlib.utils;
880880
documentsIndexedPanel:
881881
g.panel.timeSeries.new('Documents indexed')
882882
+ g.panel.timeSeries.panelOptions.withDescription('Number of indexed documents for the selected index.')
883-
+ g.panel.timeSeries.queryOptions.withTargets([signals.indexing.indexing_count.asTarget()])
883+
+ g.panel.timeSeries.queryOptions.withTargets([
884+
signals.indexing.indexing_count.asTarget()
885+
+ g.query.prometheus.withIntervalFactor(2),
886+
])
884887
+ g.panel.timeSeries.standardOptions.withUnit('documents')
885-
+ g.panel.timeSeries.standardOptions.color.withMode('palette-classic')
886-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisCenteredZero(false)
887-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisColorMode('text')
888-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('')
889-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisPlacement('auto')
890-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withBarAlignment(0)
891-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('line')
892-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0)
893-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none')
894-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('linear')
895-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(1)
896-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withPointSize(5)
897-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withScaleDistribution({ type: 'linear' })
898-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('auto')
899-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false)
900-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withStacking({ group: 'A', mode: 'none' })
901-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withThresholdsStyle({ mode: 'off' })
902888
+ g.panel.timeSeries.standardOptions.thresholds.withSteps([
903889
g.panel.timeSeries.standardOptions.threshold.step.withColor('green')
904890
+ g.panel.timeSeries.standardOptions.threshold.step.withValue(null),
905891
g.panel.timeSeries.standardOptions.threshold.step.withColor('red')
906892
+ g.panel.timeSeries.standardOptions.threshold.step.withValue(80),
907893
])
908-
+ g.panel.timeSeries.options.withLegend({
909-
calcs: [],
910-
displayMode: 'list',
911-
placement: 'bottom',
912-
showLegend: true,
913-
})
914-
+ g.panel.timeSeries.options.withTooltip({
915-
mode: 'single',
916-
sort: 'none',
917-
}),
894+
+ g.panel.timeSeries.standardOptions.withOverrides([
895+
g.panel.timeSeries.fieldOverride.byValue.new({op: 'gte', reducer: 'allIsZero', value: 0})
896+
+ g.panel.timeSeries.fieldOverride.byValue.withProperty('custom.hideFrom', {legend: true, tooltip: true, viz: false}),
897+
]),
918898

919899
// Index Structure Panels
920900
segmentCountPanel:

0 commit comments

Comments
 (0)