Defer AWS region lookup from UnmarshalYAML to each discovery's client
init so config-only operations (e.g. promtool check config) do not
contact IMDS when the region field is omitted. Resolution errors
surface at the first target refresh instead of during YAML parsing.
Signed-off-by: Lohit Kolluri <lohitkolluri@gmail.com>
* feat(promtool): Add flag --remote-write.path=/api/v1/write
* docs(promtool): Generate cli docs for new flag
Signed-off-by: Steffen Baarsgaard <steff.bpoulsen@gmail.com>
Co-authored-by: Varsha U N <varshaun58@gmail.com>
Remove the Experimental flag from first_over_time and move it into the
stable *_over_time function lists in the docs and UI function reference.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Fan out the upgrade/downgrade test over each active LTS release so the
matrix jobs run in parallel and a single release failure does not mask
the others. A new list_lts_releases job reads the active LTS versions
from prometheus.io/download.json and feeds them to the matrix.
Add a --test.lts-version flag so TestVersionUpgrade can be restricted to
a single LTS release; when empty, all active LTS releases are tested.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
* Add histogram chunk encoding with Start Timestamp support
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Update documentation
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Add more tests
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fix for appendHistogram
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Linting
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fix start timestamp for histogram samples in TestCompactingChunkSeriesMerger
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Refactor and reduce code duplication
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Move counter reset hint bits into sample count field
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fix bug with counter reset header
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Clean up docs
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Address feedback
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Lint
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Refactor to use generic appenders
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Update to include changes to histogram appenders
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Address feedback
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* tsdb: add histograms-st-encoding feature flag (#18912)
* tsdb: add histograms-st-encoding feature flag
Decouple the ST-capable histogram chunk encodings (EncHistogramST,
EncFloatHistogramST) from the xor2-encoding feature flag and gate them
behind a new histograms-st-encoding flag instead. Previously
--enable-feature=xor2-encoding turned on both the float XOR2 encoding
and the histogram ST encodings via a single useXOR2 boolean; that
conflated two independent on-disk formats and made it impossible to opt
into one without the other.
ValueType.ChunkEncoding and NewChunk now take separate useXOR2 and
useHistogramST flags. Dispatch only consumes the relevant flag per
value type; data-driven callers that gate on actual ST presence in the
samples (storage/series.go, tsdb/querier.go, tsdb/chunks/chunks.go)
pass hasST for both. tsdb.Options gains EnableHistogramSTEncoding;
tsdb.HeadOptions gains a matching atomic.Bool. The new flag is
propagated through chunkOpts/headAppenderBase and read at every site
that currently reads EnableXOR2Encoding (head append v1/v2, head_wal
WAL/WBL replay, ooo_head_read).
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
* Address feedback
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fix histogram tests
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fix histogram ST PromQL tests
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
* Fixes for promQL tests
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
---------
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Add an explicit XOR2EncodingAllowed option that gates whether the XOR2
float chunk encoding may be used at all, either as the FloatChunkEncoding
default or via chunk_encoding.floats in the configuration file. This keeps
the enable/disable switch separate from FloatChunkEncoding, which selects
the active default, so callers (e.g. multi-tenant setups) can make XOR2
available without making it the default.
The xor2-encoding feature flag now sets XOR2EncodingAllowed, validateOpts
rejects an EncXOR2 default when it is not allowed, and ApplyConfig checks
the gate rather than the current default. This replaces the
Head.SetFloatChunkEncoding setter approach.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Duration expressions no longer require the promql-duration-expr feature
flag, which is now a no-op in both prometheus and promtool. The parser
option (ExperimentalDurationExpr) is kept and enabled by default in the
binaries, so downstream consumers of the parser can still keep it off.
Move the documentation from the feature flags page into the PromQL
querying basics.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Replace the two-source LTS discovery (docs-config.ts regex plus the
GitHub releases API) with a single fetch of prometheus.io/download.json,
which carries the LTS flag and per-OS/arch download URLs. The manifest
can mark more than one release as LTS, so fetch all of them and exercise
each as its own subtest.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This is a followup to our previous commit where we made convert_classic_histograms_to_nhcb
configurable at discovery time. We add the other native histogram labels
too here.
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
--enable-feature=xor2-encoding sets tsdb.Options.FloatChunkEncoding to
EncXOR2 (a concrete encoding value, not a feature-flag bool). ApplyConfig
uses this as the fallback when chunk_encoding.floats is absent. No global
mutable state is introduced in the config package.
Signed-off-by: Julien Pivotto <julien.pivotto@grafana.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
CheckServerStatus built the request URL by concatenating the
user-provided URL with the endpoint path:
serverURL.String() + checkEndpoint
When the URL ends with a slash (e.g. "http://localhost:9090/"), this
produces a doubled slash like "http://localhost:9090//-/healthy". The
Prometheus router registers "/-/healthy" and "/-/ready" exactly and
does not collapse repeated slashes, so the request 404s and
"promtool check healthy" / "promtool check ready" fail.
Use url.JoinPath to append the endpoint, which normalises the slash and
also handles a configured route prefix correctly. JoinPath returns a new
URL, so the original is left untouched for the error message.
Signed-off-by: kigland <shuaizhicheng336@gmail.com>
Adding this as a meta label makes it possible to dynamically configure
this setting through discovery labels.
This helps in usecases like K8S where we could enable this with a pod
annotation.
Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
Implement least(a, b) and greatest(a, b) as scalar-returning PromQL
functions backed by math.Min and math.Max respectively.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Adds CheckpointFromInMemorySeries option for agent.Options to enable a faster checkpoint implementation that skips segment re-read and just uses in-memory data instead.
* feat: impl agent-specific checkpoint dir
* feat: impl ActiveSeries interface
* feat: use new checkpoint impl
* feat: hide new checkpoint impl behind a feature flag
* feat: add benchmark
* feat: add benchstat case
* feat: use feature flag in bench
* feat: use same labels for persisted state and append
* feat: set WAL segment size
* feat: add checkpoint size metric and bump series size
* feat: wal replay test
* feat: expose new checkpoint opts in cmd flags
* feat: update cli doc
* add ActiveSeries and DeletedSeries doc
Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
Signed-off-by: Denys Sedchenko <9203548+x1unix@users.noreply.github.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
* test(cmd/prometheus): add TestFeatureFlagsDocumented and fix help text
Add TestFeatureFlagsDocumented to ensure the --enable-feature help text
in and docs/feature_flags.md list the same set of flags.
The help text was out of sync with the documentation:
- Flags present in docs but missing from help text: `auto-reload-config`,
`metadata-wal-records`, `otlp-native-delta-ingestion`,
`promql-delayed-name-removal`, `type-and-unit-labels`. Added them.
- Flags present in help text but missing from docs: `auto-gomaxprocs`,
`expand-external-labels`. Removed them.
The help text is now sorted for better readability and kept in sync
with the documentation.
Also, the parsing of an empty `--enable-feature` was changed to
print `msg="Unknown option for --enable-feature" option=""` instead of nothing.
Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>
* main.go remove default for --enable-feature to avoid unwanted
Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>
---------
Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>
The `--header` flag was already supported by `promtool query range` but was
missing from `promtool query instant`. This adds the same flag so users can
pass extra HTTP headers (e.g. `X-Scope-OrgID` for multi-tenant setups)
without needing to create an `--http.config.file`.
```
[ENHANCEMENT] promtool: Add `--header` flag to `query instant` command, matching existing `query range` behaviour.
```
Signed-off-by: Hoa <hoameomu@gmail.com>
Add Outscale VM service discovery using osc-sdk-go, including optional secret_key_file support, metrics, docs, and configuration examples. Document the default region (eu-west-2).
Signed-off-by: Aurelien Duboc <aurelienduboc96@gmail.com>
- Use an absolute path for the console templates directory to align with rules.
- Rewrite waitForPrometheus using require.Eventually for cleaner
error reporting and to fix a bug where the function could return nil
even when the server never became ready.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
The retention.percentage config field was typed as uint, which silently
truncated fractional values. Setting percentage: 1.5 in prometheus.yml
resulted in a retention of 1%, with no warning or error.
Remove the redundant MaxPercentage > 100 clamp in main.go; the config
UnmarshalYAML already returns an error for out-of-range values before
this code is reached.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
The debug flag in `promtool test rules` writes diagnostic output
using fmt.Printf to stdout, which can interfere with machine-parseable
output (e.g. JUnit XML via --junit-output) and piped workflows.
Redirect all DEBUG lines to stderr using fmt.Fprintf(os.Stderr, ...),
consistent with the existing error output pattern already present in
the file (line 78).
Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>