Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surprising (incorrect?) behaviour of "increase" function #2683

Closed
cubranic opened this Issue May 5, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@cubranic
Copy link

cubranic commented May 5, 2017

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
    
@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented May 5, 2017

@cubranic That's intended behavior, see this timestamped part of @brian-brazil's CloudNativeCon talk: https://www.youtube.com/watch?v=67Ulrq6DxwA&t=15m02s

@juliusv juliusv closed this May 5, 2017

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented May 5, 2017

@cubranic That said, this is a frequent question, so we should probably mention that in the increase() and rate() documentation.

@cubranic

This comment has been minimized.

Copy link
Author

cubranic commented May 8, 2017

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.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

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.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.