[TEST] Scraping: Add microbenchmarks for OM CT parsing#14933
[TEST] Scraping: Add microbenchmarks for OM CT parsing#14933bwplotka merged 9 commits intoprometheus:mainfrom
Conversation
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> Signed-off-by: Manik Rana <Manikrana54@gmail.com>
Signed-off-by: Manik Rana <manikrana54@gmail.com>
Signed-off-by: Manik Rana <manikrana54@gmail.com>
|
Still unsure about approach here But I can still add the OM parser with skipCT enabled in |
|
I've spent some time looking at the benchmarks we have today and it seems like we benchmark both parsers with Prometheus-text exposition format. See how the test data doesn't have Fundamentally what we want to benchmark with this PR are things that differentiate OM from Prometheus format, so I think it makes sense to write a separate Benchmark function. What do you think of renaming |
Sounds good to me will |
I would keep only the default behavior (not skipping CT) for PrometheusTxtParse. |
Signed-off-by: Manik Rana <manikrana54@gmail.com>
pushed the changes |
Signed-off-by: Manik Rana <manikrana54@gmail.com>
ArthurSens
left a comment
There was a problem hiding this comment.
Small nit, but LGTM!
@bwplotka could you take a look as well?
Signed-off-by: Manik Rana <manikrana54@gmail.com>
There was a problem hiding this comment.
Thanks, nice!
I wonder if it would make sense to actually clean BenchmarkParse. Perhaps put it in separate benchmark_test.go file, and have a clear 3 cases that always call Created Timestamp (with https://www.bwplotka.dev/2024/go-microbenchmarks-benchstat/ case naming):
for _, in := range []string{"omtestdata.txt", "promtestdata.txt", "promtestdata.nometa.txt"} {
b.Run(fmt.Sprintf("input=%v"), in, func....)
}
Then chose the parser based on input format.
Then you can have cases like case=Series, case=CreatedTimestamp and case=Series+Metric based on methods you are calling.
Does it make sense to have benchmark for skip true and false? Is this really that different between those? I think the main problem is CreatedTimestamp implementation right now, no matter if we skip or not, and I would capture the benchmark for default path (skip = true). We can do adhoc benchmark run with skip = false for testing, but not need to capture this perhaps?
Yes this makes sense. I'll make some changes Although I still feel we can keep a benchmarkParse in omparse and promparse based off which parser we use |
Is this duplication of benchmark code (that ages quickly) worth it? Why? |
bwplotka
left a comment
There was a problem hiding this comment.
Actually, let's do it like that, just name the omtext benchmark a bit more explicitly (: We can improve this one later.
Thanks! LGTM
| "openmetrics": func(b []byte, st *labels.SymbolTable) Parser { | ||
| return NewOpenMetricsParser(b, st) | ||
| }, | ||
| "openmetrics-skip-ct": func(b []byte, st *labels.SymbolTable) Parser { |
There was a problem hiding this comment.
Perhaps it would make sense here to always do openmetrics (no case like that) but have b.Run(fmt.Sprintf("skip-ct=%v", skipCT), ....) case, WDYT?
There was a problem hiding this comment.
yes I agree with that bit
virtually no difference here for both parsers
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com> Signed-off-by: Manik Rana <Manikrana54@gmail.com>
| "openmetrics": func(b []byte, st *labels.SymbolTable) Parser { | ||
| return NewOpenMetricsParser(b, st) | ||
| }, | ||
| "openmetrics-skip-ct": func(b []byte, st *labels.SymbolTable) Parser { |
partially address #14823
Adds openmetrics with ct parsing enabled to
BenchmarkParsecc: @bwplotka @ArthurSens