github.com/thanos-io/thanos@v0.32.5/mixin/dashboards/sidecar.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    sidecar+:: {
     7      selector: error 'must provide selector for Thanos Sidecar dashboard',
     8      title: error 'must provide title for Thanos Sidecar 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.sidecar != null then 'sidecar.json']:
    16        local grpcUnarySelector = utils.joinLabels([thanos.sidecar.dashboard.selector, 'grpc_type="unary"']);
    17        local grpcServerSelector = utils.joinLabels([thanos.sidecar.dashboard.selector, 'grpc_type="server_stream"']);
    18  
    19        g.dashboard(thanos.sidecar.title)
    20        .addRow(
    21          g.row('gRPC (Unary)')
    22          .addPanel(
    23            g.panel('Rate', 'Shows rate of handled Unary gRPC requests from queriers.') +
    24            g.grpcRequestsPanel('grpc_server_handled_total', grpcUnarySelector, thanos.sidecar.dashboard.dimensions)
    25          )
    26          .addPanel(
    27            g.panel('Errors', 'Shows ratio of errors compared to the total number of handled requests from queriers.') +
    28            g.grpcErrorsPanel('grpc_server_handled_total', grpcUnarySelector, thanos.sidecar.dashboard.dimensions)
    29          )
    30          .addPanel(
    31            g.panel('Duration', 'Shows how long has it taken to handle requests from queriers, in quantiles.') +
    32            g.latencyPanel('grpc_server_handling_seconds', grpcUnarySelector, thanos.sidecar.dashboard.dimensions)
    33          )
    34        )
    35        .addRow(
    36          g.row('gRPC (Stream)')
    37          .addPanel(
    38            g.panel('Rate', 'Shows rate of handled Streamed gRPC requests from queriers.') +
    39            g.grpcRequestsPanel('grpc_server_handled_total', grpcServerSelector, thanos.sidecar.dashboard.dimensions)
    40          )
    41          .addPanel(
    42            g.panel('Errors') +
    43            g.grpcErrorsPanel('grpc_server_handled_total', grpcServerSelector, thanos.sidecar.dashboard.dimensions)
    44          )
    45          .addPanel(
    46            g.panel('Duration', 'Shows how long has it taken to handle requests from queriers, in quantiles.') +
    47            g.latencyPanel('grpc_server_handling_seconds', grpcServerSelector, thanos.sidecar.dashboard.dimensions)
    48          )
    49        )
    50        .addRow(
    51          g.row('Last Updated')
    52          .addPanel(
    53            g.panel('Successful Upload', 'Shows the relative time of last successful upload to the object-store bucket.') +
    54            g.tablePanel(
    55              ['time() - max by (%s) (thanos_objstore_bucket_last_successful_upload_time{%s})' % [utils.joinLabels([thanos.sidecar.dashboard.dimensions, 'bucket']), thanos.sidecar.dashboard.selector]],
    56              {
    57                Value: {
    58                  alias: 'Uploaded Ago',
    59                  unit: 's',
    60                  type: 'number',
    61                },
    62              },
    63            )
    64          )
    65        )
    66        .addRow(
    67          g.row('Bucket Operations')
    68          .addPanel(
    69            g.panel('Rate') +
    70            g.queryPanel(
    71              'sum by (%s) (rate(thanos_objstore_bucket_operations_total{%s}[$__rate_interval]))' % [utils.joinLabels([thanos.sidecar.dashboard.dimensions, 'operation']), thanos.sidecar.dashboard.selector],
    72              '{{job}} {{operation}}'
    73            ) +
    74            g.stack
    75          )
    76          .addPanel(
    77            g.panel('Errors') +
    78            g.qpsErrTotalPanel(
    79              'thanos_objstore_bucket_operation_failures_total{%s}' % thanos.sidecar.dashboard.selector,
    80              'thanos_objstore_bucket_operations_total{%s}' % thanos.sidecar.dashboard.selector,
    81              thanos.sidecar.dashboard.dimensions
    82            )
    83          )
    84          .addPanel(
    85            g.panel('Duration') +
    86            g.latencyPanel('thanos_objstore_bucket_operation_duration_seconds', thanos.sidecar.dashboard.selector, thanos.sidecar.dashboard.dimensions)
    87          )
    88        )
    89        .addRow(
    90          g.resourceUtilizationRow(thanos.sidecar.dashboard.selector, thanos.sidecar.dashboard.dimensions)
    91        ),
    92  
    93      __overviewRows__+:: if thanos.sidecar == null then [] else [
    94        g.row('Sidecar')
    95        .addPanel(
    96          g.panel('gRPC (Unary) Rate', 'Shows rate of handled Unary gRPC requests from queriers.') +
    97          g.grpcRequestsPanel('grpc_server_handled_total', utils.joinLabels([thanos.dashboard.overview.selector, 'grpc_type="unary"']), thanos.dashboard.overview.dimensions) +
    98          g.addDashboardLink(thanos.sidecar.title)
    99        )
   100        .addPanel(
   101          g.panel('gRPC (Unary) Errors', 'Shows ratio of errors compared to the total number of handled requests from queriers.') +
   102          g.grpcErrorsPanel('grpc_server_handled_total', utils.joinLabels([thanos.dashboard.overview.selector, 'grpc_type="unary"']), thanos.dashboard.overview.dimensions) +
   103          g.addDashboardLink(thanos.sidecar.title)
   104        )
   105        .addPanel(
   106          g.sloLatency(
   107            'gRPC (Unary) Latency 99th Percentile',
   108            'Shows how long has it taken to handle requests from queriers, in quantiles.',
   109            'grpc_server_handling_seconds_bucket{%s}' % utils.joinLabels([thanos.dashboard.overview.selector, 'grpc_type="unary"']),
   110            thanos.dashboard.overview.dimensions,
   111            0.99,
   112            0.5,
   113            1
   114          ) +
   115          g.addDashboardLink(thanos.sidecar.title)
   116        ),
   117      ],
   118    },
   119  }