Commit Graph

14701 Commits (faf398e38059083c22c1bc7b8a725b9274148e17)

Author SHA1 Message Date
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
Oleg Zaytsev 9aa6e041d3
MemPostings: allocate ListPostings once in PFALV (#15465)
Same as #15427 but for the new method added in #14144

Instead of allocating each ListPostings one by one, allocate them all in
one go.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-11-26 16:03:45 +01:00
beorn7 e01c5cefac notifier: fix increment of metric prometheus_notifications_errors_total
Previously, prometheus_notifications_errors_total was incremented by
one whenever a batch of alerts was affected by an error during sending
to a specific alertmanager. However, the corresponding metric
prometheus_notifications_sent_total, counting all alerts that were
sent (including those where the sent ended in error), is incremented
by the batch size, i.e. the number of alerts.

Therefore, the ratio used in the mixin for the
PrometheusErrorSendingAlertsToSomeAlertmanagers alert is inconsistent.

This commit changes the increment of
prometheus_notifications_errors_total to the number of alerts that
were sent in the attempt that ended in an error. It also adjusts the
metrics help string accordingly and makes the wording in the alert in
the mixin more precise.

Signed-off-by: beorn7 <beorn@grafana.com>
2024-11-26 15:50:02 +01:00
Julius Volz 975d5d7357
Merge pull request #15459 from prometheus/dependabot/npm_and_yarn/web/ui/rollup-4.27.4
chore(deps-dev): bump rollup from 4.21.2 to 4.27.4 in /web/ui
2024-11-26 14:07:57 +01:00
György Krajcsovits eb9ce70c3e Set hasCount after setting count to be consistent
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-11-26 13:56:22 +01:00
DC d535d501d1
[DOCS] Improve description of WAL record format (#14936)
Signed-off-by: DC <413331538@qq.com>
2024-11-26 11:48:17 +00:00
Konrad c3cc25f552
document scraping change introduced in 2.52.0 (#15148)
* CHANGELOG - scraping change introduced in 2.52.0

Change introduced in #12933; old behavior partially recoved in #14685

Signed-off-by: Konrad <zuo.zp8@gmail.com>
2024-11-26 11:15:01 +00: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
dependabot[bot] c08edd3ff3
chore(deps-dev): bump rollup from 2.79.1 to 2.79.2 in /web/ui/react-app (#15461)
Bumps [rollup](https://github.com/rollup/rollup) from 2.79.1 to 2.79.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.79.1...v2.79.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 08:00:25 +01:00
dependabot[bot] 8e7e7a0406
chore(deps): bump micromatch from 4.0.5 to 4.0.8 in /web/ui/react-app (#15462)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 06:37:30 +00:00
dependabot[bot] 1bd16db101
chore(deps): bump body-parser and express in /web/ui/react-app (#15460)
Bumps [body-parser](https://github.com/expressjs/body-parser) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/1.20.2...1.20.3)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 07:26:06 +01:00
dependabot[bot] 1939123b5b
chore(deps): bump braces from 3.0.2 to 3.0.3 in /web/ui/react-app (#15457)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 07:25:28 +01:00
dependabot[bot] a778a58bdf
chore(deps-dev): bump rollup from 4.21.2 to 4.27.4 in /web/ui
Bumps [rollup](https://github.com/rollup/rollup) from 4.21.2 to 4.27.4.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.21.2...v4.27.4)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-26 05:20:09 +00:00
Bryan Boreham dd0252a774
Merge pull request #15380 from bboreham/improve-loadwbl
[BUGFIX] TSDB: Apply fixes from loadWAL to loadWBL
2024-11-25 17:31:49 +00:00
Bryan Boreham 7996a13fdd
Merge pull request #15403 from bboreham/fix-rw-benchmark-startup
[TESTS] Remote-Write: Fix BenchmarkStartup
2024-11-25 17:31:24 +00:00
newtonne 88675710f9 Add support for utf8 names on `/v1/label/:name/values` endpoint
Previously, the api was evaluating this regex to determine if the label
name was valid or not:

14bac55a99/model/labels.go (L94)

However, I believe that the `IsValid()` function is what ought to be
used in the brave new utf8 era.

**Before**

```
$ curl localhost:9090/api/v1/label/host.name/values
{"status":"error","errorType":"bad_data","error":"invalid label name: \"host.name\""}
```

**After**

```
$ curl localhost:9090/api/v1/label/host.name/values
{"status":"success","data":["localhost"]}
```

It's very likely that I'm missing something here or you were already
planning to do this at some point but I just encountered this issue and
figured I'd give it a go.

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-11-25 11:48:45 -05: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
György Krajcsovits 41f051e9a4 Small improvement in handling cases without count
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-11-25 15:02:17 +01:00
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