github.com/thanos-io/thanos@v0.32.5/mixin/config.libsonnet (about)

     1  {
     2    local thanos = self,
     3    // TargetGroups is a way to help mixin users to add high level target grouping to their alerts and dashboards.
     4    // With the help of TargetGroups you can use a single observability stack to monitor several Thanos instances.
     5    // The key in the key-value pair will be used as "label name" in the alerts and variable name in the dashboards.
     6    // The value in the key-value pair will be used as a query to fetch available values for the given label name.
     7    targetGroups+:: {
     8      // For example for given following groups,
     9      // namespace: 'thanos_status',
    10      // cluster: 'find_mi_cluster_bitte',
    11      // zone: 'an_i_in_da_zone',
    12      // region: 'losing_my_region',
    13      // will generate queriers for the alerts as follows:
    14      //  (
    15      //     sum by (cluster, namespace, region, zone, job) (rate(thanos_compact_group_compactions_failures_total{job=~"thanos-compact.*"}[5m]))
    16      //   /
    17      //     sum by (cluster, namespace, region, zone, job) (rate(thanos_compact_group_compactions_total{job=~"thanos-compact.*"}[5m]))
    18      //   * 100 > 5
    19      //   )
    20      //
    21      // AND for the dashborads:
    22      //
    23      // sum by (cluster, namespace, region, zone, job) (rate(thanos_compact_group_compactions_failures_total{cluster=\"$cluster\", namespace=\"$namespace\", region=\"$region\", zone=\"$zone\", job=\"$job\"}[$interval]))
    24      // /
    25      // sum by (cluster, namespace, region, zone, job) (rate(thanos_compact_group_compactions_total{cluster=\"$cluster\", namespace=\"$namespace\", region=\"$region\", zone=\"$zone\", job=\"$job\"}[$interval]))
    26    },
    27    query+:: {
    28      selector: 'job=~".*thanos-query.*"',
    29      title: '%(prefix)sQuery' % $.dashboard.prefix,
    30    },
    31    queryFrontend+:: {
    32      selector: 'job=~".*thanos-query-frontend.*"',
    33      title: '%(prefix)sQuery Frontend' % $.dashboard.prefix,
    34    },
    35    store+:: {
    36      selector: 'job=~".*thanos-store.*"',
    37      title: '%(prefix)sStore' % $.dashboard.prefix,
    38    },
    39    receive+:: {
    40      selector: 'job=~".*thanos-receive.*"',
    41      title: '%(prefix)sReceive' % $.dashboard.prefix,
    42    },
    43    rule+:: {
    44      selector: 'job=~".*thanos-rule.*"',
    45      title: '%(prefix)sRule' % $.dashboard.prefix,
    46    },
    47    compact+:: {
    48      selector: 'job=~".*thanos-compact.*"',
    49      title: '%(prefix)sCompact' % $.dashboard.prefix,
    50    },
    51    sidecar+:: {
    52      selector: 'job=~".*thanos-sidecar.*"',
    53      thanosPrometheusCommonDimensions: 'namespace, pod',
    54      title: '%(prefix)sSidecar' % $.dashboard.prefix,
    55    },
    56    bucketReplicate+:: {
    57      selector: 'job=~".*thanos-bucket-replicate.*"',
    58      title: '%(prefix)sBucketReplicate' % $.dashboard.prefix,
    59    },
    60    dashboard+:: {
    61      prefix: 'Thanos / ',
    62      tags: ['thanos-mixin'],
    63      timezone: 'UTC',
    64      selector: ['%s="$%s"' % [level, level] for level in std.objectFields(thanos.targetGroups)],
    65      dimensions: ['%s' % level for level in std.objectFields(thanos.targetGroups)],
    66  
    67      overview+:: {
    68        title: '%(prefix)sOverview' % $.dashboard.prefix,
    69        selector: std.join(', ', thanos.dashboard.selector),
    70        dimensions: std.join(', ', thanos.dashboard.dimensions + ['job']),
    71      },
    72    },
    73  }