Search code examples
goprometheusmetrics

Prometheus Summary quantiles errors


I want to create Prometheus Summary in golang service. And to set quantiles there. Quantiles are set my map of quantile ranks and corresponding absolute errors. I.e. (from example)

map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}

I want to add 0.25 quantile. What error value is correct?


Solution

  • As far as I understood, you just wanna add 0.25 quantile to your objectives:

    Objectives: map[float64]float64{0.25: 0.01, 0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
    

    As this is a statistical approximation with error, there is no strict formula for finding the optimal error value. That's a trade-off between accuracy and performance (of calculation of the query). 0.001, 0.01, 0.05, etc are common, but you need to consider your own data distribution (skewed, normal, etc), client-side performance cost, use cases, SLOs, etc. Maybe you need to do it spirally to get your optimal.