github.com/thanos-io/thanos@v0.32.5/mixin/dashboards/query-frontend.libsonnet (about) 1 local g = import '../lib/thanos-grafana-builder/builder.libsonnet'; 2 local utils = import '../lib/utils.libsonnet'; 3 4 { 5 local thanos = self, 6 queryFrontend+:: { 7 selector: error 'must provide selector for Thanos Query Frontend dashboard', 8 title: error 'must provide title for Thanos Query Frontend dashboard', 9 dashboard:: { 10 selector: std.join(', ', thanos.dashboard.selector + ['job=~"$job"']), 11 dimensions: std.join(', ', thanos.dashboard.dimensions + ['job']), 12 }, 13 }, 14 grafanaDashboards+:: { 15 [if thanos.queryFrontend != null then 'query-frontend.json']: 16 local queryFrontendHandlerSelector = utils.joinLabels([thanos.queryFrontend.dashboard.selector, 'handler="query-frontend"']); 17 local queryFrontendOpSelector = utils.joinLabels([thanos.queryFrontend.dashboard.selector, 'op="query_range"']); 18 g.dashboard(thanos.queryFrontend.title) 19 .addRow( 20 g.row('Query Frontend API') 21 .addPanel( 22 g.panel('Rate of requests', 'Shows rate of requests against Query Frontend for the given time.') + 23 g.httpQpsPanel('http_requests_total', queryFrontendHandlerSelector, thanos.queryFrontend.dashboard.dimensions) 24 ) 25 .addPanel( 26 g.panel('Rate of queries', 'Shows rate of queries passing through Query Frontend') + 27 g.httpQpsPanel('thanos_query_frontend_queries_total', queryFrontendOpSelector, thanos.queryFrontend.dashboard.dimensions) 28 ) 29 .addPanel( 30 g.panel('Errors', 'Shows ratio of errors compared to the total number of handled requests against Query Frontend.') + 31 g.httpErrPanel('http_requests_total', queryFrontendHandlerSelector, thanos.queryFrontend.dashboard.dimensions) 32 ) 33 .addPanel( 34 g.panel('Duration', 'Shows how long has it taken to handle requests in quantiles.') + 35 g.latencyPanel('http_request_duration_seconds', queryFrontendHandlerSelector, thanos.queryFrontend.dashboard.dimensions) 36 ) 37 ) 38 .addRow( 39 g.row('Cache Operations') 40 .addPanel( 41 g.panel('Requests', 'Show rate of cache requests.') + 42 g.queryPanel( 43 'sum by (%s) (rate(cortex_cache_request_duration_seconds_count{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.queryFrontend.dashboard.dimensions, 'tripperware']), thanos.queryFrontend.dashboard.selector], 44 '{{job}} {{tripperware}}', 45 ) + 46 g.stack 47 ) 48 .addPanel( 49 g.panel('Querier cache gets vs misses', 'Show rate of Querier cache gets vs misses.') + 50 g.queryPanel( 51 'sum by (%s) (rate(querier_cache_gets_total{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.queryFrontend.dashboard.dimensions, 'tripperware']), thanos.queryFrontend.dashboard.selector], 52 'Cache gets - {{job}} {{tripperware}}', 53 ) + 54 g.queryPanel( 55 'sum by (%s) (rate(querier_cache_misses_total{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.queryFrontend.dashboard.dimensions, 'tripperware']), thanos.queryFrontend.dashboard.selector], 56 'Cache misses - {{job}} {{tripperware}}', 57 ) + 58 g.stack 59 ) 60 .addPanel( 61 g.panel('Cortex fetched keys', 'Shows rate of cortex fetched keys.') + 62 g.queryPanel( 63 'sum by (%s) (rate(cortex_cache_fetched_keys_total{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.queryFrontend.dashboard.dimensions, 'tripperware']), thanos.queryFrontend.dashboard.selector], 64 '{{job}} {{tripperware}}', 65 ) + 66 g.stack 67 ) 68 .addPanel( 69 g.panel('Cortex cache hits', 'Shows rate of cortex cache hits.') + 70 g.queryPanel( 71 'sum by (%s) (rate(cortex_cache_hits_total{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.queryFrontend.dashboard.dimensions, 'tripperware']), thanos.queryFrontend.dashboard.selector], 72 '{{job}} {{tripperware}}', 73 ) + 74 g.stack 75 ) 76 ) 77 .addRow( 78 g.resourceUtilizationRow(thanos.queryFrontend.dashboard.selector, thanos.queryFrontend.dashboard.dimensions) 79 ), 80 }, 81 }