Describe the bug
Some of the time stats reported by unbound through the control socket formats floats incorrectly and this broke unbound_exporter for us. The values are unexpectedly negative and in the wrong format.
Example stats:
$ sudo unbound-control -c /etc/unbound.conf stats_noreset | grep -F '0.-'
thread1.recursion.time.avg=0.-402022313
thread2.recursion.time.avg=0.-1726117941
thread3.recursion.time.avg=0.-1813043235
total.recursion.time.avg=0.-701203423
Prometheus exporter failed to parse these lines:
2021/05/06 16:47:22 Failed to scrape socket: strconv.ParseFloat: parsing "0.-1176731538": invalid syntax
The exporter barfs on the first parse error and reports unbound as down.
$ curl -s 127.0.0.1:10062/metrics | grep unbound_up
# HELP unbound_up Whether scraping Unbound's metrics was successful.
# TYPE unbound_up gauge
unbound_up 0
It's interesting how avg is negative but median is not. That may help us reverse engineer and figure out what happened?
thread1.recursion.time.avg=0.-402022313
thread1.recursion.time.median=0.000276483
I can try to reproduce and find more information if required. Unfortunately the running binary didn't have debug symbols so I couldn't extract all local variables with gdb.
To reproduce
- Not sure yet, will try to isolate the issue and report more stats later.
Expected behavior
- Report time stats in the correct format
- Make sure time stats are always positive.
System:
- Unbound version: Version 1.7.3
- OS: CentOS
I know its an old version, but it doesn't look like the metrics code changed a lot since then. I couldn't find anything related in the changelog either.
Thanks!
Describe the bug
Some of the time stats reported by unbound through the control socket formats floats incorrectly and this broke unbound_exporter for us. The values are unexpectedly negative and in the wrong format.
Example stats:
Prometheus exporter failed to parse these lines:
The exporter barfs on the first parse error and reports unbound as down.
It's interesting how avg is negative but median is not. That may help us reverse engineer and figure out what happened?
I can try to reproduce and find more information if required. Unfortunately the running binary didn't have debug symbols so I couldn't extract all local variables with gdb.
To reproduce
Expected behavior
System:
I know its an old version, but it doesn't look like the metrics code changed a lot since then. I couldn't find anything related in the changelog either.
Thanks!