# Latency stats via API call?

**URL:** https://discuss.aerospike.com/t/latency-stats-via-api-call/2907
**Category:** Monitoring
**Tags:** latency
**Created:** [May 6, 2016, 4:12pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907 "2016-05-06T16:12:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alicebob](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@alicebob](https://discuss.aerospike.com/u/alicebob)
#### Post date: [May 6, 2016, 4:12pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/1 "2016-05-06T16:12:04Z")

</div>

Hi, I’ve build a simple exporter for prometheus ([http://prometheus.io](http://prometheus.io)), following the logic from asgraphite (it’s basically a few RequestInfo() calls). For latency I use `RequestInfo("latency:")`, which gives me the \>1ms, \>8ms, \>64ms latencies for the last 10 seconds. That works well and gives me something to work with.

However, the aerospike server logs have these detailed latency stats, which asloglatency uses. That’s _great_ for use with prometheus, since it’s exactly what I need to build nice histogram stats.

Are these detailed latency times available from the server via some API call? Preferably via the Go client? I could just tail the log files, but that seems a bit inelegant.

Thanks! Harmen ( [GitHub - alicebob/asprom: Aerospike prometheus exporter](https://github.com/alicebob/asprom) if you’re curious)

---

<div class="post-metadata">

### Author: ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)
#### Post date: [May 6, 2016, 4:40pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/2 "2016-05-06T16:40:40Z")

</div>

See [hist-track-thresholds](http://www.aerospike.com/docs/reference/configuration/#hist-track-thresholds) which allows the configuration of more buckets.

An example of how to configure dynamically:

```auto
asadm -e "asinfo -v 'set-config:context=service;hist-track-thresholds=1,2,4,8,16,32,64,128,256,512,1024'"

```

---

<div class="post-metadata">

### Author: ![alicebob](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@alicebob](https://discuss.aerospike.com/u/alicebob)
#### Post date: [May 6, 2016, 4:46pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/3 "2016-05-06T16:46:31Z")

</div>

Thanks kporter, that already adds some details, I’ll add that option.

But the logs have the latency stats as totals from the start of the server, while this gives them for the last X minutes. It happens to be that those totals are the easiest to work with in Prometheus (it calculates the rates from how the totals change). So it would still be nicest to have access to those.

Thanks!

---

<div class="post-metadata">

### Author: ![Khosrow\_Afroozeh](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@Khosrow\_Afroozeh](https://discuss.aerospike.com/u/Khosrow_Afroozeh)
#### Post date: [May 6, 2016, 4:56pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/4 "2016-05-06T16:56:04Z")

</div>

Maybe your exporter can keep a state?

We also have this page for reference: [http://www.aerospike.com/docs/reference/info/](http://www.aerospike.com/docs/reference/info/)

---

<div class="post-metadata">

### Author: ![alicebob](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@alicebob](https://discuss.aerospike.com/u/alicebob)
#### Post date: [May 6, 2016, 5:03pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/5 "2016-05-06T17:03:19Z")

</div>

I can’t find the raw totals in there. I know there data is kept track of in the server, since it prints them to the logs.

But it’s fine as it is, the increased details via hist-track-treshholds is already an improvement. Thanks!

---

<div class="post-metadata">

### Author: ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)
#### Post date: [May 6, 2016, 5:57pm UTC](https://discuss.aerospike.com/t/latency-stats-via-api-call/2907/6 "2016-05-06T17:57:36Z")

</div>

Sorry the raw numbers aren’t exposed via info at this time.
