15980 Commits

Author SHA1 Message Date
beorn7
1071c82b42 docs: counter vs. gauge histogram behavior with +/-
This mostly handles the cases mentioned in #16576. However, there are
some related changes in here, too:

- Some line formatting to avoid lines longer than 80 characters.

- Establish in basics.md that histograms have a counter vs. gauge
  "flavor" that is also stored in the sample and not just by
  convention as for float samples.

- Add the documentation of the unary minus, which was missing so far.
  This require a bit of restructuring.

- Cleaned up a few references to "Prometheus" that should better refer
  to "PromQL" (and "Prometheus's query language" → "PromQL" etc.).

I decided to not explain in all detail when and how PromQL detects an
incompatible counter reset. The spec is linked from basics.md, so the
minority that might be interested in this can still look it up.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-08-13 19:25:17 +02:00
Neeraj Gartia
2c0de4e7c2
Fix histogram_quantile annotation in range query when delayed name removal is disabled (#16794)
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2025-08-13 18:06:48 +02:00
Björn Rabenstein
4217d4ba46
Merge pull request #17046 from prometheus/beorn7/promql
promqltest: Add test for unary minus with native histograms
2025-08-13 16:57:09 +02:00
George Krajcsovits
2aaeefe8e1
fix(parser): wrong end position aggregate expression (#17031)
* fix(parser): wrong end position aggregate expression

Fixes: https://github.com/prometheus/prometheus/issues/16053

The position range of nested aggregate expression was wrong, for the
expression "(sum(foo))" the position of "sum(foo)" should be 1-9, but
the parser could not decide the end of the expression on pos 9, instead
it read ahead to pos 10 and then emitted the aggregate. But we only
kept the last closing position (10) and wrote that into the aggregate.

The reason for this is that the parser cannot know from "(sum(foo)" alone
if the aggregate is finished. It could be finished as in "(sum(foo))" but
equally it could continue with group modifier as "(sum(foo) by (bar))".

Previous fix in #16041 tried to keep track of parenthesis, but that is
complicated because the error happens after closing two parenthesis. That
fix introduced new bugs.

This fix now addresses the issue directly. Since we have to step outside
the parser state machine anyway, we can just add an algorithm to
detect and fix the issue. That's Lexer.findPrevRightParen().

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-08-13 15:52:52 +02:00
beorn7
e326049e43 promqltest: Add test for unary minus with native histograms
This verifies that a counter histogram becomes a gauge histogram if an
unary minus is applied to it.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-08-13 15:39:52 +02:00
Ayoub Mrini
dd6ad8ec4c
feat: add a way to pass release notes from the PR (#16904)
* feat: add a way to add release notes from the PR

make the release note block part of .github/PULL_REQUEST_TEMPLATE.md (inspired from k8s')

A CI check would check the input.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>

* imp

Signed-off-by: machine424 <ayoubmrini424@gmail.com>

* suggestions

Signed-off-by: machine424 <ayoubmrini424@gmail.com>

---------

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-08-13 15:34:36 +02:00
Björn Rabenstein
caf24555a8
Merge pull request #17004 from juliusmh/nh_unary_minus_as_gauge
model: set native histogram GaugeType hint when subtracting or multiplying/dividing with negative factors
2025-08-13 15:25:06 +02:00
Bryan Boreham
8fff489c53
Merge pull request #16896 from bboreham/wrap-less
[PERF] PromQL: Move more work to preprocessing step
2025-08-13 14:17:30 +01:00
Bryan Boreham
7ab68550dc [PERF] PromQL: Unwrap superfluous parens during preprocessing
This means we only do it once, rather than on every step of a range
query. Also the code gets a bit shorter.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-13 14:01:47 +01:00
Bryan Boreham
384db72ede [PERF] PromQL: Stop checking step-invariant arguments
In aggregations and function calls. We no longer wrap the literal values
or matrix selectors that would appear here.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-13 14:01:47 +01:00
Bryan Boreham
94d3cac4ea [PERF] PromQL: Don't wrap matrix selectors as time-invariant
Matrix selectors have a Timestamp which indicates they are time-invariant,
so we don't need to wrap and then unwrap them when we come to use them.

Fix up tests that check this level of detail.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-13 14:01:47 +01:00
Bryan Boreham
b290e0ec17 [PERF] PromQL: Don't wrap constant expressions as time-invariant
This should mean we can stop unwrapping them later.

Fix up tests that check very specific details.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-13 10:54:40 +01:00
Julius Hinze
5855d973b0
model: set native histogram GaugeType hint when subtracting or multiplying/dividing with negative factors
Signed-off-by: Julius Hinze <julius.hinze@grafana.com>
2025-08-12 18:16:39 +02:00
machine424
a48d348811 chore: exclude experimental /v1/ endpoints from stability guarantees
a bunch is marked as experimental in https://prometheus.io/docs/prometheus/latest/querying/api/

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-08-12 16:45:17 +02:00
pipiland2612
1607b5c8cc parallelize ./scrape test
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-08-12 14:12:48 +02:00
pipiland2612
82a4b12507 Add t.parallel() for ./tsdb
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-08-12 14:12:42 +02:00
pipiland2612
fe1bb53372 parralell storage/remote
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-08-12 14:12:27 +02:00
pipiland2612
de93387f0b Parallel tsdb/wlog test
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-08-12 14:12:15 +02:00
Owen Williams
294f36e802
otlptranslator: pin to specific library version tag. (#17028)
Pin to v0.0.2. Versions should help make API transitions more clear.

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-08-08 15:30:45 -04:00
George Krajcsovits
929bd787ec
fix(ci): run linter with all build tags (#17027)
Fix up lint errors that were not previously checked.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-08-08 09:43:41 +00:00
Joe Adams
1e4144a496
Merge pull request #16950 from sysadmind/aws-sdk-go-v2
chore(deps): Upgrade AWS SDK to v2
2025-08-07 22:34:55 -04:00
Joe Adams
60cf922f89
Fix merge formatting
Signed-off-by: Joe Adams <github@joeadams.io>
2025-08-07 21:17:21 -04:00
George Krajcsovits
8f6a71e188
fix(otlp): benchmark assert makes no sense (#17023)
convert.Timeseries() and converter.Metadata() is never nil, because
they are always initialized. It's better to assert on whether they are
empty or not.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-08-07 17:04:21 +00:00
Arve Knudsen
ae85827e3a
storage/remote.writeHandler.ServeHTTP: Return upon receiving bad message type (#16997)
Modify storage/remote.writeHandler.ServeHTTP to return after responding
with an error due to receiving an unrecognized protobuf message type.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-08-07 19:01:03 +02:00
Arthur Silva Sens
208187eaa1
Remove unused feature from prw translator (#17014)
* Remove unused feature from prw translator

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>

---------

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-08-06 14:05:47 -03:00
Joe Adams
8350c23e76
Merge branch 'main' into aws-sdk-go-v2
Signed-off-by: Joe Adams <github@joeadams.io>
2025-08-06 10:53:49 -04:00
Bryan Boreham
7512d13e00
Merge pull request #17002 from bboreham/reduce-promql-benchmark
[TESTS] PromQL: shrink work done in BenchmarkRangeQuery
2025-08-06 12:07:49 +01:00
Bryan Boreham
ba2a8aba8c
Merge pull request #17000 from bboreham/clarify-intersect
[REFACTOR] TSDB: Clarify intersectPostings
2025-08-06 12:07:10 +01:00
Bartlomiej Plotka
5df982538f
Merge pull request #16994 from mmorel-35/unused-parameters
chore: enable unused-receiver rule from revive
2025-08-06 10:46:28 +01:00
Bartlomiej Plotka
3fc87f40e8
Merge pull request #16998 from mmorel-35/govet/enable-all
chore: enable-all rule from govet
2025-08-06 10:44:44 +01:00
Bartlomiej Plotka
b2ccc8d4b7
Merge pull request #16999 from mmorel-35/context
chore: enable fatcontext linter
2025-08-06 10:43:42 +01:00
Bartlomiej Plotka
291e2ae090
Merge pull request #17006 from sujalshah-bit/fix_wal_dir_bug
wal: ignore os.ErrNotExist errors in DirSize during WAL size calculation
2025-08-06 10:40:02 +01:00
Ganesh Vernekar
64808d4f56
Merge pull request #16968 from pipiland2612/Remove_label_index
tsdb: Remove writing Label Index and Label Offset Table in the index
2025-08-05 15:12:44 -07:00
Sujal Shah
17c58f5fce wal: ignore os.ErrNotExist errors in DirSize during WAL size calculation
This change updates `DirSize` to ignore `os.ErrNotExist` errors,
since they are expected during normal WAL cleanup. All other errors
continue to propagate.

Fixes: #17005
Signed-off-by: Sujal Shah <sujalshah28092004@gmail.com>
2025-08-05 22:41:46 +05:30
Bryan Boreham
31eb3b286d [TESTS] PromQL: shrink work done in BenchmarkRangeQuery
Previously, BenchmarkRangeQuery would run each case with three data sizes
(1, 10, 100) and three range lengths (1, 100, 1000) for nine variations.

With 36 cases, running with `-count=6` to get dependable results, would
take 40-50 minutes in total.

This PR removes the middle option in both dimensions, thus shrinking to
four variations and about 20 minutes to run everything.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-05 14:21:23 +01:00
Bryan Boreham
e068c7332d [REFACTOR] TSDB: Clarify intersectPostings
This is intended to make `intersectPostings` easier to follow.

Instead of cryptic `arr` and `cur`, name the members `postings` and
`current`.

Instead of updating `cur` to intermediate values encountered during
operations, introduce a local variable `target` meaning the ref we might
expect to find next, and only update `current` when an intersection is
found.

Name the function which implements seeking `Seek` instead of `doNext`.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-08-05 13:09:29 +01:00
Alan Protasio
25aee26a57
Improving "Sparse postings" intersection (#13971)
Lets take the given example:

P1: [2, 5, 9, 18, 21]
P2: [3, 7, 14, 19, 21]
P3: [1, 21]

Currently, we would only advance through P1 and P2 until discovering
an intersection and then checking P3. In essence, the traversal order
was: 2, 3, 5, 7, 9, 14, 18, 19, 21 (intersection found).

With the proposed change, P3 is also examined even if P1 and P2
haven't found an intersection yet. This adjustment allows for the
possibility of skipping some iterations.

Post-change, the traversal order becomes: 2, 3, 21 (3 iterations instead of 9).

Signed-off-by: alanprot <alanprot@gmail.com>
2025-08-05 12:22:54 +01:00
George Krajcsovits
457a2381f9
fix(parser): revert pr 16041 and 16754 (#16996)
* fix(parser): revert pr 16041 and 16754

Fix for https://github.com/prometheus/prometheus/issues/16053
turned out to be too complicated and lead to more errors than it solved.
See https://github.com/prometheus/prometheus/pull/16875.

* add TODOs to wrong end positions
* restore test and fix initialization bug

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-08-05 10:48:08 +02:00
Owen Williams
74610b7c89
config: address edge case where local config specifies validation mode only (#16923)
This check ensures that local ScrapeConfigs that only specify Legacy validation do not inherit the default global AllowUTF8 escaping setting, which is an invalid combination of settings.

---------

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-08-04 13:53:50 -04:00
Matthieu MOREL
9f782164b4 chore: enable fatcontext linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-04 18:24:10 +02:00
Matthieu MOREL
0484a6d547 chore: enable-all rule from govet
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-04 18:06:36 +02:00
Owen Williams
5cc49720ac
otlp: update otlptranslator package (#16961)
* otlp: update otlptranslator package

Signed-off-by: Owen Williams <owen.williams@grafana.com>

* lint

Signed-off-by: Owen Williams <owen.williams@grafana.com>

* lint

Signed-off-by: Owen Williams <owen.williams@grafana.com>

* catch err

Signed-off-by: Owen Williams <owen.williams@grafana.com>

---------

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-08-04 18:02:16 +02: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
Matthias Rampke
789fddf25a
Merge pull request #16970 from prometheus/mr/repo-sync-manual-trigger
repo sync: allow manual triggering
2025-08-01 23:46:52 +02:00
Matthias Rampke
9ad799e0b1
repo sync: allow manual triggering
Add a [workflow dispatch](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch)
trigger to allow [manual triggering](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow)
of the repo sync workflow.

I am often behind on merging the repo sync PRs. The script does not update them,
and I don't have the nerve right now to figure _that_ out. As a workaround, it
would be useful to trigger it manually after merging the outstanding ones, so I
can get a fresh round on the same day.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2025-08-01 22:24:03 +02:00
pipiland2612
8b24acb729 Remove label index and labe offset index
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-08-01 13:50:49 +03:00
Joe Adams
19dbe80376
go mod tidy
Signed-off-by: Joe Adams <github@joeadams.io>
2025-07-31 21:23:25 -04:00
Joe Adams
cdfb67467f
Review feedback
Signed-off-by: Joe Adams <github@joeadams.io>
2025-07-31 21:22:43 -04:00
Julius Volz
2e709c6567
Merge pull request #16695 from sujalshah-bit/block_endpoint
api: Create `/status/tsdb/blocks` endpoint.
2025-07-31 18:15:49 +02:00
David Ashpole
ff3882fd35
Merge pull request #16914 from dashpole/simplify_target
Simplify target_info addition in the otlptranslator
2025-07-30 13:21:01 -04:00