@@ -161,51 +161,45 @@ local utils = import 'mixin-utils/utils.libsonnet';
161161    type:  'text' ,
162162  } + options,
163163
164-   objectStorePanels1(title, metricPrefix):: 
165-     local  opsTotal = '%s_thanos_objstore_bucket_operations_total'  % [metricPrefix];
166-     local  opsTotalFailures = '%s_thanos_objstore_bucket_operation_failures_total'  % [metricPrefix];
167-     local  operationDuration = '%s_thanos_objstore_bucket_operation_duration_seconds'  % [metricPrefix];
164+   objectStorePanels1(title, component):: 
168165    super .row(title)
169166    .addPanel(
170-       // We use 'up' to add 0 if there are no failed operations. 
171-       self .successFailurePanel(
172-         'Operations/sec' ,
173-         'sum(rate(%s{%s}[$__interval])) - sum(rate(%s{%s}[$__interval]) or (up{%s}*0))'  % [opsTotal, $.namespaceMatcher(), opsTotalFailures, $.namespaceMatcher(), $.namespaceMatcher()],
174-         'sum(rate(%s{%s}[$__interval]) or (up{%s}*0))'  % [opsTotalFailures, $.namespaceMatcher(), $.namespaceMatcher()]
175-       )
167+       $.panel('Operations / sec' ) +
168+       $.queryPanel('sum by(operation) (rate(thanos_objstore_bucket_operations_total{%s,component="%s"}[$__interval]))'  % [$.namespaceMatcher(), component], '{{operation}}' ) +
169+       $.stack +
170+       { yaxes:  $.yaxes('rps' ) },
176171    )
177172    .addPanel(
178-       $.panel('Op: ObjectSize' ) +
179-       $.latencyPanel(operationDuration, '{%s, operation="objectsize"}'  % $.namespaceMatcher()),
173+       $.panel('Error rate' ) +
174+       $.queryPanel('sum by(operation) (rate(thanos_objstore_bucket_operation_failures_total{%s,component="%s"}[$__interval])) / sum by(operation) (rate(thanos_objstore_bucket_operations_total{%s,component="%s"}[$__interval]))'  % [$.namespaceMatcher(), component, $.namespaceMatcher(), component], '{{operation}}' ) +
175+       { yaxes:  $.yaxes('percentunit' ) },
180176    )
181177    .addPanel(
182-       // Cortex (Thanos) doesn't track timing for 'iter', so we use ops/sec instead. 
183-       $.panel('Op: Iter' ) +
184-       $.queryPanel('sum(rate(%s{%s, operation="iter"}[$__interval]))'  % [opsTotal, $.namespaceMatcher()], 'ops/sec' )
178+       $.panel('Op: ObjectSize' ) +
179+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s",operation="objectsize"}'  % [$.namespaceMatcher(), component]),
185180    )
186181    .addPanel(
187182      $.panel('Op: Exists' ) +
188-       $.latencyPanel(operationDuration , '{%s,  operation="exists"}'  % $.namespaceMatcher()),
183+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s", operation="exists"}'  % [ $.namespaceMatcher(), component] ),
189184    ),
190185
191186  // Second row of Object Store stats 
192-   objectStorePanels2(title, metricPrefix):: 
193-     local  operationDuration = '%s_thanos_objstore_bucket_operation_duration_seconds'  % [metricPrefix];
187+   objectStorePanels2(title, component):: 
194188    super .row(title)
195189    .addPanel(
196190      $.panel('Op: Get' ) +
197-       $.latencyPanel(operationDuration , '{%s,  operation="get"}'  % $.namespaceMatcher()),
191+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s", operation="get"}'  % [ $.namespaceMatcher(), component] ),
198192    )
199193    .addPanel(
200194      $.panel('Op: GetRange' ) +
201-       $.latencyPanel(operationDuration , '{%s,  operation="get_range"}'  % $.namespaceMatcher()),
195+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s", operation="get_range"}'  % [ $.namespaceMatcher(), component] ),
202196    )
203197    .addPanel(
204198      $.panel('Op: Upload' ) +
205-       $.latencyPanel(operationDuration , '{%s,  operation="upload"}'  % $.namespaceMatcher()),
199+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s", operation="upload"}'  % [ $.namespaceMatcher(), component] ),
206200    )
207201    .addPanel(
208202      $.panel('Op: Delete' ) +
209-       $.latencyPanel(operationDuration , '{%s,  operation="delete"}'  % $.namespaceMatcher()),
203+       $.latencyPanel('thanos_objstore_bucket_operation_duration_seconds' , '{%s,component="%s", operation="delete"}'  % [ $.namespaceMatcher(), component] ),
210204    ),
211205}
0 commit comments