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

[BUG] movingWindow not working with time #840

Closed
ljurk opened this issue Aug 20, 2024 · 8 comments · Fixed by #841
Closed

[BUG] movingWindow not working with time #840

ljurk opened this issue Aug 20, 2024 · 8 comments · Fixed by #841
Labels

Comments

@ljurk
Copy link

ljurk commented Aug 20, 2024

Describe the bug
The movingWindow function is not returning data if i use time as an argument(e.g. 1sec, 1min, 1hour). If I use the count, its working.

CarbonAPI Version
1.1.0

Logs
curl request:

2024-08-20T10:56:26.025+0200    INFO    access  request served  {"data": {"handler":"render","carbonapi_uuid":"c0217509-9b88-45e6-a06a-050300646dfd","url":"/render/?target=movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle%2c'10sec')&format=json&from=-1min","peer_ip":"10.89.0.22","peer_port":"43426","host":"nounderscore","format":"json","use_cache":true,"targets":["movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle,'10sec')"],"cache_timeout":60,"metrics":["movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle,'10sec')"],"runtime":0.00189348,"http_code":200,"carbonapi_response_size_bytes":2,"from":1724144126,"until":1724144186,"from_raw":"-1min","uri":"/render/?target=movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle%2c'10sec')&format=json&from=-1min","from_cache":false,"used_backend_cache":false,"request_headers":{}}}

grafana request

2024-08-20T10:56:56.022+0200    INFO    access  request served  {"data": {"handler":"render","carbonapi_uuid":"6ef82394-16bd-40b9-9e1d-8086147319ae","url":"/render","peer_ip":"X.X.X.X","host":"nounderscore","format":"json","use_cache":true,"targets":["movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle, '10min', 'diff')"],"cache_timeout":60,"metrics":["movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle, '10min', 'diff')"],"runtime":0.001968332,"http_code":200,"carbonapi_response_size_bytes":2,"from":1724140614,"until":1724144216,"max_data_points":2089,"from_raw":"1724140614","until_raw":"1724144216","uri":"/render","from_cache":false,"used_backend_cache":false,"request_headers":{}}}

CarbonAPI Configuration:

listen: 0.0.0.0:8081
notFoundStatusCode: 200
cache:
    type: mem
    size_mb: 0
    defaultTimeoutSec: 60
cpus: 0
tz: ''
graphite:
    host: go-carbon:2003
    interval: 60s
    prefix: carbon.api
    pattern: '{prefix}.{fqdn}'
idleConnections: 10
pidFile: ''
upstreams:
    buckets: 10
    timeouts:
        find: 2s
        render: 10s
        connect: 200ms
    concurrencyLimitPerServer: 0
    keepAliveInterval: 30s
    maxIdleConnsPerHost: 100
    backends:
    - http://go-carbon:8080
expireDelaySec: 10
logger:
-   logger: ''
    file: stdout
    level: info
    encoding: console
    encodingTime: iso8601
    encodingDuration: seconds

Simplified query (if applicable)
movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle,'10sec')

Backend response (if possible)

response for time movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle, '10sec')

[]

response for count movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle, 10)

[
 {
   "target": "movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle,10)",
   "datapoints": [
     [
       97.87375164398898,
       1724144790
     ],
     [
       97.87857601723441,
       1724144800
     ],
     [
       97.43791033280638,
       1724144810
     ],
     [
       96.22933981442736,
       1724144820
     ],
     [
       96.54572571912942,
       1724144830
     ],
     [
       97.02278330858039,
       1724144840
     ]
   ],
   "tags": {
     "movingWindow": "10",
     "name": "collectd.ceph.server.ceph_smb1.cpu.percent-idle"
   }
 }
]

other moving* functions seem to function with time, but not movingWindow. I've also saw and ran the tests for the movingWindow-function, the tests are working. I've no idea why

@ljurk ljurk added the bug label Aug 20, 2024
@deniszh
Copy link
Member

deniszh commented Aug 20, 2024

Hi @ljurk
Did you tried e.g. '100s' with data above? Digits means 'number of points', so, 10 means 10 points, so, with 10 sec resolution it should be equivalent of '100s'. '10sec' exactly match resolution, not sure it movingWindow will work in this case.

@ljurk
Copy link
Author

ljurk commented Aug 20, 2024

I tried it, but the result was the same, an empty array. By accident i tried 0s and got a response, even though it doesnt contain datapoints:

[
  {
    "target": "movingWindow(collectd.ceph.server.ceph_smb1.cpu.percent-idle,'0s')",
    "datapoints": [
      [
        null,
        1724151190
      ],
      [
        null,
        1724151200
      ],
      [
        null,
        1724151210
      ],
      [
        null,
        1724151220
      ],
      [
        null,
        1724151230
      ],
      [
        null,
        1724151240
      ]
    ],
    "tags": {
      "movingWindow": "'0s'",
      "name": "collectd.ceph.server.ceph_smb1.cpu.percent-idle"
    }
  }
]

@Civil
Copy link
Member

Civil commented Aug 20, 2024

CarbonAPI Version
1.1.0

Latest version that was tagged is 0.16.1. So I have hard time pinpointing the correct one. ALso that was almost a year ago, so I would encourage to try latest master anyway.

@ljurk
Copy link
Author

ljurk commented Aug 20, 2024

sorry, this returened by /version. Im using the latest master

@Civil
Copy link
Member

Civil commented Aug 20, 2024

sorry, this was returned by /version

That endpoint returns what Grafana would parses for graphite endpoint, and not carbonapi version.

Can you share the raw request (same request, without movingWindow)?

@ljurk
Copy link
Author

ljurk commented Aug 20, 2024

curl "localhost/render/?target=collectd.ceph.server.ceph_smb1.cpu.percent-idle&format=json&from=-1min"

[
  {
    "target": "collectd.ceph.server.ceph_smb1.cpu.percent-idle",
    "datapoints": [
      [
        99.2985971943888,
        1724151640
      ],
      [
        99.6498249124562,
        1724151650
      ],
      [
        98.8476953907816,
        1724151660
      ],
      [
        99.1995997999,
        1724151670
      ],
      [
        99.8997995991984,
        1724151680
      ],
      [
        98.1509245377311,
        1724151690
      ]
    ],
    "tags": {
      "name": "collectd.ceph.server.ceph_smb1.cpu.percent-idle"
    }
  }
]

@ljurk
Copy link
Author

ljurk commented Aug 21, 2024

I forgot to mention, that we have 2 replicated instances: 1 go-carbon/carbonapi and 1 carbon/graphite. Both instances have the same data, the movingWindow-query works in the carbon/graphite instance.

@shanson7
Copy link
Contributor

I think it's because "movingWindow" is not included in this list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants