Tyk API Metrics from Pump to Prometheus

We are trying to extract the metrics from Tyk Gateway to Prometheus. We see below metrics from Prometheus metrics endpoint. Here it says Tyk, Total Latency, and upstream latency per API but we see type as total in all.

Which one here is Tyk Gateway latency, Total and upstream latency?

# HELP tyk_latency Latency added by Tyk, Total Latency, and upstream latency per API
# TYPE tyk_latency histogram
tyk_latency_bucket{api="sampleapi",type="total",le="1"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="2"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="5"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="7"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="10"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="15"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="20"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="25"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="30"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="40"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="50"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="60"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="70"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="80"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="90"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="100"} 0
tyk_latency_bucket{api="sampleapi",type="total",le="200"} 106
tyk_latency_bucket{api="sampleapi",type="total",le="300"} 115
tyk_latency_bucket{api="sampleapi",type="total",le="400"} 137
tyk_latency_bucket{api="sampleapi",type="total",le="500"} 149
tyk_latency_bucket{api="sampleapi",type="total",le="1000"} 201
tyk_latency_bucket{api="sampleapi",type="total",le="2000"} 288
tyk_latency_bucket{api="sampleapi",type="total",le="5000"} 386
tyk_latency_bucket{api="sampleapi",type="total",le="10000"} 593
tyk_latency_bucket{api="sampleapi",type="total",le="30000"} 1098
tyk_latency_bucket{api="sampleapi",type="total",le="60000"} 2580
tyk_latency_bucket{api="sampleapi",type="total",le="+Inf"} 5049
tyk_latency_sum{api="sampleapi",type="total"} 3.42843741e+08
tyk_latency_count{api="sampleapi",type="total"} 5049

I think the doc in the code is a bit misleading here.

What you are seeing is a histogram of all of the round trip request times recorded over the 5049 requests made here. Each bucket is an upper bound in terms of milliseconds that the roundtrip took. So 0 requests were made with under 100ms RTT and 106 with under 200ms RTT and so on and so forth. If you have a more desired behaviour for the prometheus pump please feel free to open a ticket on the repo!

The sum value is actually useless as it just sums all of the RTT over all requests. An average makes more sense to have.

Thanks
Josh