github.com/thanos-io/thanos@v0.32.5/mixin/lib/thanos-grafana-builder/grpc.libsonnet (about)

     1  local utils = import '../utils.libsonnet';
     2  
     3  {
     4    grpcRequestsPanel(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: '/Aborted/', color: '#EAB839' },
    10        { alias: '/AlreadyExists/', color: '#37872D' },
    11        { alias: '/FailedPrecondition/', color: '#E0B400' },
    12        { alias: '/Unimplemented/', color: '#E0B400' },
    13        { alias: '/InvalidArgument/', color: '#1F60C4' },
    14        { alias: '/NotFound/', color: '#1F60C4' },
    15        { alias: '/PermissionDenied/', color: '#1F60C4' },
    16        { alias: '/Unauthenticated/', color: '#1F60C4' },
    17        { alias: '/Canceled/', color: '#C4162A' },
    18        { alias: '/DataLoss/', color: '#C4162A' },
    19        { alias: '/DeadlineExceeded/', color: '#C4162A' },
    20        { alias: '/Internal/', color: '#C4162A' },
    21        { alias: '/OutOfRange/', color: '#C4162A' },
    22        { alias: '/ResourceExhausted/', color: '#C4162A' },
    23        { alias: '/Unavailable/', color: '#C4162A' },
    24        { alias: '/Unknown/', color: '#C4162A' },
    25        { alias: '/OK/', color: '#37872D' },
    26        { alias: 'error', color: '#C4162A' },
    27      ],
    28      targets: [
    29        {
    30          expr: 'sum by (%s) (rate(%s{%s}[$interval]))' % [utils.joinLabels(aggregatedLabels + ['grpc_method', 'grpc_code']), metric, selector],
    31          format: 'time_series',
    32          intervalFactor: 2,
    33          legendFormat: dimensionsTemplate + ' {{grpc_method}} {{grpc_code}}',
    34          step: 10,
    35        },
    36      ],
    37    } + $.stack,
    38  
    39    grpcErrorsPanel(metric, selector, dimensions)::
    40      $.qpsErrTotalPerLabelPanel(
    41        '%s{grpc_code=~"Unknown|ResourceExhausted|Internal|Unavailable|DataLoss",%s}' % [metric, selector],
    42        '%s{%s}' % [metric, selector],
    43        dimensions,
    44        'grpc_code',
    45      ),
    46  }