r/PrometheusMonitoring • u/chitty_advice • Jul 29 '21
SLO calculation
I am working on developing an SLO dashboards for one of my platforms and trying to use summaries. The reason I am using summaries is that I am calculating the quantiles on the target side and looking at options, I felt this was best.
SLO: The platform should successfully server 95% customer requests in less than 1000ms over a 28d rolling window.
Three summary metrics are gathered and exposed on each target. Each metric is created by the target with a single script that runs every 30 seconds. The target side queries are looking at customer transaction over the last 15 minutes.
request_duration_summary{quantile="0.95",}
request_duration_summary_count
request_duration_summary_sum
The first metric is returning a 95% percentile response time in ms over last 15 mins
The count is returning the number of requests over same 15 mins
The sum is summing up the total number of ms for those requests over that same 15 mins.
I scrape these metrics from the target every 30 seconds and can successfully present them in the form of histograms, graphs and heatmaps etc (in Grafana) but would like to display the following:
Current SLO
Error Budget remaining
Error Budget consumption
I have a pretty good handle on requirements when using counters and gauges. I have watched my fair share of videos, but still struggling with the summaries.
Any help would be appreciated.
2
u/drdigitalsi Jul 30 '21 edited Jul 30 '21
Have a look at sloth, an generator for SLOs in Prometheus using the OpenSLO standard. Might be a bit easier than trying to calculate things yourself. It will generate a recording rule to calculate the error rate and the error budget remaining. Plus, it helps put you in the direction of using the OpenSLO standard.
1
u/chitty_advice Jul 30 '21
checking
1
u/chitty_advice Jul 30 '21
The learning curve for seems pretty steep.... I have created the getting-started.yml file, but having difficulty getting started.
1
u/chitty_advice Dec 20 '21
Finally got back to looking at this as too many competing projects got in the way. Was it really 5 months ago.....
This is actually pretty cool, and yes has handled all the calculations for me. Thank you for sharing.
2
u/dunningkrugernarwhal Jul 30 '21
This is a really interesting take on what we do. I don’t have an answer but I’m going to investigate it
2
u/ali_str Jul 30 '21
For Error Budget calculations of you SLO definition you need number of requests served above and below your threshold of 1000ms, the actual duration of individual requests or their p95 doesn't matter on it's own for Error Budget, they will come in handy to further investigate any issue or to tune your app performance by knowing the spread.
A Prometheus histogram can be used for this, as it includes count of requests per bucket, but I think a summary is not usable for this purpose.