György Krajcsovits
5ee0980cd1
Add unit test to show that current wrapper is sub-optimal
...
https://github.com/prometheus/prometheus/pull/14978#discussion_r1800755481
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
482bb453c6
Followup to #15164
...
Update test cases
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
machine424
8bcb4d865d
feat: normalize "le" and "quantile" labels values upon ingestion
...
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
Co-authored-by: beorn7 <beorn@grafana.com>
1 month ago
Alex Greenbank
421a3c22ea
scrape: provide a fallback format ( #15136 )
...
scrape: Remove implicit fallback to the Prometheus text format
Remove implicit fallback to the Prometheus text format in case of invalid/missing Content-Type and fail the scrape instead. Add ability to specify a `fallback_scrape_protocol` in the scrape config.
---------
Signed-off-by: alexgreenbank <alex.greenbank@grafana.com>
Signed-off-by: Alex Greenbank <alex.greenbank@grafana.com>
Co-authored-by: Björn Rabenstein <beorn@grafana.com>
1 month ago
machine424
18b81ad79d
feat: ProtobufParse.formatOpenMetricsFloat: improve float formatting by using strconv.AppendFloat instead of fmt.Sprint
...
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
1 month ago
György Krajcsovits
5ee698de2c
Apply review comments
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
Neeraj Gartia
d4b1f9eb33
Corrects the behaviour of binary opperators between histogram and float ( #14726 )
...
promql: corrects binary operators functioning for mixed sample with histogram and float
For invalid pairings of sample types, an annotation is added now.
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
---------
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
1 month ago
György Krajcsovits
d930648afb
Add doc string for NHCBParser
...
Very high level since we'll do a lot of optimizations so not
worth going into details at this time.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
Manik Rana
c3b8582cf4
[PERF] textparse: optimize OM `p.isCreatedSeries()` ( #15150 )
...
* refac: remove p.Metric usage
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* perf: use bytes instead of strings
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: comments
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
---------
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
1 month ago
George Krajcsovits
a1700aab3a
Apply suggestions from code review
...
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
1 month ago
György Krajcsovits
0a40a09da5
Use const instead of -53
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
Manik Rana
032ca9ef96
[PERF] textparse: further optimzations for OM `CreatedTimestamps` ( #15097 )
...
* feat: Added more tests; some changes/optimizations when pair-programming with Bartek.
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: imports
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: gofumpt
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: use an efficient replacement to p.Metric
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: reduce mem allocs + comments
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: gofumpt
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: use single quotes
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* refac: rename
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* refac: rename to seriesHash
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: switch condition order
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* refac: switch condition order
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* feat: stronger checking
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* chore: fmt
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: pass pointer of buf into seriesHash()
Signed-off-by: Manik Rana <manikrana54@gmail.com>
---------
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
1 month ago
György Krajcsovits
9b5d7287bb
Use labels hash to determine change in metric like CT
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
14f92319d9
Add basic benchmark cases for NHCB over OM
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
530e9514b7
Fix case of keeping classic series
...
Make it more obvious that the code in if had side effect.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
8dfa733596
Fix labels handling with dedupelabels tag
...
Use scratch builder.
Use hash compare instead of compare by label.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
f3c8ed2947
minor fixes
...
Fix lint errors.
No need to pre-allocate exemplars.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
fbbf10baad
Use the proper way to iterate labels
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
7fccf1e6be
Disable CT handling and enable exemplar handling
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
e931587bf8
Factor out label compare and store
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
György Krajcsovits
16f28be713
Fix CT handling
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
György Krajcsovits
6bebeaf41b
Fix not checking all labels before deciding to store NHCB
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
György Krajcsovits
2a3aa500e9
Make nhcb unit test pass with many exceptions marked as TODOs
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
György Krajcsovits
e1a7008b6c
Add unit test nhcbparse_test.go
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
Bartlomiej Plotka
f6e110d588
textparse: Refactored main testing utils for reusability; fixed proto Units. ( #15095 )
...
Signed-off-by: bwplotka <bwplotka@gmail.com>
2 months ago
György Krajcsovits
9c4816df36
Rename bType to bName as Type returns the binary name and not the type name
...
See Parser.Type() function.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2 months ago
Bartlomiej Plotka
8d281c3491
textparse: Refactored benchmark ( #15083 )
...
* textparse: Refactored benchmark.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* Kill sinks, tested, nothing is inlined.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
---------
Signed-off-by: bwplotka <bwplotka@gmail.com>
2 months ago
Matthieu MOREL
ab64966e9d
fix: use "ErrorContains" or "EqualError" instead of "Contains(t, err.Error()" and "Equal(t, err.Error()" ( #15094 )
...
* fix: use "ErrorContains" or "EqualError" instead of "Contains(t, err.Error()" and "Equal(t, err.Error()"
---------
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2 months ago
Manik Rana
47aeca9663
feat: naive fixes and optimzations for `CreatedTimestamp` function ( #14965 )
...
* enhance: wip ct parse optimizations
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: further work on optimization
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: further improvements and remove unused code
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: improve optimizations and fix some CT parse errors
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: check for LsetHash along with name
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: cleanup and documentation
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* enhance: improve comments and add cleaner functions
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: improve comments and add cleaner functions
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: rename to resetCTParseValues
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: post-merge fixes
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: add all possible reserved suffixes
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* test: separate CT values for each metric
Signed-off-by: Manik Rana <manikrana54@gmail.com>
---------
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
2 months ago
Manik Rana
f1c57a95ed
change: No longer ingest OM _created as timeseries if feature-flag 'enable-ct-zero-ingestion' is enabled; fixed OM text CT conversion bug ( #14738 )
...
* chore: revert TypeRequiresCT to private
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* feat: init NewOpenMetricsParser with skipCT true
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: allow opt-in to OM CT ingestion
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: lint
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: use textparse interface to set om options
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: set skipOMSeries in test
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: gofumpt
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* wip: add tests for OM CR parse
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: merge ct tests
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* tests: add cases for OM text
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: check correct test cases
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: use both scrape protocols in config
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: fix inputs and output tests for OM
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: cleanup
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: rename skipOMSeries to skipOMCTSeries
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* fix: finish refac
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: move setup code outside test
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* tests: verify _created lines create new metric in certain cases
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* fix: post merge fixes
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: lint
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* manager: Fixed CT OMText conversion bug; Refactored tests.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* chore: lint
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: gofumpt
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: imports
Signed-off-by: Manik Rana <manikrana54@gmail.com>
---------
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: bwplotka <bwplotka@gmail.com>
2 months ago
Manik Rana
98cd80b2e2
feat: add microbenchmarks for OM CT parsing ( #14933 )
...
* test: benchmark OM CT parsing
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: move OM ct benchmark to promparse_test
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: stricter comparison
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
* feat: use richer OM test data
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: move parse-ct test outside of inner loop
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: separate benchmarks for om and prom parsers
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: remove unused code
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* chore: remove more unused code
Signed-off-by: Manik Rana <manikrana54@gmail.com>
* refac: rename to BenchmarkOMParseCreatedTimestamp
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
---------
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <Manikrana54@gmail.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2 months ago
Jeanette Tan
97ba2fc39d
use caps for NHCB
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
f35c6649e4
don't blindly convert series with the classic histogram name suffixes if they are not actually histograms based on metadata
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
e3899187da
expand tests for protobuf and fix problems
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
cd498964e6
expand tests and support conversion to nhcb in the middle of scrape
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
41c7f7d352
don't reuse the buffer
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
57bde06d2c
add doc comments
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
cbd5488cd3
skip nhcb conversion if there is native histogram of same name
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
0e5072b873
keep only 1 nhcb in memory at at time
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Jeanette Tan
172d4f2405
insert nhcb parser as intermediate layer
...
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2 months ago
Bryan Boreham
31c5760551
Neater string vs byte-slice conversions ( #14425 )
...
unsafe.Slice and unsafe.StringData were added in Go 1.20
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2 months ago
Manik Rana
315165e49d
refac: make typeRequiresCT private
...
Signed-off-by: Manik Rana <manikrana54@gmail.com>
2 months ago
Charles Korn
6dbb4e1a94
Fix linting issues
...
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2 months ago
Björn Rabenstein
1639450172
Merge pull request #14821 from charleskorn/nh-negative-multiplication-division
...
promql: correctly handle unary negation of native histograms and add tests for multiplication and division of native histograms by negative scalars
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2 months ago
Mario Fernandez
5814920601
Fix: optimize .* regexp performance
...
Shortcut for `.*` matches newlines as well.
Add preamble change ^(?s:
Add test
dotAll flag por al regex
Add and fix regex tests
Signed-off-by: Mario Fernandez <mariofer@redhat.com>
2 months ago
Nathan Baulch
50cd453c8f
chore: Fix typos ( #14868 )
...
* Fix typos
---------
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2 months ago
Charles Korn
e8c7482137
Return negative counts when multiplied or divided by a negative value
...
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2 months ago
Charles Korn
e67358d203
histogram: include counter reset hint in test expression output
...
Signed-off-by: Charles Korn <charles.korn@grafana.com>
3 months ago
Bryan Boreham
d599c4b28c
[BUGFIX] Protobuf scraping: reset exemplar position
...
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
3 months ago
Bryan Boreham
3aaf2c3c9d
[TESTS] Add second native histogram with exemplars in TestProtobufParse
...
This test fails.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
3 months ago