Julien Pivotto
ad2f81ef6d
textparse: fix parseLVals to only treat quoted strings as metric names
...
When a label-name position is followed by comma or brace-close, only
treat it as a metric name shorthand if the token was a double-quoted
string (tQString). Bare identifiers must be followed by an equal sign.
Add tests for bare identifier inputs that previously could panic.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com >
2026-03-05 15:07:42 +01:00
Matthieu MOREL
45b9329e68
chore: fix emptyStringTest issues from gocritic ( #18226 )
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2026-03-04 08:24:50 +01:00
Ben Kochie
e14795bbf4
Remove copyright date from headers ( #17785 )
...
Remove copyright dates from various files as part of [PROM-50].
[PROM-50]: https://github.com/prometheus/proposals/blob/main/proposals/0050-remove-copyright-dates.md
Signed-off-by: SuperQ <superq@gmail.com >
2026-01-05 13:46:21 +01:00
Björn Rabenstein
b8d19543b8
Add histogram validation in remote-read and during reducing resolution ( #17561 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
ReduceResolution is currently called before validation during
ingestion. This will cause a panic if there are not enough buckets in
the histogram. If there are too many buckets, the spurious buckets are
ignored, and therefore the error in the input histogram is masked.
Furthermore, invalid negative offsets might cause problems, too.
Therefore, we need to do some minimal validation in reduceResolution.
Fortunately, it is easy and shouldn't slow things down. Sadly, it
requires to return errors, which triggers a bunch of code changes.
Even here is a bright side, we can get rud of a few panics. (Remember:
Don't panic!)
In different news, we haven't done a full validation of histograms
read via remote-read. This is not so much a security concern (as you
can throw off Prometheus easily by feeding it bogus data via
remote-read) but more that remote-read sources might be makeshift and
could accidentally create invalid histograms. We really don't want to
panic in that case. So this commit does not only add a check of the
spans and buckets as needed for resolution reduction but also a full
validation during remote-read.
Signed-off-by: beorn7 <beorn@grafana.com >
2025-11-21 00:22:24 +01:00
Grégoire
1174b0ce4f
model/textparse: Remove unit validation in protobuf parsing ( #16834 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
Stale Check / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Signed-off-by: Gregoire Verdier <gregoire.verdier@gmail.com >
2025-11-19 14:03:32 +01:00
Bartlomiej Plotka
f50ff0a40a
feat: rename CreatedTimestamp to StartTimestamp ( #17523 )
...
Partially fixes https://github.com/prometheus/prometheus/issues/17416 by
renaming all CT* names to ST* in the whole codebase except RW2 (this is
done in separate
[PR](https://github.com/prometheus/prometheus/pull/17411 )) and
PrometheusProto exposition proto.
```
CreatedTimestamp -> StartTimestamp
CreatedTimeStamp -> StartTimestamp
created_timestamp -> start_timestamp
CT -> ST
ct -> st
```
Signed-off-by: bwplotka <bwplotka@gmail.com >
2025-11-13 14:17:51 +00:00
Ben Kochie
204249fcb5
Update golangci-lint ( #17478 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
Stale Check / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
* Update golangci-lint to v2.6.0
* Fixup various linting issues.
* Fixup deprecations.
* Add exception for `labels.MetricName` deprecation.
Signed-off-by: SuperQ <superq@gmail.com >
2025-11-05 13:47:34 +01:00
Ben Kochie
48956f60d7
Update modernize ( #17471 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Apply additional Go modernize tool improvements.
Signed-off-by: SuperQ <superq@gmail.com >
2025-11-04 05:13:49 +00:00
George Krajcsovits
37418b5910
Merge pull request #17166 from Naman-B-Parlecha/NamanParlecha/NHCBtoCH
...
Unroll NHCBs to Classic Histograms func for RW
2025-10-30 08:44:26 +01:00
beorn7
ad7d1aed99
Phase out native histogram feature flag
...
The detailed plan for this is laid out in
https://github.com/prometheus/prometheus/issues/16572 .
This commit adds a global and local scrape config option
`scrape_native_histograms`, which has to be set to true to ingest
native histograms.
To ease the transition, the feature flag is changed to simply set the
default of `scrape_native_histograms` to true.
Further implications:
- The default scrape protocols now depend on the
`scrape_native_histograms` setting.
- Everywhere else, histograms are now "on by default".
Documentation beyond the one for the feature flag and the scrape
config are deliberately left out. See
https://github.com/prometheus/prometheus/pull/17232 for that.
Signed-off-by: beorn7 <beorn@grafana.com >
2025-10-15 14:50:52 +02:00
NamanParlecha
167cb350f1
Merge branch 'prometheus:main' into NamanParlecha/NHCBtoCH
2025-10-10 18:59:53 +05:30
Bartlomiej Plotka
a4da440dad
fix: Fix slicelabels corruption when used with proto decoding ( #17150 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
* fix: Fix slicelabels corruption when used with proto decoding
Alternative to https://github.com/prometheus/prometheus/pull/16957/
Signed-off-by: bwplotka <bwplotka@gmail.com >
* addressed comments
Signed-off-by: bwplotka <bwplotka@gmail.com >
---------
Signed-off-by: bwplotka <bwplotka@gmail.com >
2025-10-07 12:06:48 +01:00
Naman-B-Parlecha
083d0fa835
refactor(convert): updated tests and moved formatOpenMetricsFloat
...
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
2025-10-06 22:56:45 +05:30
NamanParlecha
594f9d63a5
refactor(textparse): Introduce Variadic options in textParse.New ( #17155 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
Stale Check / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
* refactor(textparse): introduce ParserOptions struct for cleaner parser initialization
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(fuzz): update fuzzParseMetricWithContentType to use ParserOptions
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): simplify ParserOptions usage in tests and implementations
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parse): using variadic options
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): add fallbackType & SymbolTable to variadic options
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): private fields
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(scrape): compose parser options
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): add comments
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): update to use ParserOptions struct for configuration
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(scrape): remove unused parserOptions field from scrapeLoop
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
* refactor(parser): update ParserOptions field names and add comments for clarity
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
---------
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com >
2025-09-11 10:49:42 +01:00
George Krajcsovits
acd9aa0afb
fix(textparse/protobuf): metric family name corrupted by NHCB parser ( #17156 )
...
* fix(textparse): implement NHCB parsing in ProtoBuf parser directly
The NHCB conversion does some validation, but we can only return error
from Parser.Next() not Parser.Histogram(). So the conversion needs to
happen in Next().
There are 2 cases:
1. "always_scrape_classic_histograms" is enabled, in which case we
convert after returning the classic series. This is to be consistent
with the PromParser text parser, which collects NHCB while spitting out
classic series; then returns the NHCB.
2. "always_scrape_classic_histograms" is disabled. In which case we never
return the classic series.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
* refactor(textparse): skip classic series instead of adding NHCB around
Do not return the first classic series from the EntryType state,
switch to EntrySeries. This means we need to start the histogram
field state from -3 , not -2.
In EntrySeries, skip classic series if needed.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
* reuse nhcb converter
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
* test(textparse/nhcb): test corrupting metric family name
NHCB parse doesn't always copy the metric name from the underlying
parser. When called via HELP, UNIT, the string is directly referenced
which means that the read-ahead of NHCB can corrupt it.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2025-09-08 17:26:41 +02:00
George Krajcsovits
31e4d84edd
refactor(textparse): allow for parsers with direct NHCB support ( #17153 )
...
Hide adding NHCB parser on top another parser in New() function
so we can easily add direct NHCB capable parsers.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2025-09-06 11:45:44 +02:00
beorn7
747c5ee2b1
Apply analyzer "modernize" to the whole codebase
...
See
https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize
for details.
This ran into a few issues (arguably bugs in the modernize tool),
which I will fix in the next commit, so that we have transparency what
was done automatically.
Beyond those hiccups, I believe all the changes applied are
legitimate. Even where there might be no tangible direct gain, I would
argue it's still better to use the "modern" way to avoid micro
discussions in tiny style PRs later.
Signed-off-by: beorn7 <beorn@grafana.com >
2025-08-27 14:48:41 +02:00
Arve Knudsen
0a40df33fb
Make metric/label name validation scheme explicit ( #16928 )
...
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
* Parameterize metric/label name validation scheme
Parameterized metric/label name validation scheme
---------
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
Co-authored-by: Julius Hinze <julius.hinze@grafana.com >
2025-08-18 08:09:00 +00:00
Matthieu MOREL
cef219c31c
chore: enable unused-receiver rule from revive
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-08-04 09:43:33 +00:00
Bryan Boreham
d9e5748a27
[REFACTOR] Scraping: Remove unnecessary yolostring calls ( #16927 )
...
Go will not allocate when reading from a map with a key cast from []byte to string.
Also remove some yoloString calls in package `textparse` - call a more suitable library function.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com >
2025-07-28 14:54:32 +01:00
György Krajcsovits
85d63ba861
refactor(nhcb): get rid of extra lastHistogramExponential state
...
and make it a regular state of inhibiting NHCB conversion.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2025-06-11 20:06:38 +02:00
György Krajcsovits
3844a21738
fix(nhcb): do not loose NHCB after exponential with different labels
...
The problem happens when we parse a standalone native histogram, which
sets the p.lastHistogramExponential state flag. We never unset it.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2025-06-11 19:48:56 +02:00
machine424
50a6efd5ec
fix(model/textparse): Labels(): copy the input to avoid dangling references
...
Signed-off-by: machine424 <ayoubmrini424@gmail.com >
2025-05-23 11:03:48 +02:00
Bartlomiej Plotka
8e6b008608
feature: type-and-unit-labels (PROM-39 implementation) ( #16228 )
...
* feature: type-and-unit-labels (extended MetricIdentity)
Experimental implementation of https://github.com/prometheus/proposals/pull/39
Previous (unmerged) experiments:
* https://github.com/prometheus/prometheus/compare/main...dashpole:prometheus:type_and_unit_labels
* https://github.com/prometheus/prometheus/pull/16025
Signed-off-by: bwplotka <bwplotka@gmail.com >
feature: type-and-unit-labels (extended MetricIdentity)
Experimental implementation of https://github.com/prometheus/proposals/pull/39
Previous (unmerged) experiments:
* https://github.com/prometheus/prometheus/compare/main...dashpole:prometheus:type_and_unit_labels
* https://github.com/prometheus/prometheus/pull/16025
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Fix compilation errors
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com >
Lint
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com >
Revert change made to protobuf 'Accept' header
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com >
Fix compilation errors for 'dedupelabels' tag
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com >
* Rectored into schema.Metadata
Signed-off-by: bwplotka <bwplotka@gmail.com >
* texparse: Added tests for PromParse
Signed-off-by: bwplotka <bwplotka@gmail.com >
* add OM tests.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* add proto tests
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* add schema label tests.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* fix tests.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* add promql tests.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* lint
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com >
---------
Signed-off-by: bwplotka <bwplotka@gmail.com >
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com >
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com >
2025-05-17 09:37:25 +00:00
Rafal Rosa
c7ea28c36b
parser: remove expired link from comment ( #16189 )
...
* Replace OpenMetrics link with the current specification
---------
Signed-off-by: pomyslowynick <dark0mlet@gmail.com >
Signed-off-by: Rafal Rosa <dark0mlet@gmail.com >
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com >
2025-03-23 12:41:48 +01:00
Matthieu MOREL
5fa1146e21
chore: enable gci linter ( #16245 )
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-03-22 15:46:13 +00:00
Owen Williams
94b43c5d4c
utf8: Remove support for legacy global validation setting
...
Global and Data Source configurations can specify legacy mode, but Prometheus now requires that the overall validation mode be set to UTF-8
Signed-off-by: Owen Williams <owen.williams@grafana.com >
2025-03-13 10:47:24 -04:00
Bartlomiej Plotka
dc85d677d8
textparse: Optimize CreatedTimestamp; It returns int64 value now. ( #16072 )
...
..instead of *int64. This is as an optimization and ease of use. We already
accepted in many places (proto histograms, PRW) that CT (or any timestamp really) 0
means not set.
Signed-off-by: bwplotka <bwplotka@gmail.com >
2025-03-07 12:43:13 +00:00
Matthieu MOREL
c7d4b53ec1
chore: enable unused-parameter from revive
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-02-19 19:50:28 +01:00
Bartlomiej Plotka
733a5e9eb4
textparse: Optimized protobuf parser with custom streaming unmarshal. ( #15731 )
...
* textparse: Optimized protobuf parser with custom streaming decoder.
Signed-off-by: bwplotka <bwplotka@gmail.com >
Update model/textparse/protobufparse.go
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
Addressing comments.
Signed-off-by: bwplotka <bwplotka@gmail.com >
decoder: reuse histograms and summaries.
Signed-off-by: bwplotka <bwplotka@gmail.com >
optimize help returning (5% of mem utilization).
Signed-off-by: bwplotka <bwplotka@gmail.com >
Apply suggestions from code review
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
Update prompb/io/prometheus/client/decoder.go
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
Fix build.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Update model/textparse/protobufparse.go
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
---------
Signed-off-by: bwplotka <bwplotka@gmail.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
2025-02-13 10:38:35 +00:00
Bartlomiej Plotka
00b69efabb
model/textparse: Change parser interface Metric(...) string to Labels(...) ( #16012 )
...
* model/textparse: Change parser interface Metric(...) string to Labels(...)
Simplified the interface given no one is using the return argument.
Renamed for clarity too.
Found and discussed https://github.com/prometheus/prometheus/pull/15731#discussion_r1950916842
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Fixed comments; optimized not needed copy for om and text.
Signed-off-by: bwplotka <bwplotka@gmail.com >
---------
Signed-off-by: bwplotka <bwplotka@gmail.com >
2025-02-12 15:47:56 +00:00
Bartlomiej Plotka
8cd9069cf1
textparse: Refactor benchmark testdata for all types. ( #15998 )
...
Also:
* split benchmark functions to make sure no one compares across parsers.
* testdata file have meaningful names reflecting the type representation
* promtestdata.txt now has all types, taken directly from long running Prometheus (https://demo.do.prometheus.io/ )
Needed for https://github.com/prometheus/prometheus/pull/15731
Signed-off-by: bwplotka <bwplotka@gmail.com >
2025-02-10 12:26:18 +00:00
Bartlomiej Plotka
7427753922
scrape: Add realistic data case for scrape loop append bench. ( #15966 )
...
* scrape: Add realistic data case for scrape loop append bench.
Signed-off-by: bwplotka <bwplotka@gmail.com >
* Update scrape/scrape_test.go
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
---------
Signed-off-by: bwplotka <bwplotka@gmail.com >
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com >
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com >
2025-02-03 14:46:39 +00:00
George Krajcsovits
cfcb00a716
perf(nhcbparse): unroll recursion ( #15776 )
...
https://github.com/prometheus/prometheus/pull/15467#issuecomment-2563585979
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2025-01-02 15:51:52 +01:00
David Ashpole
953a873342
update links to openmetrics to reference the v1.0.0 release
...
Signed-off-by: David Ashpole <dashpole@google.com >
2024-12-13 21:32:27 +00:00
Bartlomiej Plotka
619e7aaf95
Merge pull request #15453 from prometheus/nhcb-scrape-optimize2
...
nhcb: scrape optimize string manipulation
2024-11-26 09:02:43 -07:00
Bartlomiej Plotka
11d9da1e48
Merge pull request #15260 from tcolgate/quoteexemplarkeys
...
bugfix: allow quoted exemplar keys in openmetrics text format
2024-11-26 02:52:17 -07:00
György Krajcsovits
a48d05912d
nhcb: optimize, do not recalculate suffixes multiple times
...
Reduce string manipulation by just cutting off the histogram suffixes from
the series name label once.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2024-11-25 15:37:38 +01:00
huochexizhan
4f48e76086
chore: fix some function names in comment
...
Signed-off-by: huochexizhan <huochexizhan@outlook.com >
2024-11-19 12:02:10 +08:00
Tristan Colgate-McFarlane
48abdcd83f
bugfix: allow quoted exemplar keys in openmetrics text format
...
Signed-off-by: Tristan Colgate-McFarlane <tristan@cerbos.dev >
2024-11-12 15:29:44 +00:00
Bartlomiej Plotka
76432aaf4e
Merge pull request #15220 from prometheus/nhcb-scrape-optimize
...
perf(nhcb): scrape optimize
2024-11-08 19:02:48 +01:00
Matthieu MOREL
af1a19fc78
enable errorf rule from perfsprint linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-11-06 16:50:36 +01:00
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 >
2024-10-28 08:34:54 +01:00
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 >
2024-10-28 08:31:43 +01:00
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 >
2024-10-24 18:14:05 +02:00
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 >
2024-10-24 07:38:58 +02:00
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 >
2024-10-22 17:49:25 +01:00
György Krajcsovits
25ef4d3483
benchmark, rename parser omtext_with_nhcb
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2024-10-21 15:40:48 +02:00
György Krajcsovits
bee1eb7720
goimports run
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2024-10-21 14:02:32 +02:00
György Krajcsovits
555bd6292a
Better docstring on test
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com >
2024-10-21 13:48:21 +02:00