Skip to content

Instantly share code, notes, and snippets.

@geekyfox90
Created March 9, 2020 18:36
Show Gist options
  • Save geekyfox90/5b57430be773c977f1cd22d19e62d3de to your computer and use it in GitHub Desktop.
Save geekyfox90/5b57430be773c977f1cd22d19e62d3de to your computer and use it in GitHub Desktop.
Prometheus adapter configuration for Linkerd
prometheus:
url: http://linkerd-prometheus.linkerd.svc
rules:
default: false
custom:
- seriesQuery: 'response_latency_ms_bucket{namespace!="",pod!=""}'
resources:
template: <<.Resource>>
name:
matches: ^(.*)_bucket$
as: "${1}_50th"
metricsQuery: histogram_quantile(0.50, sum(irate(<<.Series>>{<<.LabelMatchers>>, direction="inbound"}[5m])) by (le, <<.GroupBy>>))
- seriesQuery: 'response_latency_ms_bucket{namespace!="",pod!=""}'
resources:
template: <<.Resource>>
name:
matches: ^(.*)_bucket$
as: "${1}_95th"
metricsQuery: histogram_quantile(0.95, sum(irate(<<.Series>>{<<.LabelMatchers>>, direction="inbound"}[5m])) by (le, <<.GroupBy>>))
- seriesQuery: 'response_latency_ms_bucket{namespace!="",pod!=""}'
resources:
template: <<.Resource>>
name:
matches: ^(.*)_bucket$
as: "${1}_99th"
metricsQuery: histogram_quantile(0.99, sum(irate(<<.Series>>{<<.LabelMatchers>>, direction="inbound"}[5m])) by (le, <<.GroupBy>>))
- seriesQuery: 'response_total{namespace!="",pod!=""}'
resources:
template: <<.Resource>>
name:
matches: "^(.*)_total$"
as: "${1}_per_second"
metricsQuery: |-
sum(
irate(
<<.Series>>{
<<.LabelMatchers>>,
direction="inbound"
}[5m]
)
) by (
<<.GroupBy>>
)
@ahmedig
Copy link

ahmedig commented Oct 6, 2021

Hey @geekyfox90,
read your article on medium https://medium.com/@boukhersy/auto-scale-your-services-with-custom-metrics-bffb071fb51f and cant thank you enough!

Sorry for the dumb question, but why is the metric called response_per_second while in your post you mentioned that you will listen for requests_per_second? Is there a way to get the request per second instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment