* UI: Fix broken Y axis after graph page reload
The new `y_axis_min` setting was always encoded into the URL, even if its value
was `null` (in which case it would be set to an empty string parameter). On the
decoding side, this wasn't taken into account correctly, and we tried to parse
the empty string as a float, causing completely broken graphs showing nothing
after reloading the graph page with such URL parameters.
I'm doing two things now:
* For the future, only encode the Y axis min into the URL if it's set at all,
similar as we do for the `end_input` and `moment_input` fields.
* On the decoding side, accommodate people (at least for now) who already saved
some links with the empty `y_axis_min` parameter by treating an empty string
as `null` instead of a number.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Add URL state encoding/decoding tests
Signed-off-by: Julius Volz <julius.volz@gmail.com>
---------
Signed-off-by: Julius Volz <julius.volz@gmail.com>
When accepting an autocompletion result within an Identifier node (could be a
metric name, function name, keyword, etc.), the inserted completion should
replace the entire Identifier node all the way to its last character, not only
to the current cursor position.
A limitation is that the correct replacement-until-end-of-identifier only works
when e.g. a function name is currently incomplete (which is likely anyway when
trying to replace it with a different one). This is because otherwise the
Identifier node gets replaced with a more specific function node type (like
`Rate`, `SumOverTime`, etc.), and handling all those adds more complexity.
https://github.com/prometheus/prometheus/issues/15839
Signed-off-by: Julius Volz <julius.volz@gmail.com>
The /classic/static/* route was added to serve vendor JavaScript and CSS
files (jQuery, Bootstrap, etc.) for console templates. These vendor assets
were removed in #14807 due to security vulnerabilities, making this route
obsolete as it now serves an empty directory.
The console feature remains functional via --web.console.templates and
--web.console.libraries flags. Users who need JavaScript/CSS libraries in
their custom console templates must provide these assets within the
directory specified by --web.console.libraries.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
When React components mount/unmount repeatedly, each creating a new
PromQLExtension, memory leaks occur due to LRU caches with ttlAutopurge
timers keeping references alive and in-flight HTTP requests holding
closure references. This adds destroy() methods throughout the class
hierarchy to properly release resources on unmount.
Changes:
- Add destroy() to PrometheusClient interface (optional)
- HTTPPrometheusClient: track AbortControllers and abort pending requests
- Cache: clear all LRU caches and reset cached data
- CachedPrometheusClient: delegate to cache and underlying client
- HybridComplete: delegate to prometheusClient
- CompleteStrategy: add optional destroy() method
- PromQLExtension: delegate to complete strategy
Signed-off-by: Ben Blackmore <ben.blackmore@dash0.com>
Update generated files with latest functions from Prometheus, adding
support for first_over_time, info, ts_of_first_over_time,
ts_of_last_over_time, ts_of_max_over_time, and ts_of_min_over_time.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Add make targets to generate and check PromQL function signatures and
documentation for the Mantine UI. The generate-promql-functions target
runs the Go generators and automatically lints the output files. The
check-generated-promql-functions target verifies that generated files
are up to date, similar to check-generated-parser.
Fix the gen_functions_list generator to output properly formatted
TypeScript code with correct indentation and semicolons.
Add check-generated-promql-functions to the UI tests CI job to ensure
generated files stay in sync with upstream changes.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
By running `make update-all-go-deps`.
`hashicorp/consul/api` must be held at v1.32.1 because later versions
require Go 1.25 and we choose to ensure that Promethes builds with the
last two versions of Go.
Also: fix compilation errors in remote-write example.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Add a maximum limit of 10,000 to the TSDB status endpoint to prevent
resource exhaustion from excessively large limit values, as we preallocate
[]Stat for up to the limit: `make([]Stat, 0, length)`.
Note that the endpoint acquires a cardinality mutex during
stats calculation, so this can not be run in parallel.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Currently both the backend and frontend printers/formatters/serializers
incorrectly transform the following expression:
```
up * ignoring() group_left(__name__) node_boot_time_seconds
```
...into:
```
up * node_boot_time_seconds
```
...which yields a different result (including the metric name in the result
vs. no metric name).
We need to keep empty `ignoring()` modifiers if there is a grouping modifier
present.
Signed-off-by: Julius Volz <julius.volz@gmail.com>