Commit Graph

12 Commits

Author SHA1 Message Date
Bryan Boreham 92a3eeac55
Create less garbage when parsing metrics (#9299)
* Refactor: extract function to make scrapeLoop for testing

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Add benchmarks for ScrapeLoopAppend

For Prometheus and OpenMetrics

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Create less garbage when parsing metrics

Exemplar escapes to heap due to being passed through text-parser
interface, but we can reduce the impact by hoisting it out of the loop
and resetting it after every use.

(Note the cost was paid on every line even when exemplars were disabled)

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Create less garbage when parsing OpenMetrics

After calling parseLVals() we always append the return value, so pass in
what we want to append it to and save garbage.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-09-08 13:39:21 +05:30
cw9 13cd50c52e Return error on NaN and Inf timestamps for OpenMetrics parser
Signed-off-by: cw9 <chaow929@gmail.com>
2021-06-28 20:55:04 -04:00
Ben Kochie 269e7c8091
Fix golint issues.
Signed-off-by: Ben Kochie <superq@gmail.com>
2020-03-23 20:38:43 +01:00
Julien Pivotto 40b66d29ff
OpenMetrics parse: avoid setting prev token (#6781)
We can avoid setting a prev token in the OM parser. The previous
coundition that checked for prev was unreacheable.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-02-07 07:33:26 +00:00
Julien Pivotto 9398b9ac1b OpenMetrics: force input to end with # EOF (#6505)
Fixes #1169

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-12-24 08:48:28 +00:00
shreyassrivatsan e825282dd1 Add exemplar support to the openmetrics parser (#6292)
* Add exemplar support to the openmetrics parser

Signed-off-by: Shreyas Srivatsan <shreyas@chronosphere.io>
2019-11-19 09:33:30 +00:00
zhulongcheng 970ef41bb6 Fix exported function comments (#6002)
Signed-off-by: zhulongcheng <zhulongcheng.dev@gmail.com>
2019-09-10 14:45:09 +01:00
Brian Brazil 94b1af1471
Update to disallow new Go 1.13 float formats. (#5984)
Don't inadvertantly expand the acceptable ways to specify
a float.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-09-05 15:18:18 +01:00
Brian Brazil c66bfce8cf
Don't panic on short input. (#5939)
Fixes #5935

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-08-23 15:44:16 +01:00
Tariq Ibrahim 8fdfa8abea refine error handling in prometheus (#5388)
i) Uses the more idiomatic Wrap and Wrapf methods for creating nested errors.
ii) Fixes some incorrect usages of fmt.Errorf where the error messages don't have any formatting directives.
iii) Does away with the use of fmt package for errors in favour of pkg/errors

Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-26 00:01:12 +01:00
AixesHunter 9f903fb3f7 github.com/cznic/golex has moved to modernc.org/golex (#5034)
Signed-off-by: aixeshunter <aixeshunter@gmail.com>
2018-12-24 23:59:32 +01:00
Brian Brazil 3fdb92010e Expand OM to OpenMetrics
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-10-18 14:16:41 +01:00