github.com/thanos-io/thanos@v0.32.5/mixin/rules/store.libsonnet (about) 1 { 2 local thanos = self, 3 store+:: { 4 selector: error 'must provide selector for Thanos Store recording rules', 5 dimensions: std.join(', ', std.objectFields(thanos.targetGroups) + ['job']), 6 }, 7 prometheusRules+:: { 8 groups+: if thanos.store == null then [] else [ 9 { 10 name: 'thanos-store.rules', 11 rules: [ 12 { 13 record: ':grpc_server_failures_per_unary:sum_rate', 14 expr: ||| 15 ( 16 sum by (%(dimensions)s) (rate(grpc_server_handled_total{grpc_code=~"Unknown|Internal|Unavailable|DataLoss|DeadlineExceeded", %(selector)s, grpc_type="unary"}[5m])) 17 / 18 sum by (%(dimensions)s) (rate(grpc_server_started_total{%(selector)s, grpc_type="unary"}[5m])) 19 ) 20 ||| % thanos.store, 21 }, 22 { 23 record: ':grpc_server_failures_per_stream:sum_rate', 24 expr: ||| 25 ( 26 sum by (%(dimensions)s) (rate(grpc_server_handled_total{grpc_code=~"Unknown|Internal|Unavailable|DataLoss|DeadlineExceeded", %(selector)s, grpc_type="server_stream"}[5m])) 27 / 28 sum by (%(dimensions)s) (rate(grpc_server_started_total{%(selector)s, grpc_type="server_stream"}[5m])) 29 ) 30 ||| % thanos.store, 31 }, 32 { 33 record: ':thanos_objstore_bucket_failures_per_operation:sum_rate', 34 expr: ||| 35 ( 36 sum by (%(dimensions)s) (rate(thanos_objstore_bucket_operation_failures_total{%(selector)s}[5m])) 37 / 38 sum by (%(dimensions)s) (rate(thanos_objstore_bucket_operations_total{%(selector)s}[5m])) 39 ) 40 ||| % thanos.store, 41 }, 42 { 43 record: ':thanos_objstore_bucket_operation_duration_seconds:histogram_quantile', 44 expr: ||| 45 histogram_quantile(0.99, 46 sum by (%(dimensions)s, le) (rate(thanos_objstore_bucket_operation_duration_seconds_bucket{%(selector)s}[5m])) 47 ) 48 ||| % thanos.store, 49 labels: { 50 quantile: '0.99', 51 }, 52 }, 53 ], 54 }, 55 ], 56 }, 57 }