I am measuring latency of "/employee/{id}" URI into five histogram buckets 10ms, 50ms, 100ms, 500ms, 1000ms using java library micrometer.
Following are the example of three scarpe with internal of 15 seconds. Within the 15 seconds interval, latency of "/employee/{id}" API calls are grouped into above mentioned five latency buckets and output metrics looks like the following
{"@timestamp": "2019-10-04T17:27:50.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "10", "value": 1}
{"@timestamp": "2019-10-04T17:27:50.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "50", "value": 2}
{"@timestamp": "2019-10-04T17:27:50.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "100", "value": 7}
{"@timestamp": "2019-10-04T17:27:50.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "500", "value": 125}
{"@timestamp": "2019-10-04T17:27:50.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "1000", "value": 1}
{"@timestamp": "2019-10-04T17:28:05.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "10", "value": 0}
{"@timestamp": "2019-10-04T17:28:05.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "50", "value": 1}
{"@timestamp": "2019-10-04T17:28:05.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "100", "value": 3}
{"@timestamp": "2019-10-04T17:28:05.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "500", "value": 134}
{"@timestamp": "2019-10-04T17:28:05.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "1000", "value": 2}
{"@timestamp": "2019-10-04T17:28:20.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "10", "value": 2}
{"@timestamp": "2019-10-04T17:28:20.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "50", "value": 6}
{"@timestamp": "2019-10-04T17:28:20.228Z", "name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "100", "value": 5}
{"@timestamp": "2019-10-04T17:28:20.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "500", "value": 214}
{"@timestamp": "2019-10-04T17:28:20.228Z","name": "http_server_requests_histogram","method": "GET","outcome": "SUCCESS","status": "200","uri": "/employee/{id}","le": "1000", "value": 10}
With this data, i would like to calculate 50%, 95%, 99% percentile latency. Just to explain the usecase, this can be achieved in prometheus using histogram_quantile function https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile