Skip to content

Commit 17b80fe

Browse files
authored
Kafka: Set totalTime panels repeat configurable (#1356)
1 parent 30f5ba1 commit 17b80fe

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

kafka-observ-lib/config.libsonnet

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
topicsFilteringSelector: 'topic!="__consumer_offsets"',
1919
consumerGroupFilteringSelector: 'consumergroup!=""',
20+
21+
// whether to use Grafana repeat panel feature for totalTime metrics
22+
// when set to false, metrics are aggregated by cluster group level.
23+
totalTimeMetricsRepeat: true,
24+
2025
zookeeperEnabled: true,
2126
totalTimeMsQuantile: '0.95', // quantile to use for totalTimeMs metrics: 0.50, 0.75, 0.95, 0.98, 0.99, 0.999...
2227
zookeeperClientQuantile: '0.95', // quantile to use for zookeeperClient metrics: 0.50, 0.75, 0.95, 0.98, 0.99, 0.999...

kafka-observ-lib/panels/totalTime.libsonnet

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
local g = import '../g.libsonnet';
22
local commonlib = import 'common-lib/common/main.libsonnet';
3+
local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';
34
{
45
new(signals, config):: {
5-
6+
local instanceLabel = xtd.array.slice(config.instanceLabels, -1)[0],
67
_common::
78
commonlib.panels.generic.timeSeries.base.stylize()
8-
+ g.panel.timeSeries.panelOptions.withRepeat(config.instanceLabels[0])
9-
+ g.panel.timeSeries.panelOptions.withRepeatDirection('v')
109
+ g.panel.timeSeries.fieldConfig.defaults.custom.withStacking({ mode: 'normal' })
1110
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(0)
12-
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'),
11+
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none')
12+
+ (if config.totalTimeMetricsRepeat then
13+
g.panel.timeSeries.panelOptions.withRepeat(instanceLabel)
14+
+ g.panel.timeSeries.panelOptions.withRepeatDirection('v')
15+
+ { title+: ' ($%s)' % instanceLabel }
16+
else {}),
17+
1318

1419
fetchConsumerTotalTimeBreakdown:
15-
g.panel.timeSeries.new('Fetch-consumer ($%s)' % config.instanceLabels[0])
20+
g.panel.timeSeries.new('Fetch-consumer')
1621
+ g.panel.timeSeries.panelOptions.withDescription(
1722
|||
1823
Total time breakdown for fetch requests.
@@ -34,7 +39,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';
3439
+ self._common,
3540

3641
producerTotalTimeBreakdown:
37-
g.panel.timeSeries.new('Producer ($%s)' % config.instanceLabels[0])
42+
g.panel.timeSeries.new('Producer')
3843
+ g.panel.timeSeries.panelOptions.withDescription(
3944
|||
4045
Total time breakdown for producer requests.
@@ -56,7 +61,7 @@ local commonlib = import 'common-lib/common/main.libsonnet';
5661
+ self._common,
5762

5863
fetchFollowerTotalTimeBreakdown:
59-
g.panel.timeSeries.new('Fetch-follower ($%s)' % config.instanceLabels[0])
64+
g.panel.timeSeries.new('Fetch-follower')
6065
+ g.panel.timeSeries.panelOptions.withDescription(
6166
|||
6267
Total time breakdown for fetch-follower requests.

kafka-observ-lib/signals/totalTime.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function(this)
66
filteringSelector: this.filteringSelector + ', quantile="%s"' % this.totalTimeMsQuantile,
77
groupLabels: this.groupLabels,
88
instanceLabels: this.instanceLabels,
9-
aggLevel: 'instance',
9+
aggLevel: if this.totalTimeMetricsRepeat then 'instance' else 'group',
1010
aggFunction: 'avg',
1111
discoveryMetric: {
1212
prometheus: 'kafka_network_requestmetrics_requestqueuetimems',

0 commit comments

Comments
 (0)