Skip to content

Commit

Permalink
Use only module.requestPerSecondMetric variable
Browse files Browse the repository at this point in the history
instead of separate but equal readRequestPerSecondMetric and
writeRequestPerSecondMetric

Signed-off-by: György Krajcsovits <[email protected]>
  • Loading branch information
krajorama committed Apr 4, 2024
1 parent 589c361 commit 10013fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions operations/mimir-mixin/dashboards/dashboard-queries.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
readRequestsPerSecond: 'cortex_request_duration_seconds_count{%(gatewayMatcher)s, route=~"%(readHTTPRoutesRegex)s"}' % variables,

local p = self,
writeRequestsPerSecondMetric: 'cortex_request_duration_seconds',
requestsPerSecondMetric: 'cortex_request_duration_seconds',
writeRequestsPerSecondSelector: '%(gatewayMatcher)s, route=~"%(writeHTTPRoutesRegex)s"' % variables,
readRequestsPerSecondMetric: 'cortex_request_duration_seconds',
readRequestsPerSecondSelector: '%(gatewayMatcher)s, route=~"%(readHTTPRoutesRegex)s"' % variables,

// Write failures rate as percentage of total requests.
Expand All @@ -51,12 +50,12 @@ local utils = import 'mixin-utils/utils.libsonnet';
sum(%(countQuery)s)
|||,
classic: template % {
countFailQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').classic,
countQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector).classic,
countFailQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').classic,
countQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector).classic,
},
native: template % {
countFailQuery: utils.nativeHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').native,
countQuery: utils.nativeHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector).native,
countFailQuery: utils.nativeHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').native,
countQuery: utils.nativeHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector).native,
},
},

Expand Down Expand Up @@ -89,7 +88,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
writeRequestsPerSecond: 'cortex_request_duration_seconds_count{%(distributorMatcher)s, route=~"%(writeGRPCRoutesRegex)s|%(writeHTTPRoutesRegex)s"}' % variables,

local p = self,
writeRequestsPerSecondMetric: 'cortex_request_duration_seconds',
requestsPerSecondMetric: 'cortex_request_duration_seconds',
writeRequestsPerSecondSelector: '%(distributorMatcher)s, route=~"%(writeGRPCRoutesRegex)s|%(writeHTTPRoutesRegex)s"' % variables,
samplesPerSecond: 'sum(%(groupPrefixJobs)s:cortex_distributor_received_samples:rate5m{%(distributorMatcher)s})' % variables,
exemplarsPerSecond: 'sum(%(groupPrefixJobs)s:cortex_distributor_received_exemplars:rate5m{%(distributorMatcher)s})' % variables,
Expand All @@ -108,12 +107,12 @@ local utils = import 'mixin-utils/utils.libsonnet';
sum(%(countQuery)s)
|||,
classic: template % {
countFailQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').classic,
countQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector).classic,
countFailQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').classic,
countQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector).classic,
},
native: template % {
countFailQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').native,
countQuery: utils.nativeClassicHistogramCountRate(p.writeRequestsPerSecondMetric, p.writeRequestsPerSecondSelector).native,
countFailQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector + ',status_code=~"5.*|error"').native,
countQuery: utils.nativeClassicHistogramCountRate(p.requestsPerSecondMetric, p.writeRequestsPerSecondSelector).native,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions operations/mimir-mixin/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"subdir": "grafana-builder"
}
},
"version": "7561fd330312538d22b00e0c7caecb4ba66321ea",
"version": "f95501009c9b29bed87fe9d57c1a6e72e210f137",
"sum": "+z5VY+bPBNqXcmNAV8xbJcbsRA+pro1R3IM7aIY8OlU="
},
{
Expand All @@ -18,7 +18,7 @@
"subdir": "mixin-utils"
}
},
"version": "7561fd330312538d22b00e0c7caecb4ba66321ea",
"version": "f95501009c9b29bed87fe9d57c1a6e72e210f137",
"sum": "0jg7qc3N8FtMnnQbunYCGSNcjHr9Y1krZW9OSTmWcEQ="
}
],
Expand Down

0 comments on commit 10013fc

Please sign in to comment.