Skip to content

Commit

Permalink
Kafka: Set totalTime panels repeat configurable (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-zhuravlev authored Dec 10, 2024
1 parent 30f5ba1 commit 17b80fe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions kafka-observ-lib/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

topicsFilteringSelector: 'topic!="__consumer_offsets"',
consumerGroupFilteringSelector: 'consumergroup!=""',

// whether to use Grafana repeat panel feature for totalTime metrics
// when set to false, metrics are aggregated by cluster group level.
totalTimeMetricsRepeat: true,

zookeeperEnabled: true,
totalTimeMsQuantile: '0.95', // quantile to use for totalTimeMs metrics: 0.50, 0.75, 0.95, 0.98, 0.99, 0.999...
zookeeperClientQuantile: '0.95', // quantile to use for zookeeperClient metrics: 0.50, 0.75, 0.95, 0.98, 0.99, 0.999...
Expand Down
19 changes: 12 additions & 7 deletions kafka-observ-lib/panels/totalTime.libsonnet
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
local g = import '../g.libsonnet';
local commonlib = import 'common-lib/common/main.libsonnet';
local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';
{
new(signals, config):: {

local instanceLabel = xtd.array.slice(config.instanceLabels, -1)[0],
_common::
commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.panelOptions.withRepeat(config.instanceLabels[0])
+ g.panel.timeSeries.panelOptions.withRepeatDirection('v')
+ g.panel.timeSeries.fieldConfig.defaults.custom.withStacking({ mode: 'normal' })
+ g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(0)
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'),
+ g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none')
+ (if config.totalTimeMetricsRepeat then
g.panel.timeSeries.panelOptions.withRepeat(instanceLabel)
+ g.panel.timeSeries.panelOptions.withRepeatDirection('v')
+ { title+: ' ($%s)' % instanceLabel }
else {}),


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

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

fetchFollowerTotalTimeBreakdown:
g.panel.timeSeries.new('Fetch-follower ($%s)' % config.instanceLabels[0])
g.panel.timeSeries.new('Fetch-follower')
+ g.panel.timeSeries.panelOptions.withDescription(
|||
Total time breakdown for fetch-follower requests.
Expand Down
2 changes: 1 addition & 1 deletion kafka-observ-lib/signals/totalTime.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(this)
filteringSelector: this.filteringSelector + ', quantile="%s"' % this.totalTimeMsQuantile,
groupLabels: this.groupLabels,
instanceLabels: this.instanceLabels,
aggLevel: 'instance',
aggLevel: if this.totalTimeMetricsRepeat then 'instance' else 'group',
aggFunction: 'avg',
discoveryMetric: {
prometheus: 'kafka_network_requestmetrics_requestqueuetimems',
Expand Down

0 comments on commit 17b80fe

Please sign in to comment.