Commit graph

1791 commits

Author SHA1 Message Date
Julius Volz 2b12ff7ce8 Fix query_format path
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-08 15:19:43 +01:00
Julius Volz d2f913ac1e Implement initial time check and fetching of metric names
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-08 15:15:49 +01:00
Julius Volz 33a753c2f8 Implement pathPrefix handling
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-08 14:06:05 +01:00
Julius Volz 5fea050fed Refactor API fetching code, handle all possible errors correctly
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 21:05:12 +01:00
Björn Rabenstein 9acae57937
Merge pull request #13681 from krajorama/native-latency-histograms
Add native histograms to latency/duration metrics
2024-03-07 20:46:43 +01:00
Julius Volz 92195e3fb6 Implement expression formatting
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 17:45:14 +01:00
Julius Volz 074b4eb36e Smaller font size for data table
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 17:44:45 +01:00
Julius Volz 124f36e670 Add back removing panels via menu
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 16:59:47 +01:00
Julius Volz 1e523b204d Improve query panel / data table layout and spacing
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 16:59:25 +01:00
Julius Volz 2bb14c5787 Lots of more progress on the new Mantine UI
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-03-07 13:16:54 +01:00
Bryan Boreham 25f200bf85 API tests: fix flaky TestEndpoints
When a limit is specified, the API may return arbitrary rows, so don't
check specific response values.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 09:59:18 +00:00
Charles Korn 4e77e8e5ef
Allow using alternative PromQL engines for rule evaluation
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2024-03-06 14:54:33 +11:00
György Krajcsovits 4d4d822c36 Add native histograms to latency/duration metrics
Dogfood native histograms.
Allow dependent projects to migrate to native histograms.

I took the defaults from client_golang.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-03-01 14:44:38 +01:00
Kartikay 8736772053
web/api: add limit param on series, labels, label-values (#13396)
Support limit parameter in queries to restrict output data to the specified size, on the following endpoints:

/api/v1/series
/api/v1/labels
/api/v1/label/:name:/values

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
2024-02-29 15:31:13 +00:00
Manik Rana ab9b770aea
ui (histograms): Add native histogram chart to Table view (#13658)
* feat: initial add histogram table

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* feat: add x-axis scale toggle

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* refac: adjust histogram summary styles

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* feat: initial add histogram table

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* feat: add x-axis scale toggle

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* refac: adjust histogram summary styles

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* chore: remove unused code

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* tests: test for HistogramChart instead of HistogramString

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* fix: remove histogramChart from a test

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* chore: rename style classes

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* refac: suppress test errors

Signed-off-by: Manik Rana <manikrana54@gmail.com>

---------

Signed-off-by: Manik Rana <manikrana54@gmail.com>
2024-02-29 14:21:15 +01:00
machine424 f477e0539a
Move from golang.org/x/exp/slices into slices now that we only support Go >= 1.21
Prevent adding back golang.org/x/exp/slices.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2024-02-28 14:54:53 +01:00
Bryan Boreham d2817e9c91
Merge pull request #12304 from bboreham/labels-symboltable
Labels: reduce memory by de-duplicating strings in SymbolTables
2024-02-26 14:06:27 +00:00
Bryan Boreham 518ab179fb Merge branch 'release-2.50' into merge-2.50.1 2024-02-26 11:50:06 +00:00
Bryan Boreham 9ba13de220 scraping: pass a Builder to get Target labels
This saves memory allocations from making a new Builder every time.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-26 11:45:25 +00:00
Bryan Boreham eff3a13e19 model/textparse: parsers take a labels SymbolTable
This allows strings to be interned to save memory.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-26 11:45:25 +00:00
Bryan Boreham e537d6d1c1 Cut 2.50.1 with metadata api bugfix
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-26 10:00:21 +00:00
ismail simsek eecaa71ff1 Fix: metadata API using wrong field names (#13633)
Fix is to add json tags to `Metadata` struct. Absence of these tags
causes Go to use the field name, which starts with an upper-case
letter and breaks the protocol.

Extend tests to verify the JSON response.

Signed-off-by: ismail simsek <ismailsimsek09@gmail.com>
2024-02-26 09:54:39 +00:00
ismail simsek 2507469291
Fix: metadata API using wrong field names (#13633)
Fix is to add json tags to `Metadata` struct. Absence of these tags
causes Go to use the field name, which starts with an upper-case
letter and breaks the protocol.

Extend tests to verify the JSON response.

Signed-off-by: ismail simsek <ismailsimsek09@gmail.com>
2024-02-26 09:53:39 +00:00
Julius Volz 89ecb3a3f2 Add input field to /graph page.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-23 17:38:25 +01:00
Julius Volz 128b6461e9 Start working on /alerts page, factor out rule definition display
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-23 17:37:56 +01:00
Julius Volz 65cc7b058e Remove index.css from initial default app
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-23 14:21:20 +01:00
Julius Volz ce1ca6481e Better navbar icon sizes
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-23 14:19:46 +01:00
Manik Rana 08832e2db8
histogram: add UI tests for rendering histogram (#13631)
* histogram: add tests for rendering histograms

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* histogram: add tests for rendering histograms

Signed-off-by: Manik Rana <manikrana54@gmail.com>

* chore: remove unused import

Signed-off-by: Manik Rana <manikrana54@gmail.com>

---------

Signed-off-by: Manik Rana <manikrana54@gmail.com>
2024-02-23 11:31:39 +01:00
Augustin Husson 9738e48a7d
Merge pull request #13629 from prometheus/release-2.50
merge back release 2.50
2024-02-22 11:07:52 +01:00
Augustin Husson 814b920e8a
Cut v2.50.0 (#13612)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2024-02-22 10:21:59 +01:00
Julius Volz 096acdce7e Fix npm workspaces build for Mantine UI
Thanks to input by @nexucis :)

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-21 22:36:27 +01:00
Julius Volz cc38c1426a Attempt to integrate Mantine UI into npm workspaces + Prometheus binary
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-21 11:14:35 +01:00
Julius Volz d6a347e5de Implement several status pages and other general aspects
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-21 11:13:48 +01:00
Augustin Husson 93591ec5cc
Cut v2.50.0-rc.1 (#13602)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2024-02-19 14:15:03 +01:00
Bryan Boreham aba0071480
Merge pull request #13589 from bboreham/trace_id
Standardise exemplar label as "trace_id"
2024-02-19 09:34:04 +00:00
Julius Volz dfabda7507 Add scaffold for new Mantine-based UI
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-02-17 12:29:47 +01:00
Owen Williams a28d7865ad UTF-8: Add support for parsing UTF8 metric and label names
This adds support for the new grammar of `{"metric_name", "l1"="val"}` to promql and some of the exposition formats.
This grammar will also be valid for non-UTF-8 names.
UTF-8 names will not be considered valid unless model.NameValidationScheme is changed.

This does not update the go expfmt parser in text_parse.go, which will be addressed by https://github.com/prometheus/common/issues/554/.

Part of https://github.com/prometheus/prometheus/issues/13095

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-02-15 14:34:37 -05:00
Bryan Boreham c0e36e6bb3 Standardise exemplar label as "trace_id"
This is consistent with the OpenTelemetry standard, and an example in OpenMetrics.

https://github.com/open-telemetry/opentelemetry-specification/blob/89aa01348139/specification/metrics/data-model.md#exemplars
https://github.com/OpenObservability/OpenMetrics/blob/138654493130/specification/OpenMetrics.md#exemplars-1

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-15 14:20:08 +00:00
Augustin Husson 452f4c96b7
Cut v2.50.0-rc.0 (#13465)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2024-02-13 10:21:23 +01:00
Bryan Boreham 39af788dbd Tests: use replacement DeepEquals using go-cmp
Use DeepEqual replacement using go-cmp, which is more flexible.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-08 19:30:20 +00:00
Bryan Boreham 98c4889029
Merge pull request #9298 from Creatone/creatone/use-testify
tests: Move from t.Errorf and others.
2024-02-04 16:27:57 +01:00
Faustas Butkus 6feffeb92e
promql: add histogram_avg function (#13467)
Add histogram_avg function

---------

Signed-off-by: Faustas Butkus <faustas.butkus@gmail.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2024-02-01 18:28:42 +01:00
Bryan Boreham 16e68c01e4 tests: remove err from message when testify prints it already
For instance `require.NoError` will print the unexpected error; we don't
need to include it in the message.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-02-01 14:18:01 +00:00
Paweł Szulik 6e9cca8158 Refactor web tests to use testify.
Signed-off-by: Paweł Szulik <paul.szulik@gmail.com>
2024-02-01 13:51:31 +00:00
Leegin 19efd0a675
api: Serialize discovered labels into JSON directly in dropped targets (#13484)
Converted maps into labels.Labels to avoid a lot of copying of data which leads to very high memory consumption while opening the /service-discovery endpoint in the Prometheus UI

Signed-off-by: Leegin <114397475+Leegin-darknight@users.noreply.github.com>
2024-01-29 10:20:20 +00:00
Leegin e3040bfabc
api: Serialize discovered and target labels into JSON directly (#13469)
Converted maps into labels.Labels to avoid a lot of copying of data which leads to very high memory consumption while opening the /service-discovery endpoint in the Prometheus UI

Signed-off-by: Leegin <114397475+Leegin-darknight@users.noreply.github.com>
2024-01-29 10:19:02 +00:00
Yury Molodov a598ddfbc4
ui/fix: correct url handling for stacked graphs (#13460)
Signed-off-by: Yury Moladau <yurymolodov@gmail.com>
2024-01-26 09:25:23 +01:00
Augustin Husson 52fa5863a2
Merge branch 'main' into nexucis/merge-back 2024-01-25 13:31:16 +01:00
Filip Petkovski 583f3e587c
Optimize histogram iterators (#13340)
Optimize histogram iterators

Histogram iterators allocate new objects in the AtHistogram and
AtFloatHistogram methods, which makes calculating rates over long
ranges expensive.

In #13215 we allowed an existing object to be reused
when converting an integer histogram to a float histogram. This commit follows
the same idea and allows injecting an existing object in the AtHistogram and
AtFloatHistogram methods. When the injected value is nil, iterators allocate
new histograms, otherwise they populate and return the injected object.

The commit also adds a CopyTo method to Histogram and FloatHistogram which
is used in the BufferedIterator to overwrite items in the ring instead of making
new copies.

Note that a specialized HPoint pool is needed for all of this to work 
(`matrixSelectorHPool`).

---------

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2024-01-23 17:02:14 +01:00
tyltr f97fa2736c remove obsolete build tag
Signed-off-by: tyltr <tylitianrui@126.com>
2024-01-17 22:26:32 +08:00
bwplotka 216b5edb41 Cut 2.49.1 web package.
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-01-15 16:44:33 +00:00
Bartlomiej Plotka db3544c552
Merge branch 'main' into merge-2.49.0-back
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-01-15 12:38:36 +01:00
Ayoub Mrini ace9c8a3da
promtool: allow setting multiple matchers to "promtool tsdb dump" command. (#13296)
Conditions are ANDed inside the same matcher but matchers are ORed

Including unit tests for "promtool tsdb dump".

Refactor some matchers scraping utils.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2024-01-15 10:29:53 +00:00
bwplotka cf50f85faa Cut 2.49.0
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-01-15 09:55:35 +00:00
bwplotka abbcdc61f5 Cut 2.49.0-rc.2
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-01-08 09:49:30 +00:00
Bartlomiej Plotka d4a6bc03f2 Merge pull request #13371 from kevinmingtarja/fix-isHeatmapData
ui: fix handling of scalar and string in isHeatmapData
2024-01-08 09:42:46 +00:00
Bartlomiej Plotka 775d955919
Merge pull request #13371 from kevinmingtarja/fix-isHeatmapData
ui: fix handling of scalar and string in isHeatmapData
2024-01-07 19:59:20 +01:00
Kevin Mingtarja 40941d450b Fix handling of scalar and string in isHeatmapData
Signed-off-by: Kevin Mingtarja <kevin.mingtarja@gmail.com>
2024-01-04 02:48:54 +07:00
Kevin Mingtarja c126c21baa Fix DataTableProps['data'] for resultType string
Signed-off-by: Kevin Mingtarja <kevin.mingtarja@gmail.com>
2024-01-04 01:51:56 +07:00
bwplotka 20b4ef5d58 Cut v2.49.0-rc.1
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-12-19 19:23:43 +00:00
Bryan Boreham 8065bef172 Move metric type definitions to common/model
They are used in multiple repos, so common is a better place for them.
Several packages now don't depend on `model/textparse`, e.g.
`storage/remote`.

Also remove `metadata` struct from `api.go`, since it was identical to
a struct in the `metadata` package.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-12-19 18:56:54 +00:00
Bryan Boreham 99c17b4319
Merge pull request #13177 from bboreham/less-madness
scrape: consistent function names for metadata
2023-12-19 17:51:52 +00:00
machine424 ea97086484
ui: create a reproduction for https://github.com/prometheus/prometheus/issues/13292
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2023-12-15 18:04:29 +01:00
Bartlomiej Plotka c4c8d59c14
Cut 2.49.0-rc.0 (#13270)
* Cut 2.49.0-rc.0

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

* Removed the duplicate.

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

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-12-12 10:12:08 +00:00
Björn Rabenstein db915b07cb
Merge pull request #13215 from fpetkovski/float-histogram-reuse
Enable reusing memory when converting between histogram types
2023-12-09 22:44:46 +01:00
Bartlomiej Plotka 91a383f52c
Merge pull request #13059 from zenador/add-mad-function
Add mad_over_time function
2023-12-08 11:53:22 +00:00
Filip Petkovski 10a82f87fd
Enable reusing memory when converting between histogram types
The 'ToFloat' method on integer histograms currently allocates new memory
each time it is called.

This commit adds an optional *FloatHistogram parameter that can be used
to reuse span and bucket slices. It is up to the caller to make sure the
input float histogram is not used anymore after the call.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2023-12-08 10:22:59 +01:00
dependabot[bot] 48b1818ee8
build(deps-dev): bump @types/node from 17.0.45 to 20.10.4 in /web/ui (#13260)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.45 to 20.10.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-08 09:19:48 +00:00
Bartlomiej Plotka bc4f8366c5
Upgraded npm dependencies pre 2.49-rc.0 (#13256)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-12-07 14:43:15 +00:00
dependabot[bot] b9960d6d8d
build(deps-dev): bump @babel/traverse from 7.19.3 to 7.23.3 in /web/ui (#13137)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.19.3 to 7.23.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.3/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-07 11:44:57 +00:00
Matthieu MOREL 9c4782f1cc
golangci-lint: enable testifylint linter (#13254)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-07 11:35:01 +00:00
Julien Pivotto 6e8e16c050
Merge pull request #13227 from prometheus/release-2.48
Merge release-2.48 back into main
2023-12-01 16:09:02 +01:00
Jeanette Tan 9bf4cc993e Add mad_over_time function
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-12-01 01:22:58 +08:00
Alexander Trost 5051a993ab promql: add sort_by_label and sort_by_label_desc functions
This adds functions to sort a vector by its label value.

Based on https://github.com/prometheus/prometheus/pull/1533

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
2023-11-28 14:40:07 +01:00
dependabot[bot] 8d058884a0
build(deps): bump sanitize-html from 2.10.0 to 2.11.0 in /web/ui (#12513)
Bumps [sanitize-html](https://github.com/apostrophecms/sanitize-html) from 2.10.0 to 2.11.0.
- [Changelog](https://github.com/apostrophecms/sanitize-html/blob/main/CHANGELOG.md)
- [Commits](https://github.com/apostrophecms/sanitize-html/compare/2.10.0...2.11.0)

---
updated-dependencies:
- dependency-name: sanitize-html
  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>
2023-11-28 12:49:34 +01:00
Yury Molodov 2e205ee95c
ui: heatmap visualization for histogram buckets (#13096)
ui: heatmap visualization for histogram buckets

Signed-off-by: Yury Moladau <yurymolodov@gmail.com>

---------

Signed-off-by: Yury Moladau <yurymolodov@gmail.com>
2023-11-24 22:44:48 +01:00
Bryan Boreham 34676a240e scrape: consistent function names for metadata
Too confusing to have `MetadataList` and `ListMetadata`, etc.
I standardised on the ones which are in an interface.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-11-23 09:08:02 +00:00
Levi Harrison 41c7253333 Release 2.48.0
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2023-11-15 15:15:57 -05:00
Bryan Boreham 41758972e4
web/api: optimize labelnames/values with 1 set of matchers (#12888)
* web/api: optimize labelnames/values with 1 set of matchers

If there is exactly one set of matchers provided, we can skip adding
the results to a map and getting them back out again.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

---------

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-11-13 19:28:48 +01:00
Jacob Baungård Hansen 80d2f992ae
codemirror-promql: Add request header to client (#13118)
With this commit we make it possible to adjust the request headers sent
to Prometheus by the codemirror-promql extension. This enables
customizing the headers sent, without re-implementing the Prometheus
client completely.

Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com>
2023-11-10 11:22:32 +01:00
Matthieu MOREL 05fba53e57 web : use Go standard package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-11-08 06:37:59 +00:00
beorn7 5dca994f64 Merge branch 'release-2.48' into beorn7/release 2023-11-02 19:58:33 +01:00
Levi Harrison 8b87f3bbf1 Release 2.48.0-rc.2
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2023-11-01 21:19:24 -04:00
Björn Rabenstein a43669e611
Merge pull request #12928 from alexandear/ci-enable-godot
ci(lint): enable godot; append dot at the end of comments
2023-11-01 17:15:41 +01:00
Julien Pivotto f568221610
Merge pull request #13057 from prometheus/release-2.48
Merge release-2.48 back into main
2023-10-31 15:24:39 -04:00
Oleksandr Redko fa90ca46e5 ci(lint): enable godot; append dot at the end of comments
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 19:53:38 +02:00
Oleksandr Redko 8e5f0387a2
ci(lint): enable nolintlint and remove redundant comments (#12926)
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 12:35:13 +01:00
Julien Pivotto 156a23d06d
Merge pull request #12999 from rajagopalanand/filter-alerts
Adding a query parameter to filter out active alerts
2023-10-30 13:10:24 +01:00
Levi Harrison 8db8ad1bae
bump version (#13032)
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2023-10-27 23:25:56 +02:00
Gilles De Mey 4912c82ed0
ui: Pass unexpected boot errors to StartingContent component (#13016)
Signed-off-by: Gilles De Mey <gilles.de.mey@gmail.com>
2023-10-23 14:17:53 +02:00
Anand Rajagopal 2ade8adf9e Adding a query parameter to filter out active alerts
Signed-off-by: Anand Rajagopal <anrajag@amazon.com>
2023-10-18 02:05:26 +00:00
Levi Harrison 827804c79d Release 2.48.0-rc0
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2023-10-15 22:32:41 -04:00
Danny Kopping d3554d8421
Show group interval in Rules display (#12943)
* Show group interval in Rules display

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>

* Humanise interval

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>

---------

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
2023-10-08 14:51:24 +02:00
Arve Knudsen b43358fd43
API: Add tests for query timeout parameter (#12927)
Add unit tests for Web API's query endpoint (GET/POST).
Also modify the endpoint handler to use context.WithDeadline instead of
context.WithTimeout, so the deadline is deterministic for the tests.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-10-04 10:36:55 +02:00
Julien Pivotto 76ebd621d6 UI: Update word-wrap (GHSA-j8xg-fqg3-53r7)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:54:45 +02:00
Julien Pivotto 3d80cb1325 UI: Update json5 (GHSA-9c47-m6qq-7p4h)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:53:45 +02:00
Julien Pivotto d50c7d3bfc UI: Update loader-utils (GHSA-hhq3-ff78-jv3g GHSA-3rfm-jhwj-7488)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:53:42 +02:00
Julien Pivotto f24dc17fcc UI: Update semver (GHSA-c2qf-rxjj-qqgw)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:51:00 +02:00
Julien Pivotto ca12cb8909 UI: Update tough-cookie (GHSA-72xf-g2v4-qvf3 GHSA-76p3-8jx3-jpfq)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:50:53 +02:00
Julien Pivotto b6fbda0c8a UI: Update Webpack (GHSA-hc6q-2mpp-qw7j)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 13:47:54 +02:00
Goutham Veeramachaneni 86729d4d7b
Update exp package (#12650) 2023-09-21 22:53:51 +02:00
zenador 69edd8709b
Add warnings (and annotations) to PromQL query results (#12152)
Return annotations (warnings and infos) from PromQL queries

This generalizes the warnings we have already used before (but only for problems with remote read) as "annotations".

Annotations can be warnings or infos (the latter could be false positives). We do not treat them different in the API for now and return them all as "warnings". It would be easy to distinguish them and return infos separately, should that appear useful in the future.

The new annotations are then used to create a lot of warnings or infos during PromQL evaluations. Partially these are things we have wanted for a long time (e.g. inform the user that they have applied `rate` to a metric that doesn't look like a counter), but the new native histograms have created even more needs for those annotations (e.g. if a query tries to aggregate float numbers with histograms).

The annotations added here are not yet complete. A prominent example would be a warning about a range too short for a rate calculation. But such a warnings is more tricky to create with good fidelity and we will tackle it later.

Another TODO is to take annotations into account when evaluating recording rules.

---------

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-09-14 18:57:31 +02:00
Arve Knudsen 156222cc50
Add context argument to LabelQuerier.LabelValues (#12665)
Add context argument to LabelQuerier.LabelValues and
LabelQuerier.SortedLabelValues.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-14 16:02:04 +02:00
Arve Knudsen a964349e97
Add context argument to LabelQuerier.LabelNames (#12666)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-14 10:39:51 +02:00
Arve Knudsen 6ef9ed0bc3
Add context argument to DB.Delete (#12834)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-13 15:43:06 +02:00
Arve Knudsen 6daee89e5f
Add context argument to Querier.Select (#12660)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-12 12:37:38 +02:00
Julius Volz aa7bf083e9
Move /targets page discovered labels to expandable section (#12824)
* Move /targets page discovered labels to expandable section

The current tooltip for showing the pre-relabeling discovered labels for a
target is notoriously unreliable and can get cut off when there are many
labels. This PR introduces a (hopefully unobtuse enough) expander/collapser
button for the discovered labels of each target, and then the discovered labels
are shown in a more persistent way underneath the final target labels, instead
of using a tooltip.

Fixes https://github.com/prometheus/prometheus/issues/9175#issuecomment-1713074341

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Remove obsolete test snapshot

Signed-off-by: Julius Volz <julius.volz@gmail.com>

---------

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2023-09-11 11:36:44 +02:00
Bryan Boreham cfa78609f7 Merge branch 'release-2.47' into merge-2-47-0
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-09-06 11:49:15 +00:00
Bryan Boreham 966dc0bf67 Release 2.47.0
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-09-06 08:16:07 +00:00
Daniel Mellado 6ee3db15e4
Add version in web/ui/package-lock.json (#12771)
This commit adds the option --include-workspace-root in ui_release.sh
npm scripts in order to also include the version in web/ui/pagkage jsons
files when bumping the version. This also avoids issues when building
directly with npm install on some systems.

Signed-off-by: Daniel Mellado <dmellado@redhat.com>
2023-09-01 10:38:15 +02:00
arukiidou 1df0fb5569
build(deps): bump lru-cache from 6.0.0 to 7.18.3 in /web/ui (#12768)
Signed-off-by: junya koyama <arukiidou@yahoo.co.jp>
2023-09-01 10:35:29 +02:00
SuperQ 23988a9373
Update nodejs version
Update to the latest nodejs LTS release. The old v16 ends security
support 2023.09.11.

* https://nodejs.org/en/blog/announcements/v20-release-announce
* https://nodejs.org/en/blog/announcements/nodejs16-eol

Signed-off-by: SuperQ <superq@gmail.com>
2023-08-27 16:57:41 +02:00
Bryan Boreham cebdc90f23 Release 2.47.0-rc.0
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-26 14:19:50 +00:00
zenador 54aaa2bd7e
Add histogram_stdvar and histogram_stddev functions (#12614)
* Add new function: histogram_stdvar and histogram_stddev

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-08-24 21:02:14 +02:00
beorn7 aa82fe198f tsdb: Fix histogram validation
So far, `ValidateHistogram` would not detect if the count did not
include the count in the zero bucket. This commit fixes the problem
and updates all the tests that have been undetected offenders so far.

Note that this problem would only ever create false negatives, so we
never falsely rejected to store a histogram because of it.

On the other hand, `ValidateFloatHistogram` has been to strict with
the count being at least as large as the sum of the counts in all the
buckets. Float precision issues could create false positives here, see
products of PromQL evaluations, it's actually quite hard to put an
upper limit no the floating point imprecision. Users could produce the
weirdest expressions, maxing out float precision problems. Therefore,
this commit simply removes that particular check from
`ValidateFloatHistogram`.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-08-22 23:04:01 +02:00
Michael Hoffmann 4d8e380269
promql: allow tests to be imported (#12050)
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
2023-08-18 20:48:59 +02:00
Bryan Boreham 1e3fef6ab0
scraping: limit detail on dropped targets, to save memory (#12647)
It's possible (quite common on Kubernetes) to have a service discovery
return thousands of targets then drop most of them in relabel rules.
The main place this data is used is to display in the web UI, where
you don't want thousands of lines of display.

The new limit is `keep_dropped_targets`, which defaults to 0
for backwards-compatibility.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-14 15:39:25 +01:00
Bryan Boreham 87cbd26f6b
Merge pull request #12598 from bboreham/labels-json
Faster streaming of Labels to JSON, via jsoniter.
2023-08-02 09:53:19 +01:00
Julien Pivotto 76dd9b5470
Merge pull request #12618 from prometheus/release-2.46
Merge release 2.46 into main
2023-07-31 10:07:17 +02:00
Goutham Veeramachaneni ad4f514e66
Add OTLP Ingestion endpoint (#12571)
* Add OTLP Ingestion endpoint

We copy files from the otel-collector-contrib. See the README in
`storage/remote/otlptranslator/README.md`.

This supersedes: https://github.com/prometheus/prometheus/pull/11965

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

* Return a 200 OK

It is what the OTEL Golang SDK expect :(

https://github.com/open-telemetry/opentelemetry-go/issues/4363

Signed-off-by: Goutham <gouthamve@gmail.com>

---------

Signed-off-by: gouthamve <gouthamve@gmail.com>
Signed-off-by: Goutham <gouthamve@gmail.com>
2023-07-28 12:35:28 +02:00
Julien Pivotto 16c645a6dd Release 2.46.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-25 13:38:08 +02:00
Bryan Boreham dcadb32eb1 web/api: use stream encoder for embedded labels
This is much more efficient.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:42:36 +01:00
Bryan Boreham bb528d4a55 Add jsoniter encoder for Labels
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:13:34 +01:00
Bryan Boreham 54e1046616 web/api: extend BenchmarkRespond with more types of data
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:12:44 +01:00
Julien Pivotto c37af1eda5 Release 2.46.0-rc.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-20 16:52:56 +02:00
beorn7 2ea8df4734 histogram: Expose #12305
Native histograms without a zero threshold aren't federated properly.

This adds a test to prove the specific failure mode, which is that
histograms with a zero threshold of zero are federated as classic
histograms.

The underlying reason is that the protobuf parser identifies a native
histogram by detecting a zero bucket or by detecting integer buckets.
Therefore, a float histogram with a zero threshold of zero and an
unpopulated zero bucket falls through the cracks (no integer buckets,
no zero bucket).

This commit also addse a test case for the latter.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-19 15:29:11 +02:00
Julien Pivotto c572d9d6d9
Merge pull request #11905 from charleskorn/api-response-format-extension-point
Add extension point for returning different content types from API endpoints
2023-07-15 22:49:29 +02:00
Julien Pivotto f3f3d8f5ca
Merge pull request #12540 from bboreham/slices-sorts2
Replace sort.Sort with faster slices.SortFunc
2023-07-11 13:08:19 +02:00
Bryan Boreham ce153e3fff Replace sort.Sort with faster slices.SortFunc
The generic version is more efficient.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-10 09:43:45 +00:00
Marco Pracucci 7cc4292328
Export MinTime and MaxTime
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-07-06 17:48:13 +02:00
Julien Pivotto 0186ec7873
Merge pull request #12516 from vinted/convert_queryopts_to_interface
promql: convert QueryOpts to interface
2023-07-04 23:38:31 +02:00
Julien Pivotto 986fde06b2
Merge pull request #11688 from damnever/fix/datamodelvalidation-remotewriteapi
Validate the metric names and labels in the remote write handler
2023-07-04 13:52:02 +02:00
Charles Korn 097faf33c6
Merge branch 'main' into api-response-format-extension-point
# Conflicts:
#	web/api/v1/api.go
#	web/api/v1/api_test.go
2023-07-04 13:26:13 +10:00
Giedrius Statkevičius 3f230fc9f8 promql: convert QueryOpts to interface
Convert QueryOpts to an interface so that downstream projects like
https://github.com/thanos-community/promql-engine could extend the query
options with engine specific options that are not in the original
engine.

Will be used to enable query analysis per-query.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
2023-07-03 16:20:31 +03:00
Matthias Loibl 71d149a79f
Merge pull request #12472 from metalmatze/request-counter-init
web: Initialize requestCounter metrics to 0 with handler and 200 labels
2023-06-30 14:07:20 +02:00
cui fliter 484a9e4071
fix some typos (#12498)
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-06-29 12:28:13 +02:00
Matthias Loibl 686482ab34
Remove Add(0)
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2023-06-27 18:10:38 +02:00
Julien Pivotto 490bf641be
Merge pull request #12487 from prometheus/release-2.45
Merge Release 2.45 back to main
2023-06-23 23:56:10 +02:00
Jesus Vazquez 8ef767e396
Release 2.45.0 (#12486)
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2023-06-23 17:01:52 +02:00
Jesus Vazquez c858049744
Create 2.45.0-rc.1 (#12478)
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2023-06-20 15:13:02 +00:00
Matthias Loibl 8bc2a19469
web: Initialize requestCounter metrics to 0 with handler and 200k labels.
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2023-06-19 17:50:16 +02:00
Julien Pivotto e043b273a6
Merge pull request #12439 from prometheus/release-2.45
Merge release 2.45.0 back to main
2023-06-17 10:16:48 +02:00
Arthur Silva Sens 1ea477f4bc
Add feature flag to squash metadata from /api/v1/metadata (#12391)
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
2023-06-12 16:17:20 +01:00
Jesus Vazquez edfc97a77e
Bump UI version (#12440)
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2023-06-07 16:00:15 +02:00
Jesus Vazquez bfa466d00f
Create release candidate 2.45.0-rc.0 (#12435)
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2023-06-07 12:29:04 +02:00
cui fliter 6e7ac76981
fix problematic link (#12405)
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-29 10:26:11 +02:00
Baskar Shanmugam 905a0bd63a
Added 'limit' query parameter support to /api/v1/status/tsdb endpoint (#12336)
* Added 'topN' query parameter support to /api/v1/status/tsdb endpoint

Signed-off-by: Baskar Shanmugam <baskar.shanmugam.career@gmail.com>

* Updated query parameter for tsdb status to 'limit'

Signed-off-by: Baskar Shanmugam <baskar.shanmugam.career@gmail.com>

* Corrected Stats() parameter name from topN to limit

Signed-off-by: Baskar Shanmugam <baskar.shanmugam.career@gmail.com>

* Fixed p.Stats CI failure

Signed-off-by: Baskar Shanmugam <baskar.shanmugam.career@gmail.com>

---------

Signed-off-by: Baskar Shanmugam <baskar.shanmugam.career@gmail.com>
2023-05-22 14:37:07 +02:00
Bryan Boreham a073e04a9b
Merge pull request #12366 from prometheus/release-2.44
Merge release 2.44 back to main
2023-05-16 18:06:29 +01:00
Bryan Boreham 1ac5131f69
Release 2.44.0 (#12364)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-14 07:13:03 +01:00
beorn7 9e500345f3 textparse/scrape: Add option to scrape both classic and native histograms
So far, if a target exposes a histogram with both classic and native
buckets, a native-histogram enabled Prometheus would ignore the
classic buckets. With the new scrape config option
`scrape_classic_histograms` set, both buckets will be ingested,
creating all the series of a classic histogram in parallel to the
native histogram series. For example, a histogram `foo` would create a
native histogram series `foo` and classic series called `foo_sum`,
`foo_count`, and `foo_bucket`.

This feature can be used in a migration strategy from classic to
native histograms, where it is desired to have a transition period
during which both native and classic histograms are present.

Note that two bugs in classic histogram parsing were found and fixed
as a byproduct of testing the new feature:

1. Series created from classic _gauge_ histograms didn't get the
   _sum/_count/_bucket prefix set.
2. Values of classic _float_ histograms weren't parsed properly.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-05-13 01:32:25 +02:00
Bryan Boreham 94d9367bbf
Create 2.44.0-rc.2 (#12341)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-08 11:30:29 +01:00
Bryan Boreham 3d26faade4
Create 2.44.0-rc.1 (#12323)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-03 16:18:28 +01:00
Bryan Boreham aeccf9e770 Bump version to 2.44.0-rc0
Including CHANGELOG.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-04-24 15:38:43 +00:00
Vladimir Varankin d281ebb178 web: display GOMEMLIMIT in runtime info
Signed-off-by: Vladimir Varankin <vladimir@varank.in>
2023-04-23 20:24:34 +02:00
Julien Pivotto 8f1dc4a70f
Merge pull request #12248 from yeya24/consistent-response
Use same error for instant and range query when 400
2023-04-21 11:44:20 +02:00
Julien Pivotto e2512078e5
Merge pull request #12241 from mmorel-35/linter/nilerr
enable gocritic, unconvert and unused linters
2023-04-20 15:13:31 +02:00
gotjosh 2f22c8b7f8
Merge pull request #12270 from prometheus/gotjosh/allow-filtering-of-rules-by-name-api
Rules API: Allow filtering by rule name
2023-04-20 12:03:08 +01:00
gotjosh e78be38cc0
don't show empty groups
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-20 11:20:20 +01:00
Matthieu MOREL bae9a21200
Merge branch 'main' into linter/nilerr
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-19 19:56:39 +02:00
beorn7 5b53aa1108 style: Replace else if cascades with switch
Wiser coders than myself have come to the conclusion that a `switch`
statement is almost always superior to a statement that includes any
`else if`.

The exceptions that I have found in our codebase are just these two:

* The `if else` is followed by an additional statement before the next
  condition (separated by a `;`).
* The whole thing is within a `for` loop and `break` statements are
  used. In this case, using `switch` would require tagging the `for`
  loop, which probably tips the balance.

Why are `switch` statements more readable?

For one, fewer curly braces. But more importantly, the conditions all
have the same alignment, so the whole thing follows the natural flow
of going down a list of conditions. With `else if`, in contrast, all
conditions but the first are "hidden" behind `} else if `, harder to
spot and (for no good reason) presented differently from the first
condition.

I'm sure the aforemention wise coders can list even more reasons.

In any case, I like it so much that I have found myself recommending
it in code reviews. I would like to make it a habit in our code base,
without making it a hard requirement that we would test on the CI. But
for that, there has to be a role model, so this commit eliminates all
`if else` occurrences, unless it is autogenerated code or fits one of
the exceptions above.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-04-19 17:22:31 +02:00
beorn7 c3c7d44d84 lint: Adjust to the lint warnings raised by current versions of golint-ci
We haven't updated golint-ci in our CI yet, but this commit prepares
for that.

There are a lot of new warnings, and it is mostly because the "revive"
linter got updated. I agree with most of the new warnings, mostly
around not naming unused function parameters (although it is justified
in some cases for documentation purposes – while things like mocks are
a good example where not naming the parameter is clearer).

I'm pretty upset about the "empty block" warning to include `for`
loops. It's such a common pattern to do something in the head of the
`for` loop and then have an empty block. There is still an open issue
about this: https://github.com/mgechev/revive/issues/810 I have
disabled "revive" altogether in files where empty blocks are used
excessively, and I have made the effort to add individual
`// nolint:revive` where empty blocks are used just once or twice.
It's borderline noisy, though, but let's go with it for now.

I should mention that none of the "empty block" warnings for `for`
loop bodies were legitimate.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-04-19 17:10:10 +02:00
gotjosh 96b6463f25
review comments
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-18 16:26:32 +01:00
gotjosh f3394bf7a1
Rules API: Allow filtering by rule name
Introduces support for a new query parameter in the `/rules` API endpoint that allows filtering by rule names.

If all the rules of a group are filtered, we skip the group entirely.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-18 10:12:08 +01:00
Ben Ye fd3630b9a3 add ctx to QueryEngine interface
Signed-off-by: Ben Ye <benye@amazon.com>
2023-04-17 21:32:38 -07:00
Matthieu MOREL fb3eb21230 enable gocritic, unconvert and unused linters
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-13 19:20:22 +00:00
beorn7 817a2396cb Name float values as "floats", not as "values"
In the past, every sample value was a float, so it was fine to call a
variable holding such a float "value" or "sample". With native
histograms, a sample might have a histogram value. And a histogram
value is still a value. Calling a float value just "value" or "sample"
or "V" is therefore misleading. Over the last few commits, I already
renamed many variables, but this cleans up a few more places where the
changes are more invasive.

Note that we do not to attempt naming in the JSON APIs or in the
protobufs. That would be quite a disruption. However, internally, we
can call variables as we want, and we should go with the option of
avoiding misunderstandings.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-04-13 19:25:24 +02:00
beorn7 630bcb494b storage: Use separate sample types for histogram vs. float
Previously, we had one “polymorphous” `sample` type in the `storage`
package. This commit breaks it up into `fSample`, `hSample`, and
`fhSample`, each still implementing the `tsdbutil.Sample` interface.

This reduces allocations in `sampleRing.Add` but inflicts the penalty
of the interface wrapper, which makes things worse in total.

This commit therefore just demonstrates the step taken. The next
commit will tackle the interface overhead problem.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-04-13 19:25:24 +02:00
beorn7 c0879d64cf promql: Separate Point into FPoint and HPoint
In other words: Instead of having a “polymorphous” `Point` that can
either contain a float value or a histogram value, use an `FPoint` for
floats and an `HPoint` for histograms.

This seemingly small change has a _lot_ of repercussions throughout
the codebase.

The idea here is to avoid the increase in size of `Point` arrays that
happened after native histograms had been added.

The higher-level data structures (`Sample`, `Series`, etc.) are still
“polymorphous”. The same idea could be applied to them, but at each
step the trade-offs needed to be evaluated.

The idea with this change is to do the minimum necessary to get back
to pre-histogram performance for functions that do not touch
histograms. Here are comparisons for the `changes` function. The test
data doesn't include histograms yet. Ideally, there would be no change
in the benchmark result at all.

First runtime v2.39 compared to directly prior to this commit:

```
name                                                  old time/op    new time/op    delta
RangeQuery/expr=changes(a_one[1d]),steps=1-16            391µs ± 2%     542µs ± 1%  +38.58%  (p=0.000 n=9+8)
RangeQuery/expr=changes(a_one[1d]),steps=10-16           452µs ± 2%     617µs ± 2%  +36.48%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_one[1d]),steps=100-16         1.12ms ± 1%    1.36ms ± 2%  +21.58%  (p=0.000 n=8+10)
RangeQuery/expr=changes(a_one[1d]),steps=1000-16        7.83ms ± 1%    8.94ms ± 1%  +14.21%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_ten[1d]),steps=1-16           2.98ms ± 0%    3.30ms ± 1%  +10.67%  (p=0.000 n=9+10)
RangeQuery/expr=changes(a_ten[1d]),steps=10-16          3.66ms ± 1%    4.10ms ± 1%  +11.82%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_ten[1d]),steps=100-16         10.5ms ± 0%    11.8ms ± 1%  +12.50%  (p=0.000 n=8+10)
RangeQuery/expr=changes(a_ten[1d]),steps=1000-16        77.6ms ± 1%    87.4ms ± 1%  +12.63%  (p=0.000 n=9+9)
RangeQuery/expr=changes(a_hundred[1d]),steps=1-16       30.4ms ± 2%    32.8ms ± 1%   +8.01%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=10-16      37.1ms ± 2%    40.6ms ± 2%   +9.64%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=100-16      105ms ± 1%     117ms ± 1%  +11.69%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=1000-16     783ms ± 3%     876ms ± 1%  +11.83%  (p=0.000 n=9+10)
```

And then runtime v2.39 compared to after this commit:

```
name                                                  old time/op    new time/op    delta
RangeQuery/expr=changes(a_one[1d]),steps=1-16            391µs ± 2%     547µs ± 1%  +39.84%  (p=0.000 n=9+8)
RangeQuery/expr=changes(a_one[1d]),steps=10-16           452µs ± 2%     616µs ± 2%  +36.15%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_one[1d]),steps=100-16         1.12ms ± 1%    1.26ms ± 1%  +12.20%  (p=0.000 n=8+10)
RangeQuery/expr=changes(a_one[1d]),steps=1000-16        7.83ms ± 1%    7.95ms ± 1%   +1.59%  (p=0.000 n=10+8)
RangeQuery/expr=changes(a_ten[1d]),steps=1-16           2.98ms ± 0%    3.38ms ± 2%  +13.49%  (p=0.000 n=9+10)
RangeQuery/expr=changes(a_ten[1d]),steps=10-16          3.66ms ± 1%    4.02ms ± 1%   +9.80%  (p=0.000 n=10+9)
RangeQuery/expr=changes(a_ten[1d]),steps=100-16         10.5ms ± 0%    10.8ms ± 1%   +3.08%  (p=0.000 n=8+10)
RangeQuery/expr=changes(a_ten[1d]),steps=1000-16        77.6ms ± 1%    78.1ms ± 1%   +0.58%  (p=0.035 n=9+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=1-16       30.4ms ± 2%    33.5ms ± 4%  +10.18%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=10-16      37.1ms ± 2%    40.0ms ± 1%   +7.98%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=100-16      105ms ± 1%     107ms ± 1%   +1.92%  (p=0.000 n=10+10)
RangeQuery/expr=changes(a_hundred[1d]),steps=1000-16     783ms ± 3%     775ms ± 1%   -1.02%  (p=0.019 n=9+9)
```

In summary, the runtime doesn't really improve with this change for
queries with just a few steps. For queries with many steps, this
commit essentially reinstates the old performance. This is good
because the many-step queries are the one that matter most (longest
absolute runtime).

In terms of allocations, though, this commit doesn't make a dent at
all (numbers not shown). The reason is that most of the allocations
happen in the sampleRingIterator (in the storage package), which has
to be addressed in a separate commit.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-04-13 19:25:16 +02:00
Ben Ye fb67d368a2 use consistent error for instant and range query 400
Signed-off-by: Ben Ye <benye@amazon.com>
2023-04-11 13:45:34 -07:00
Xiaochao Dong (@damnever) 2b7202c4cc Validate the metric names and labels in the remote write handler
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
2023-04-05 19:09:05 +08:00
Hayk Davtyan 408f31f786
[WebUI/ScrapePoolList] Case-insensitive search of "Scrape Pools" (#12207)
Signed-off-by: hayk96 <hayko5999@gmail.com>
2023-04-02 11:37:58 +02:00
Alison 3ac49d4ae2
Set SourceMap to false to fix UI in MCR builds (#12175)
* Set sourceMap to false

Signed-off-by: Alison Burgess <alburgess@microsoft.com>

* add sourcemap=false to package.json build

Signed-off-by: Alison Burgess <alburgess@microsoft.com>

* set sourcemap to true in tsconfig

Signed-off-by: Alison Burgess <alburgess@microsoft.com>

---------

Signed-off-by: Alison Burgess <alburgess@microsoft.com>
Co-authored-by: Alison Burgess <alburgess@microsoft.com>
2023-03-23 22:25:48 +01:00
Julien Pivotto de50efbf7a
Merge pull request #12165 from prometheus/release-2.43
Merge 2.43 in main
2023-03-21 17:26:28 +01:00
Julien Pivotto 1070c9b06c Release 2.43.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-21 13:07:51 +01:00
Julien Pivotto 2c6168be5f Release 2.43.0-rc.1
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-16 20:21:40 +01:00
pbudner 46683eadf7 fix: advertise correct flag to enable remote write receiver
Signed-off-by: pbudner <mail@pascalbudner.de>
2023-03-11 13:50:52 +01:00
Julien Pivotto b6d91e8bf8 Release 2.43.0-rc.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-09 14:30:02 +01:00
Charles Korn 38c1930f48
Merge branch 'main' into api-response-format-extension-point
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-03-09 12:06:26 +11:00
Charles Korn 46a28899a0
Implement fully-featured content negotiation for API requests, and allow overriding the default API codec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-03-09 12:02:45 +11:00
Julien Pivotto db2d759b81 Add support for lookbackdelta per query via the API
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-08 00:30:05 +01:00
Julien Pivotto 8e4350dd59 Directly include SVG logo in the page.
Use HTML <svg> element to include Prometheus logo in the status page.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-04 00:36:07 +01:00
Shan Aminzadeh 3f6f5d3357
Scope GroupBy labels to metric (#11914)
Signed-off-by: Shan Aminzadeh <shan.aminzadeh@chronosphere.io>
2023-02-17 10:23:16 +01:00
Charles Korn eaad7c0fc8
Merge branch 'main' into api-response-format-extension-point
Signed-off-by: Charles Korn <charleskorn@users.noreply.github.com>
2023-02-15 14:18:23 +01:00
Charles Korn deba5120ea
Address PR feeedback: reduce log level.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-11 15:34:25 +01:00
Fish-pro 43d77f7c41 Use http constants instead of string
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
2023-02-10 10:21:05 +08:00
Julien Pivotto c70d85baed
Merge pull request #11916 from prometheus/release-2.42
Merge 2.42 to main
2023-02-02 10:17:27 +01:00
Charles Korn 857b23873f
Expose QueryData so that implementations of Codec.CanEncode() can perform a type assertion against Response.Data.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-02 15:30:56 +11:00
Charles Korn a0dd1468be
Move custom jsoniter code into json_codec.go.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-02 13:10:20 +11:00
Charles Korn 3e94dd8c8f
Add extension point for returning different content types from API endpoints
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-02 13:10:19 +11:00
Kemal Akkoyun 225c61122d
Cut v2.42.0 (#11912)
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-01-31 18:04:46 +01:00
Kemal Akkoyun 7b9cc7eea3
Cut v2.42.0-rc.0 (#11902)
* Cut v2.42.0-rc.0

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Add missing log items

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-01-27 13:43:47 +01:00
Bartlomiej Plotka 6dcfb71740
Merge pull request #11897 from pracucci/propose-to-change-query-canceled-status-code
API: change HTTP status code from 503/422 to 499 if a request is canceled
2023-01-26 13:51:43 +00:00
Marco Pracucci 3db77b4491
API: change HTTP status code tracked in metrics form 503/422 to 499 if a request is canceled
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-01-26 13:06:37 +01:00
Kemal Akkoyun bab3b4e3c3 Upgrade dependencies
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-01-26 09:19:50 +01:00
Kemal Akkoyun ae597cac62
Upgrade several UI dependencies (#11894)
* build(deps): bump @codemirror/autocomplete in /web/ui

Bumps [@codemirror/autocomplete](https://github.com/codemirror/autocomplete) from 6.3.0 to 6.4.0.
- [Release notes](https://github.com/codemirror/autocomplete/releases)
- [Changelog](https://github.com/codemirror/autocomplete/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/autocomplete/compare/6.3.0...6.4.0)

---
updated-dependencies:
- dependency-name: "@codemirror/autocomplete"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump @fortawesome/fontawesome-svg-core in /web/ui

Bumps [@fortawesome/fontawesome-svg-core](https://github.com/FortAwesome/Font-Awesome) from 6.2.0 to 6.2.1.
- [Release notes](https://github.com/FortAwesome/Font-Awesome/releases)
- [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md)
- [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.2.0...6.2.1)

---
updated-dependencies:
- dependency-name: "@fortawesome/fontawesome-svg-core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-25 19:49:14 +01:00
Julien Pivotto 44ef49805c
Merge pull request #11890 from prometheus/release-2.41
Merge back Release 2.41
2023-01-25 11:22:46 +01:00
Shan Aminzadeh cdfd18ce00
[lezer-promql] Fix package.json main to point to correct cjs module (#11888)
Signed-off-by: Shan Aminzadeh <shan.aminzadeh@chronosphere.io>
2023-01-25 11:00:59 +01:00
Julien Pivotto 2c408289f8 Add stabilizing to UI
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-01-19 11:33:54 +01:00
Julien Pivotto ce55e5074d Add 'keep_firing_for' field to alerting rules
This commit adds a new 'keep_firing_for' field to Prometheus alerting
rules. The 'resolve_delay' field specifies the minimum amount of time
that an alert should remain firing, even if the expression does not
return any results.

This feature was discussed at a previous dev summit, and it was
determined that a feature like this would be useful in order to allow
the expression time to stabilize and prevent confusing resolved messages
from being propagated through Alertmanager.

This approach is simpler than having two PromQL queries, as was
sometimes discussed, and it should be easy to implement.

This commit does not include tests for the 'resolve_delay' field.  This
is intentional, as the purpose of this commit is to gather comments on
the proposed design of the 'resolve_delay' field before implementing
tests. Once the design of the 'resolve_delay' field has been finalized,
a follow-up commit will be submitted with tests."

See https://github.com/prometheus/prometheus/issues/11570

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-01-13 12:11:39 +01:00
beorn7 d121db7a65
federate: Fix PeekBack usage
In most cases, there is no sample at `maxt`, so `PeekBack` has to be
used. So far, `PeekBack` did not return a float histogram, and we
disregarded even any returned normal histogram. This fixes both, and
also tweaks the unit test to discover the problem (by using an earlier
timestamp than "now" for the samples in the TSDB).

Signed-off-by: beorn7 <beorn@grafana.com>
2023-01-12 20:43:02 +05:30