github.com/thanos-io/thanos@v0.32.5/mixin/lib/thanos-grafana-builder/http.libsonnet (about) 1 local utils = import '../utils.libsonnet'; 2 3 { 4 httpQpsPanel(metric, selector, dimensions):: { 5 local aggregatedLabels = std.split(dimensions, ','), 6 local dimensionsTemplate = std.join(' ', ['{{%s}}' % std.stripChars(label, ' ') for label in aggregatedLabels]), 7 8 seriesOverrides: [ 9 { alias: '/1../', color: '#EAB839' }, 10 { alias: '/2../', color: '#37872D' }, 11 { alias: '/3../', color: '#E0B400' }, 12 { alias: '/4../', color: '#1F60C4' }, 13 { alias: '/5../', color: '#C4162A' }, 14 ], 15 16 targets: [ 17 { 18 expr: 'sum by (%s) (rate(%s{%s}[$interval]))' % [utils.joinLabels(aggregatedLabels + ['handler', 'code']), metric, selector], 19 format: 'time_series', 20 intervalFactor: 2, 21 legendFormat: dimensionsTemplate + ' {{handler}} {{code}}', 22 step: 10, 23 }, 24 ], 25 } + $.stack, 26 27 httpErrPanel(metric, selector, dimensions):: 28 $.qpsErrTotalPerLabelPanel( 29 '%s{%s,code=~"5.."}' % [metric, selector], 30 '%s{%s}' % [metric, selector], 31 dimensions, 32 'code', 33 ), 34 }