diff --git a/kafka-observ-lib/config.libsonnet b/kafka-observ-lib/config.libsonnet index 4ce91fce3..d6c0e07e1 100644 --- a/kafka-observ-lib/config.libsonnet +++ b/kafka-observ-lib/config.libsonnet @@ -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... diff --git a/kafka-observ-lib/panels/totalTime.libsonnet b/kafka-observ-lib/panels/totalTime.libsonnet index 34490432e..8420b74fe 100644 --- a/kafka-observ-lib/panels/totalTime.libsonnet +++ b/kafka-observ-lib/panels/totalTime.libsonnet @@ -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. @@ -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. @@ -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. diff --git a/kafka-observ-lib/signals/totalTime.libsonnet b/kafka-observ-lib/signals/totalTime.libsonnet index f9512eae2..3cd481a8f 100644 --- a/kafka-observ-lib/signals/totalTime.libsonnet +++ b/kafka-observ-lib/signals/totalTime.libsonnet @@ -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',