Commit graph

498 commits

Author SHA1 Message Date
Julien
16876bab95
Merge pull request #18200 from roidelapluie/roidelapluie/retention-validation
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Multiple fixes in retention configuration
2026-03-20 12:27:37 +01:00
Julien Pivotto
1064c26da2 Log retention changes
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-03-19 17:21:45 +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
George Krajcsovits
318980a5c2
Merge pull request #17207 from thomas-gouveia/feat/16634/add-support-for-workload-identity-azure-discovery
feat: add support for Azure Workload Identity authentication method for Azure discovery [#16634]
2026-03-03 12:59:58 +01:00
Frederic Branczyk
bf139a370c
Merge pull request #18006 from rexagod/13525
discovery/kubernetes: Support node role selectors for pod roles
2026-03-02 10:03:26 +01:00
Julien Pivotto
8edc676cbe config: inject TSDBConfig defaults in Load for empty config bodies
When the config body is empty, UnmarshalYAML is never called, so the
TSDBConfig nil injection added there never ran. Replicate the same guard
in Load, which is the entry point that already handles this case for
other defaults via DefaultConfig.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-26 16:59:21 +01:00
Julien Pivotto
bf3c217bbd config: apply retention CLI flags as defaults and update UI on reload
Introduce DefaultTSDBRetentionConfig, populated from CLI flags before any
config file is loaded, so that retention falls back to CLI flags when the
config file has no storage.tsdb section. Config.UnmarshalYAML always injects
a non-nil TSDBConfig with those defaults, removing the need for nil checks in
main.go. ApplyConfig in web.go now propagates retention settings on each
config reload so the runtime info endpoint stays up to date.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-26 16:36:05 +01:00
Julien Pivotto
dcfa1b96c6 config: validate TSDB retention settings during config parsing
Move retention validation from tsdb/db.go into a TSDBRetentionConfig
UnmarshalYAML method so that invalid values are rejected at config
load/reload time rather than at apply time.

- Reject negative retention size values.
- Reject retention percentage values above 100.
- Simplify ApplyConfig to assign retention values unconditionally,
  enabling setting a value back to 0 to disable it.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-26 15:16:09 +01:00
Laurent Dufresne
971143edac Added Retention.Percentage to config file with runtime config reloading
Signed-off-by: Laurent Dufresne <laurent.dufresne@grafana.com>
2026-02-24 15:28:20 +01:00
Pranshu Srivastava
99e464c239
discovery/kubernetes: Support node role selectors for pod roles
The node informers for pod roles respected filtering based on selectors
([1]). However, node selectors for pod roles were not allowed. This
patch address that, and additionally adds pod filtering logic, to not
populate their target groups when they belong to a filtered node.

[1]:https://github.com/prometheus/prometheus/pull/10080/changes#diff-e9ca22962ad7d9a7bb4cb82d209dc2dd5301f457d8242da5535557866d2ea1eaR667

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2026-02-04 02:26:50 +05:30
Ganesh Vernekar
68b7aaaf15 Add test case for loading stale_series_compaction_threshold config
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
2026-01-24 16:32:44 -08:00
Ganesh Vernekar
3e4a094dbb Add stale_series_compaction_threshold config file option
Some checks failed
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 (push) Has been cancelled
CI / 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 / 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
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
2026-01-23 18:12:34 -08:00
Arthur Silva Sens
1e317d0098
Add configuration option to control extra-scrape-metrics (#17606) 2026-01-06 09:00:49 -03: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
Arve Knudsen
71c4e69a08 fix(config): check all fields in GlobalConfig.isZero()
The isZero() method was missing checks for 9 fields that exist in the
GlobalConfig struct. This caused the method to incorrectly return true
when only these fields had non-zero values, resulting in user
configurations being silently overwritten with defaults during YAML
unmarshaling.

Added checks for: BodySizeLimit, SampleLimit, TargetLimit, LabelLimit,
LabelNameLengthLimit, LabelValueLengthLimit, KeepDroppedTargets,
MetricNameValidationScheme, and MetricNameEscapingScheme.

Consolidated TestEmptyGlobalBlock and new isZero tests under
TestGlobalConfig.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-12-24 13:21:09 +01:00
Bartlomiej Plotka
17e06dbab5
refactor(scrape)[PART2]: simplified scrapeLoop constructors & tests; add teststorage.Appendable mock (#17631)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
* refactor(scrape): simplified scrapeLoop constructors & tests; add teststorage.Appender mock

Signed-off-by: bwplotka <bwplotka@gmail.com>

debug

* refactor(scrape): simplified newLoop even more

Signed-off-by: bwplotka <bwplotka@gmail.com>

* refactor(scrape): rename sl -> app, slApp -> app

Signed-off-by: bwplotka <bwplotka@gmail.com>

* fix TestScrapeLoopRun flakiness

Signed-off-by: bwplotka <bwplotka@gmail.com>

* fix lint

Signed-off-by: bwplotka <bwplotka@gmail.com>

* kill unused listSeriesSet code

Signed-off-by: bwplotka <bwplotka@gmail.com>

* fix closing to not panic

Signed-off-by: bwplotka <bwplotka@gmail.com>

* added extra benchmark for scrapeAndReport

Signed-off-by: bwplotka <bwplotka@gmail.com>

* added extra benchmark for restartLoops

Signed-off-by: bwplotka <bwplotka@gmail.com>

* addressed last comments

Signed-off-by: bwplotka <bwplotka@gmail.com>

* fix TestConcurrentAppender_ReturnsErrAppender naming

Signed-off-by: bwplotka <bwplotka@gmail.com>

* addressed small comments

Signed-off-by: bwplotka <bwplotka@gmail.com>

* refactor(scrape): ensure scrape config is reloaded; added test

Signed-off-by: bwplotka <bwplotka@gmail.com>

* addressed comments.

Signed-off-by: bwplotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-12-22 09:38:48 +00:00
Minh Nguyen
ad4b59c504
tsdb: Deprecate retention flags; add tsdb.retention runtime configuration (#17026)
* Move storage from CL to config file

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* Fix .md

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* run make cli-documentation

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* run make cli-documentation

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* nit_fixed

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* add test and update configuration.md

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix lint

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

---------

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-10-27 14:51:33 +00:00
György Krajcsovits
18efd9d629
feat(ui): mark native histograms as stable in ui strings
Plus some docstrings

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-10-24 12:32:15 +02:00
Minh Nguyen
f070e35358
[RW]: Adopt client_golang/exp/api/remote types for receiving RW1 and RW2 (#17197)
Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

# Conflicts:
#	storage/remote/write_handler.go

* add comment

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix failling test

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* nit_fixing

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

* fix comment

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>

---------

Signed-off-by: pipiland2612 <nguyen.t.dang.minh@gmail.com>
2025-10-24 10:31:34 +01:00
Arve Knudsen
ef42c088ba
OTLP: Add configuration parameters to control label name translation (#17345)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
As a follow-up to #17344, add two configuration parameters for controlling label
name translation, both defaulting to on for backwards compatibility (currently
these behaviours are hardcoded as enabled):

* otlp.label_name_underscore_sanitization => Prefix label names starting with a
  single underscore with key_ when translating OTel attribute names
* otlp.label_name_preserve_multiple_underscores => Keep multiple consecutive
  underscores in label names when translating OTel attribute names

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-10-22 08:27:35 +02: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
thomas-gouveia
3e28742474
feat: add support for Azure Workload Identity authentication method for Azure discovery [#16634]
This PR adds support for the Azure Workload Identity authentication method for Azure Discovery. It allows Prometheus running in AKS clusters to discover VMs by
using Workload Identity authentication.

Signed-off-by: thomas-gouveia <thomas.gouveia@contentsquare.com>
2025-09-17 16:14:08 +02:00
Arve Knudsen
913cc8f72b
Replace gopkg.in/yaml.v2 with go.yaml.in/yaml/v2 (#17151)
* Replace gopkg.in/yaml.v2 with go.yaml.in/yaml/v2
* Upgrade to client_golang@v1.23.2

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-09-06 13:04:24 +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)
* 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
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
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
Arthur Silva Sens
3602785a89
Support including scope metadata as metric labels (#16878)
* Support including scope metadata as metric labels

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

* Ensure Scope Name, Version and Schema URL aren't overriden by attributes

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

---------

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-07-18 13:44:05 -03:00
Bryan Boreham
36ec1e4fb0
Merge branch 'main' into merge-3.5-into-main
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-07-14 15:29:00 +01:00
Owen Williams
d2f1f4fb27
config: Add UnderscoreEscapingWithoutSuffixes translation strategy (#16849)
The last permutation of the translation options does underscore translation but does not add suffixes.
This translation option already exists in Mimir as otel_metric_suffixes_enabled, indicating external demand for this strategy.
There is an accompanying update to prometheus-docs to explain the use of this mode: https://github.com/prometheus/docs/pull/2688

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-07-10 11:27:23 -04:00
Arthur Silva Sens
4b9d0fb92f
Revert: OTLP Support including scope metadata as metric labels (#16842)
Reverts #16730 and #16760

This is being done because we've noticed a problem in the spec that could
lead to name collisions if attributes name, version or schema_url are added
to the scope. They would collide with the already reserved labels
otel_scope_name, otel_scope_version and otel_scope_schema_url.

Since this new configuration option never made it into a release, we can
safely remove it from the 3.5 release. We'll sort this out for the 3.6 release

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-07-08 10:37:19 +00:00
Arve Knudsen
5a5424cbc1
Consolidate around prometheus/common/model.ValidationScheme (#16806)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-07-03 15:37:46 +02:00
Arve Knudsen
d902abc50d
config.ScrapeConfig.Validate: Fix MetricNameEscapingScheme error messages (#16801)
* config.ScrapeConfig.Validate: Fix MetricNameEscapingScheme error messages

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-06-30 15:05:03 +00:00
Owen Williams
aa1d46a9da
scrape: set validation and escaping defaults in default config vars (#16751)
Fixes https://github.com/prometheus/prometheus/issues/16750

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-06-25 11:14:13 -04:00
Arve Knudsen
c701636034
OTLP receiver: Rename otlp.convert_scope_metadata to otlp.promote_scope_metadata (#16760)
* Rename otlp.convert_scope_metadata to otlp.promote_scope_metadata

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Julius Hinze <juliusmh@proton.me>
2025-06-20 13:09:02 +00:00
Arve Knudsen
964bd7d1a9
OTLP: Support including scope metadata as metric labels (#16730)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2025-06-18 09:13:51 +02:00
Jan-Otto Kröpke
ceaa3bd6f9
discovery: add STACKIT SD (#16401) 2025-06-17 15:41:14 +02:00
Owen Williams
5a1cce4fbb
config: fix typo in comments (#16734)
Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-06-17 08:24:30 -04:00
Jan-Otto Kröpke
6d10fce2b6
Merge pull request #16699 from prometheus/release-3.4 2025-06-06 17:04:53 +02:00
Arthur Silva Sens
ed0de41b73
bugfix: Default OTLP config not respected when otlp: block is unset (#16693)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
2025-06-04 22:52:39 +02:00
Antonio Jimenez
2834a665ed
Add support for promoting all OTel resource attributes (#16426)
Add support for promoting all OTel resource attributes via `promote_all_resource_attributes`,
except for those ignored using 'ignore_resource_attributes'.

---------

Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <123171955+antonjim-te@users.noreply.github.com>
2025-05-26 18:15:01 +02:00
machine424
690c9da817 chore(config): add guidelines for adding a new RuntimeConfig field based on learnings from GoGC addition
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-05-21 16:16:05 +02:00
Will Hegedus
33578fedb3 fix(config): respect GOGC environment variable if no "runtime" block exists
Fixes: https://github.com/prometheus/prometheus/issues/16334
Related to:
- https://github.com/prometheus/prometheus/pull/15238
- https://github.com/prometheus/prometheus/pull/16052

Currently, when the GOGC environment variable is set -- and no `runtime`
block is set in the Prometheus config file -- it is ignored and the
default value of 75% is always used.

However, if there is an empty runtime block (e.g. `runtime: {}`), _then_
the GOGC environment variable is checked.

This PR changes this behavior to consistently check and use the GOGC
environment variable when it is set (unless the `gogc` field is set in
the `runtime` block of the loaded config file, in which case it still
gives that precedence).

Co-authored-by: Adam Rambo <arambo@protonmail.com>
Signed-off-by: Will Hegedus <whegedus@akamai.com>
2025-05-12 07:37:20 -04:00
hardlydearly
ba4b058b7a refactor: use slices.Contains to simplify code
Signed-off-by: hardlydearly <799511800@qq.com>
2025-05-09 08:27:10 +02:00
George Krajcsovits
2726a18ae3
Merge pull request #16452 from chardch/global-always-scrape-classic-hist
Add global config option for always_scrape_classic_histograms
2025-05-06 09:29:30 +02:00
chardch
a1c157aaef Add global config option for always_scrape_classic_histograms
Addresses https://github.com/prometheus/prometheus/issues/16371
This will help with migrating to native histograms with `convert_classic_histograms_to_nhcb` since users may still need to keep the classic histograms during a migration

Signed-off-by: chardch <otwordsne@gmail.com>
2025-05-05 10:14:04 -07:00
Arthur Silva Sens
d9c0ad1e61
feat: Support 'NoTranslation' mode in OTLP endpoint (#16441)
* feat: Support 'NoTranslation' mode in OTLP endpoint

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

---------

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-04-22 13:13:30 -03:00
Julien
10b4e1b231
Merge pull request #16340 from BGodding/fix/autoreload-paths
fix (auto-reload): failing to auto-reload on changes to rule and scrape config files
2025-04-07 16:41:42 +02:00
Benjamin Godding
c024fc2f28 fix: fails to auto-reload on changes to rule and scrape config files
Signed-off-by: Benjamin Godding <ben.godding@bright.ai>
2025-04-02 08:41:15 -05:00
chardch
357b5ed640 Fix small issues and clarify documentation
Signed-off-by: chardch <otwordsne@gmail.com>
2025-03-29 08:35:11 -07:00