Matthieu MOREL
af1a19fc78
enable errorf rule from perfsprint linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 weeks ago
György Krajcsovits
eafe72a0d0
perf(nhcb): optimize away most allocations in convertnhcb
...
In general aim for the happy case when the exposer lists the buckets
in ascending order.
Use Compact(2) to compact the result of nhcb convert.
This is more in line with how client_golang optimizes spans vs
buckets.
aef8aedb4b/prometheus/histogram.go (L1485)
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
4 weeks ago
George Krajcsovits
eb3b349024
fix(nhcb): created timestamp fails when keeping classic histograms ( #15218 )
...
The wrong source was used to return the created timestamp, leading to
index out of bound panic. One line fix.
Refactor the requirement test to be generic and be able to
test OpenMetrics and Prom parsers as well.
There are some differencies in what the parsers support, the Prom
parser doesn't have created timestamp.
The protobuf parser uses different formatting to identify the metric
for the scrape loop.
Each parser represents the sample timestamp differently.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
4 weeks ago
George Krajcsovits
469573b13b
fix(nhcb): do not return nhcb from parse if exponential is present ( #15209 )
...
From: https://github.com/prometheus/prometheus/pull/14978#discussion_r1800755481
Also encode the requirement table set in #13532
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
4 weeks ago
George Krajcsovits
2182b83271
feat(nhcb): implement created timestamp handling ( #15198 )
...
Call through to the underlaying parser if we are not in a histogram
and the entry is a series or exponential native histogram. Otherwise store
and retrieve CT for NHCB.
* fix(omparser): losing exemplars when CT is parsed
Fixes : #15137
Ignore exemplars while peeking ahead during CT parsing.
Simplify state reset with defer().
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
4 weeks ago
George Krajcsovits
aa81210c8b
NHCB scrape: refactor state handling and speed up scrape test ( #15193 )
...
* NHCB: scrape use state field and not booleans
From comment https://github.com/prometheus/prometheus/pull/14978#discussion_r1800898724
Also make compareLabels read only and move storeLabels to the first
processed classic histogram series.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* Speed up TestConvertClassicHistogramsToNHCB 3x
Reduce the startup time and timeouts
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* lint fix
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
---------
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
25ef4d3483
benchmark, rename parser omtext_with_nhcb
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
bee1eb7720
goimports run
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
555bd6292a
Better docstring on test
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
a6947e1e6d
Remove omcounterdata.txt as redundant
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
György Krajcsovits
eaee6bacc7
Fix failing benchmarks
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
1 month ago
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
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