Commit Graph

14683 Commits (c69aeabf1d2ce1d7cf8592e5f0855f1528a3b7bc)

Author SHA1 Message Date
hongmengning 2a1b940ae4 discovery: fix some function names in comment
Signed-off-by: hongmengning <go@before.tech>
2024-11-25 17:33:04 +08:00
György Krajcsovits a53b48a912 OTLP translate: keep identifying attributes in target_info
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-11-25 09:27:50 +01:00
Kateryna Pavlova d6e43b89f4 docs: add regex section in querying basics
Signed-off-by: Kateryna Pavlova <kathrinett@gmail.com>
2024-11-24 22:03:04 +01:00
Kateryna Pavlova bc008f1b0e docs: fix range queries link
Signed-off-by: Kateryna Pavlova <kathrinett@gmail.com>
2024-11-24 22:02:01 +01:00
Ben Ye 872e2db2a9
Implement json encoder/decoder for regexp (#15383)
* implement json encoder/decoder for regexp

---------

Signed-off-by: Ben Ye <benye@amazon.com>
2024-11-24 18:46:24 +00:00
Bryan Boreham dd1d707e1c
Merge pull request #15371 from bboreham/main-naming
[REFACTOR] Small improvement to top-level naming
2024-11-24 17:55:10 +00:00
dependabot[bot] e243ed66b9
chore(deps): bump github.com/fsnotify/fsnotify from 1.7.0 to 1.8.0 (#15300)
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-24 18:40:58 +01:00
Bryan Boreham fee61fbcbd
Merge pull request #15434 from tjhop/fix/query-logger-compounding-keys
fix!: stop unbounded memory usage from query log
2024-11-24 16:54:13 +00:00
dependabot[bot] fc5b7dc5d6
chore(deps): bump the k8s-io group with 3 updates (#15283)
Bumps the k8s-io group with 3 updates: [k8s.io/api](https://github.com/kubernetes/api), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `k8s.io/api` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/api/compare/v0.31.1...v0.31.2)

Updates `k8s.io/apimachinery` from 0.31.1 to 0.31.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.1...v0.31.2)

Updates `k8s.io/client-go` from 0.31.1 to 0.31.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.1...v0.31.2)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-io
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-io
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: k8s-io
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-24 17:39:51 +01:00
Ben Ye 40c3ba9fd4
fix promtool analyze block shows metric name with 0 cardinality (#15438)
Signed-off-by: Ben Ye <benye@amazon.com>
2024-11-24 17:30:20 +01:00
Raphael Philipe Mendes da Silva e664c16b31
api: fix typo in list rules API response (#15400)
* Fix typo in list rules API response

---------

Signed-off-by: Raphael Silva <rapphil@gmail.com>
2024-11-24 17:28:21 +01:00
Simon Pasquier 63d87a60a8
docs: fix typo (#15436)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2024-11-24 17:13:19 +01:00
Neeraj Gartia abfc3145a2
apply DRY on clamp (#15441)
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-11-24 17:08:59 +01:00
TJ Hoplock 3e24e84172 fix!: stop unbounded memory usage from query log
Resolves: #15433

When I converted prometheus to use slog in #14906, I update both the
`QueryLogger` interface, as well as how the log calls to the
`QueryLogger` were built up in `promql.Engine.exec()`. The backing
logger for the `QueryLogger` in the engine is a
`util/logging.JSONFileLogger`, and it's implementation of the `With()`
method updates the logger the logger in place with the new keyvals added
onto the underlying slog.Logger, which means they get inherited onto
everything after. All subsequent calls to `With()`, even in later
queries, would continue to then append on more and more keyvals for the
various params and fields built up in the logger. In turn, this causes
unbounded growth of the logger, leading to increased memory usage, and
in at least one report was the likely cause of an OOM kill. More
information can be found in the issue and the linked slack thread.

This commit does a few things:

- It was referenced in feedback in #14906 that it would've been better
  to not change the `QueryLogger` interface if possible, this PR
proposes changes that bring it closer to alignment with the pre-3.0
`QueryLogger` interface contract
- reverts `promql.Engine.exec()`'s usage of the query logger to the
  pattern of building up an array of args to pass at once to the end log
call. Avoiding the repetitious calls to `.With()` are what resolve the
issue with the logger growth/memory usage.
- updates the scrape failure logger to use the update `QueryLogger`
  methods in the contract.
- updates tests accordingly
- cleans up unused methods

Builds and passes tests successfully. Tested locally and confirmed I
could no longer reproduce the issue/it resolved the issue.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-11-23 14:20:37 -05:00
Arve Knudsen c2e28f21ba
rules.NewGroup: Fix when no logger is passed (#15356)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-11-21 16:53:06 +01:00
Björn Rabenstein bafb4d68de
Merge pull request #15431 from prometheus/beorn7/promql2
promql: Fix subqueries to be really left-open
2024-11-21 14:50:23 +01:00
beorn7 4b573e0521 promql: Fix subqueries to be really left-open
Previously, we managed to get rid of the sample on the left bound
later, so the problem didn't show up in the framework tests. But the
subqueries were still evaluation with the sample on the left bound,
taking space and showing up if returning the subquery result directly
(without further processing through PromQL like in all the framework
tests).

Signed-off-by: beorn7 <beorn@grafana.com>
2024-11-21 14:28:05 +01:00
Björn Rabenstein 125a90899c
promqltest: Complete the tests for info annotations (#15429)
promqltest: Complete the tests for info annotations

So far, we did not test for the _absence_ of an info annotation
(because many tests triggered info annotations, which we haven't taken
into account so far).

The test for info annotations was also missed for range queries.

This completes the tests for info annotations (and refactors the many
`if` statements into a somewhat more compact `switch` statement).

It fixes most tests to not emit an info annotation anymore. Or it
changes the `eval` to `eval_info` where we actually want to test for
the info annotation.

It also fixes a few spelling errors in comments.

---------

Signed-off-by: beorn7 <beorn@grafana.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-11-21 14:20:38 +01:00
Oleg Zaytsev cc390aab64
MemPostings: allocate ListPostings once in PFLM (#15427)
Instead of allocating ListPostings pointers one by one, allocate a slice
and take pointers from that. It's faster, and also generates less
garbage (NewListPostings is one of the top offenders in number of
allocations).

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-11-20 17:52:20 +01:00
Arve Knudsen 89bbb885e5
Upgrade to golangci-lint v1.62.0 (#15424)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-11-20 17:22:20 +01:00
Fiona Liao d7c8177f56
docs: update README with v3 tagging update (#15361)
docs: update README with v3 tagging update

Signed-off-by: Fiona Liao <fiona.liao@grafana.com>

---------

Signed-off-by: Fiona Liao <fiona.liao@grafana.com>
2024-11-20 16:46:11 +01:00
Björn Rabenstein ca600cfaff
Merge pull request #15407 from tjhop/chore/slog-handler-compile-check
chore(deduper): add compile check that slog.Handler interface is satisfied
2024-11-20 15:25:04 +01:00
Björn Rabenstein e8003cb347
Merge pull request #15417 from huochexizhan/main
chore: fix some function names in comment
2024-11-20 14:36:47 +01:00
Bryan Boreham 3c22b35a03
Merge pull request #15339 from colega/export-go-sync-mutex-wait-total-seconds-total-metric
Export 'go_sync_mutex_wait_total_seconds_total' metric
2024-11-20 13:34:37 +00:00
Neeraj Gartia a6fb16fcb4
PromQL: Convert more native histogram tests to promql-test framework (#15419)
This converts `TestNativeHistogram_SubOperator` to the promql testing framework. It also removes `TestNativeHistogram_Sum_Count_Add_AvgOperator`, which got converted earlier.

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-11-20 11:41:36 +01:00
Björn Rabenstein 4ef1170868
Merge pull request #15422 from NeerajGartia21/promql-corrections
[BUGFIX] PromQL: Fix `count_values` for histograms
2024-11-20 11:27:32 +01:00
Arve Knudsen 9c02c26418
OTLP receiver: Convert also metric metadata (#15416)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-11-20 11:13:03 +01:00
George Krajcsovits 5cd9855999
tests(promql/testdata): add regression test for and-on (#15425)
* tests(promql/testdata): add regression test for and-on

I'd like to use queries of the form "x and on() (vector(y)==1)" to be
able to include and exclude series for dashboards. This helps migration
to native histograms in dashboards by using a dashboard variable to
set "y" to either -1 or 1 to exclude or include the result.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>

---------

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-11-20 10:29:18 +01:00
Neeraj Gartia 048222867a fix count_values for histograms
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-11-20 02:07:31 +05:30
Bryan Boreham b02805e40e
Merge pull request #15415 from prometheus/merge-release-into-main
Merge release branches 2.53, 2.55 and 3.0 into main
2024-11-19 18:33:33 +00:00
Björn Rabenstein 384c5951ef
Merge pull request #14489 from harry671003/implement_metadata_limit
storage: Implement limit in mergeGenericQuerier
2024-11-19 17:32:16 +01:00
Arve Knudsen 06d54fcc6c
[PERF] TSDB: Optimize inverse matching (#14144)
Simple follow-up to #13620. Modify `tsdb.PostingsForMatchers` to use the optimized tsdb.IndexReader.PostingsForLabelMatching method also for inverse matching.

Introduce method `PostingsForAllLabelValues`, to avoid changing the existing method.

The performance is much improved for a subset of the cases; there are up to
~60% CPU gains and ~12.5% reduction in memory usage. 

Remove `TestReader_InversePostingsForMatcherHonorsContextCancel` since
`inversePostingsForMatcher` only passes `ctx` to `IndexReader` implementations now.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-11-19 15:49:01 +00:00
Charles Korn 62e6e55c07
promql: fix issues with comparison binary operations with `bool` modifier and native histograms (#15413)
* Fix issue where comparison operations with `bool` modifier and native histograms return histograms rather than 0 or 1

* Don't emit anything for comparisons between floats and histograms when `bool` modifier is used

* Don't emit anything for comparisons between floats and histograms when `bool` modifier is used between a vector and a scalar

---------

Signed-off-by: Charles Korn <charles.korn@grafana.com>
2024-11-19 09:13:34 +01:00
Charles Korn 45db23617a
promql: fix incorrect "native histogram ignored in aggregation" annotations (#15414)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2024-11-19 08:17:49 +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
Bryan Boreham 379304f60a Merge branch 'release-2.53' into merge-release-into-main 2024-11-18 14:48:45 +00:00
Bryan Boreham 210ef03479 Merge branch 'release-2.55' into merge-release-into-main 2024-11-18 14:44:56 +00:00
Bryan Boreham 26886d6d95 Merge branch 'release-3.0' into merge-release-into-main 2024-11-18 14:43:56 +00:00
TJ Hoplock 16a4354b48 chore(deduper): add compile check that slog.Handler int is satisfied
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-11-15 15:48:34 -05:00
Đurica Yuri Nikolić 101b1c307f
[ENHANCEMEN] Remote-Write: optionally use a DNS resolver that picks a random IP (#15329)
When a remote-write is executed towards a host name that is resolved to multiple IP addresses, this PR introduces a possibility to force creation of new connections used for the remote-write request to a randomly chosen IP address from the ones corresponding to the host name. The default behavior remains unchanged, i.s., the IP address used for the connection creation remains the one chosen by Go.

This is an experimental feature, it is disabled by default.

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
2024-11-15 15:41:49 +00:00
zenador e13c28bd4a
Use a function to determine if an aggregation function is experimental (#15331)
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2024-11-15 15:09:50 +01:00
Bryan Boreham 0ef0b75a4f [TESTS] Remote-Write: Fix BenchmarkStartup
It was crashing due to uninitialized metrics, and not terminating due to
incorrectly reading segment names.

We need to export `SetMetrics` to avoid the first problem.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-11-15 11:22:07 +00:00
Bryan Boreham c5d009d57f
Merge pull request #15393 from jan--f/prep-release-3.0.0
Prep release 3.0.0
2024-11-14 16:19:49 +00:00
Aniket Kaulavkar f7685caf0d Parallelize discovery/kubernetes tests using t.Parallel()
Signed-off-by: Aniket Kaulavkar <aniket.kaulavkar@gmail.com>
2024-11-14 10:44:03 +05:30
Jan Fajerski d541b3bbeb prepare release 3.0.0
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2024-11-13 15:41:05 +01:00
Jan Fajerski 84396bf636 migration: add removal of AM v1 api
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2024-11-13 15:40:58 +01: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
Neeraj Gartia 789c9b1a5e
[BUGFIX] PromQL: Corrects the behaviour of some operator and aggregators with Native Histograms (#15245)
PromQL: Correct the behaviour of some operator and aggregators with Native Histograms

---------

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-11-12 15:37:05 +01:00
Fiona Liao c599d37668
Always return unknown hint for first sample in non-gauge histogram chunk (#15343)
Always return unknown hint for first sample in non-gauge histogram chunk

---------

Signed-off-by: Fiona Liao <fiona.liao@grafana.com>
Co-authored-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-11-12 15:14:06 +01:00
Bryan Boreham 57a7a2939a
Merge pull request #15389 from jan--f/fix-appender-race-3.0
[BUGFIX] TSDB: Fix race on stale values in headAppender (#15322)
2024-11-12 14:12:37 +00:00