The description for the increase function says that it "calculates the increase in the time series in the range vector." So if I have a counter that's only changed in integer increments, I take it to mean that the result of increase should also be an integer. But that's not what I'm seeing.
I have the following, clearly integer, count samples:
$ curl -gs 'localhost:9090/api/v1/query?query=(http_requests_total{job="api"}[10m])'
{
"status":"success",
"data":{
"resultType":"matrix",
"result":[
{
"metric":{
"__name__":"http_requests_total",
"instance":"localhost:8080",
"job":"api",
"method":"foo",
"type":"bar"
},
"values": [
[1494004923.82,"1"],
[1494004938.82,"1"],
[1494004953.82,"1"],
[1494004968.82,"1"],
[1494004983.82,"2"],
[1494004998.82,"2"],
[1494005013.82,"2"],
[1494005028.82,"3"],
[1494005043.82,"3"],
[1494005058.82,"3"],
[1494005073.82,"3"],
[1494005088.82,"4"],
[1494005103.82,"4"],
[1494005118.82,"5"],
[1494005133.82,"5"],
[1494005148.82,"5"],
[1494005163.82,"5"],
[1494005178.82,"5"],
[1494005193.82,"6"],
[1494005208.82,"7"],
[1494005223.82,"7"],
[1494005238.82,"7"],
[1494005253.82,"7"],
[1494005268.82,"7"],
[1494005283.82,"7"],
[1494005298.82,"8"],
[1494005313.82,"8"],
[1494005328.82,"9"],
[1494005343.82,"9"],
[1494005358.82,"9"],
[1494005373.82,"10"],
[1494005388.82,"10"],
[1494005403.82,"10"],
[1494005418.82,"10"],
[1494005433.82,"10"],
[1494005448.82,"10"],
[1494005463.82,"10"],
[1494005478.82,"10"],
[1494005493.82,"11"],
[1494005508.82,"11"]
]
}
]
}
}
But I get non-integer result of "sum(increase(...))":
$ curl -gs 'localhost:9090/api/v1/query?query=sum(increase(http_requests_total{job="api"}[10m]))'
{
"status":"success",
"data":{
"resultType":"vector",
"result":[
{
"metric":{},
"value":[1494005782.193,"9.23076923076923"]
}
]
}
}
(Just "increase" is the same value.)
Environment
System information:
Linux 3.10.0-514.10.2.el7.x86_64 x86_64
Prometheus version:
prometheus, version 1.5.2 (branch: master, revision: bd1182d29f462c39544f94cc822830e1c64cf55b)
build user: root@a8af9200f95d
build date: 20170210-14:41:22
go version: go1.7.5
@cubranic That's intended behavior, see this timestamped part of @brian-brazil's CloudNativeCon talk: https://www.youtube.com/watch?v=67Ulrq6DxwA&t=15m02s
@cubranic That said, this is a frequent question, so we should probably mention that in the increase() and rate() documentation.
Thanks. For the record, the slides are at https://www.slideshare.net/brianbrazil/counting-with-prometheus-cloudnativeconkubecon-europe-2017. Relevant info starts at slide 27.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@cubranic That's intended behavior, see this timestamped part of @brian-brazil's CloudNativeCon talk: https://www.youtube.com/watch?v=67Ulrq6DxwA&t=15m02s