Commit graph

1062 commits

Author SHA1 Message Date
Matthias Loibl 369aae93a8
web/ui: Hitting enter on range input creates a new query (#8581)
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2021-03-11 14:37:26 +01:00
Julien Pivotto ad5ed416ba
Merge pull request #8487 from pschou/dev_neg_offset
allow negative offset
2021-03-08 22:18:45 +01:00
alex-petrov-vt 4f03df8c55
Fix inconsistent display of word 'ago' on rules page (#8566)
* Fix inconsistent display of word 'ago' in last evaluation column on rules page

Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>

* Extract adding word 'ago' to relativeDuration util function

Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>
2021-03-08 19:10:09 +01:00
Tom Wilkie ce97cdd477
Move remote read handler to remote package. (#8536)
* Move remote read handler to remote package.

This follows the pattern I started with the remote write handler.  The api/v1 package is getting pretty cluttered.  Moving code to other packages helps reduce this size and also makes it reusable - eg Cortex doesn't do streaming remote writes yet, and will very soon.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>

* Deal with a nil remoteReadHandler for tests.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>

* Remove the global metrics.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>

* Fix test.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>

* Review feedback.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2021-02-26 16:43:19 +00:00
Simon Pasquier fe23360d0f
web/ui/react-app: update dependencies (#8529)
Fix lodash security issue.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2021-02-24 21:01:28 +01:00
pschou f80b52be69
Merge branch 'main' into dev_neg_offset 2021-02-23 20:52:57 -05:00
schou 22cd48868a adding feature flag, promql-negative-offset
Signed-off-by: schou <pschou@users.noreply.github.com>
2021-02-23 20:25:56 -05:00
Lucas Hild d35cf369f2
Add expression explorer (Closes #8211) (#8404)
* Add expression explorer

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Add final new line to all files

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Rename expression to metric

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Pass dedicated metrics array to metrics explorer

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix styling of button

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Use append instead of prepend

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Update max width of modal

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix code style

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix inconsistent variable naming

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix modal title

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix tests

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Prevent request from being cached

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Remove timestamp from request

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Update button selector in test

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Refactor passing down metric names and query history

Signed-off-by: Lucas Hild <git@lucas-hild.de>

* Fix code style

Signed-off-by: Lucas Hild <git@lucas-hild.de>
2021-02-19 23:42:20 +01:00
Peter Štibraný a2e5ad6174 Split queryable and appendable arguments in api_v1.NewAPI.
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
2021-02-15 12:30:00 +01:00
Ben Kochie f8779137d0
Update web UI package.json
Update several NPM version pinnings.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-11 15:51:56 +01:00
Ben Kochie 000d7edec9 Remove inline Go vendor dir
Remove the inline Go vendoring per Prometheus 2020 Dev Summit[0].

[0]: https://docs.google.com/document/d/1yuaPKLDvhJNXMF1ubsOOm5kE2_6dvCxHowBQIDs0KdU/edit

Signed-off-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-02-11 11:53:22 +01:00
Julien Pivotto b61d7b3b69
Update javascript dependencies (#8465)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-02-10 18:00:20 +01:00
Mauro Stettler 7715fe3219
Add matchers to LabelValues() call (#8400)
* Accept matchers in querier LabelValues()

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* create matcher to only select metrics which have searched label

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* test case for merge querier with matchers

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* test LabelValues with matchers on head

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* add test for LabelValues on block

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* formatting fix

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Add comments

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* add missing lock release

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* remove unused parameter

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Benchmarks for LabelValues() methods on block/head

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Better comment

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* update comment

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* minor refactor make code cleaner

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* better comments

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* fix expected errors in test

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Deleting parameter which can only be empty

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* fix comments

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* remove unnecessary lock

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* only lookup label value if label name was looked up

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Return error when there is one

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Call .Get() on decoder before checking errors

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* only lock head.symMtx when necessary

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* remove unnecessary delete()

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* re-use code instead of duplicating it

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Consistently return error from LabelValueFor()

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* move helper func from util.go to querier.go

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* Fix test expectation

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

* ensure result de-duplication and sorting works

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

* return named error from LabelValueFor()

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-02-09 23:08:35 +05:30
Ganesh Vernekar 86c71856e8
Add start() and end() pre-processors for @ modifier (#8425)
* Add start() and end() pre-processors for @ modifier

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix reviews

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2021-02-09 21:33:16 +05:30
Dustin Hooten b9f0baf6ff
Combine NewHead() args into a HeadOptions struct (#8452)
* Combine NewHead() args into a HeadOptions struct

Signed-off-by: Dustin Hooten <dustinhooten@gmail.com>

* remove overrides params

Signed-off-by: Dustin Hooten <dustinhooten@gmail.com>

* address pr feedback

Signed-off-by: Dustin Hooten <dustinhooten@gmail.com>
2021-02-09 19:42:48 +05:30
Julien Pivotto f2c5c230f1
Merge pull request #8459 from prometheus/fix-labelname-style-bug
Fix label name leak into class name
2021-02-08 23:56:29 +01:00
Julien Pivotto 860f08532a
Merge pull request #8424 from prometheus/prom/remote-writer-api
[FEATURE] Accept remote_write requests in the Prometheus server
2021-02-08 23:39:34 +01:00
Julius Volz b6544c9048 Fix label name leak into class name
Similar to https://github.com/prometheus/prometheus/pull/7902, this could lead
to style bugs for label names that correspond to styled CSS class names.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-02-08 22:24:49 +01:00
Łukasz Mierzwa 885674c5c0
[UI] Fix duplicated keys on /targets page (#8456)
* [UI] Add a test for duplicated keys in EndpointLink component

I've noticed that I'm getting warnings about multiple children with the same key on /targets page.
This adds a test that fails when that happens.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>

* [UI] Fix duplicated keys on /targets page

Since any URI we render on /targets page can have multi-value params we should use both name and value as components keys.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2021-02-08 22:17:04 +01:00
Tom Wilkie d479151f1f Various enhancements and refactorings for remote write receiver:
- Remove unrelated changes
- Refactor code out of the API module - that is already getting pretty crowded.
- Don't track reference for AddFast in remote write.  This has the potential to consume unlimited server-side memory if a malicious client pushes a different label set for every series.  For now, its easier and safer to always use the 'slow' path.
- Return 400 on out of order samples.
- Use remote.DecodeWriteRequest in the remote write adapters.
- Put this behing the 'remote-write-server' feature flag
- Add some (very) basic docs.
- Used named return & add test for commit error propagation

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2021-02-08 20:41:23 +00:00
fuling 72475b8a0c [ENHANCEMENT] remote storage:Add default api implementation of remote write
Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
2021-02-07 18:12:48 +00:00
Julien Pivotto 06e53b7ecf
API: Fix global URL when external address has no port (#8359)
* API: Fix global URL when external address has no port

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Update test

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Handle IPv6 correctly.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-02-05 12:45:44 +01:00
Julien Pivotto 41247b6950
Merge pull request #8431 from phith0n/missing-ui-on-windows
fix: UI error while compiling on Windows
2021-02-01 22:30:57 +01:00
phith0n 3825f5837e fix #4596
Signed-off-by: phith0n <phith0n.ph2f@gmail.com>
2021-02-02 01:13:48 +08:00
alex-petrov-vt 91eef5e3bf
Added warnings into react Panel on the Graph page (#8427)
Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>
2021-01-31 13:48:32 +01:00
Julien Pivotto ac2626757c Update exporter-toolkit to 0.5.0
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-01-13 21:49:54 +01:00
Nguyen Le Vu Long cd1dafc2fd
tsdb: Expose total number of label pairs in head in TSDB stats page (#8343)
* tsdb: Expose total number of label pairs in head

Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>

* fix: add comment for NumLabelPairs

Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>

* fix: remove comment

Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>
2021-01-07 12:11:32 +05:30
beorn7 2346fd934c Update React dependencies prior to v2.24 release
Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-30 00:15:12 +01:00
Julien Pivotto 5b4f46a348 Add TLS and basic authentication
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-12-28 21:33:44 +01:00
Ben Kochie 5055dfbbe4 Listen on web early in startup
Avoid starting up components like the TSDB if we can't bind
to the web listening port.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-12-28 20:13:05 +01:00
Bartlomiej Plotka 70c69aaa6c
Small cleanup of API code. (#8258)
* Small cleanup of API code.

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

* Fixed typo spotted by Julien.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2020-12-24 00:27:13 +00:00
Julien Pivotto 3e8a96e652
Merge pull request #8294 from prometheus/dependabot/npm_and_yarn/web/ui/react-app/ini-1.3.8
Bump ini from 1.3.5 to 1.3.8 in /web/ui/react-app
2020-12-23 15:12:11 +01:00
Ben Ye caa173d2aa
Support matchers for Labels API (#8301)
Signed-off-by: Ben Ye <yb532204897@gmail.com>
Co-authored-by: Erik Klockare <eklockare@gmail.com>
2020-12-22 11:02:19 +00:00
dependabot[bot] abe85ce052
Bump ini from 1.3.5 to 1.3.8 in /web/ui/react-app
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-15 22:50:00 +00:00
Julien Pivotto 8dc53c2218
Api: Verify that at every matcher in api/v1/series is not empty (#8288)
Fixed #8286

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-12-15 17:24:57 +00:00
Mitsuo Heijo 8b64b70fe4
Guard closing quitCh with sync.Once to prevent double close (#8242)
* Guard closing quitCh with sync.Once to prevent double close

Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2020-12-02 09:39:54 +01:00
Ganesh Vernekar c2ce236de1
Upgrade react deps (#8207)
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2020-11-19 17:10:29 +01:00
gotjosh 4eca4dffb8
Allow metric metadata to be propagated via Remote Write. (#6815)
* Introduce a metadata watcher

Similarly to the WAL watcher, its purpose is to observe the scrape manager and pull metadata. Then, send it to a remote storage.

Signed-off-by: gotjosh <josue@grafana.com>

* Additional fixes after rebasing.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Rework samples/metadata metrics.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Use more descriptive variable names in MetadataWatcher collect.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Fix issues caused during rebasing.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Fix missing metric add and unneeded config code.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Address some review comments.

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Fix metrics and docs

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Replace assert with require

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Bring back max_samples_per_send metric

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix tests

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

Co-authored-by: Callum Styan <callumstyan@gmail.com>
Co-authored-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2020-11-19 20:53:03 +05:30
Marco Pracucci db19e05d93
Add option to customise head chunks write buffer size (#8201)
* Add option to customise head chunks write buffer size

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed tests

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2020-11-19 18:30:47 +05:30
Julien Pivotto f97fba7cc9
React UI: Change "metrics autocomplete" with "autocomplete" (#8174)
- First, it is currently not only removing "metric" autocomplete, but
also "query history autocomplete", so the checkbox is confusing.
- Then, in the future, we will want also "functions" autocomplete.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-12 11:48:48 +01:00
Julien Pivotto cda52234eb
Fix panic with double close() of channel on /-/quit/ (#8166)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-10 00:09:39 +01:00
Julien Pivotto 386e5010b8
Make the brand link in classic UI come back to classic UI home (#8160)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-08 21:54:29 +01:00
Julien Pivotto 8dd0a3e9a3
Fix button display when there is no panels (#8155)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-06 16:34:35 +01:00
Julius Volz 3470ee1fbf
Make React UI the default, keep old UI under /classic (#8142)
The React app's assets are now served under /assets, while all old
custom web assets (including the ones for console templates) are now
served from /classic/static.

I tested different combinations of --web.external-url and
--web.route-prefix with proxies in front, and I couldn't find a problem
yet with the routing. Console templates also still work.

While migrating old endpoints to /classic, I noticed that /version was
being treated like a lot of the old UI pages, with readiness check
handler in front of it, etc. I kept it in /version and removed that
readiness wrapper, since it doesn't seem to be needed for that endpoint.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-11-03 14:51:48 +01:00
Jarod Watkins 388a2d20c9
UI: Add toggle to enable/disable metric autocomplete (#8134)
* UI: Add toggle to enable/disable metric autocomplete

This change adds a toggle to enable or disable the metric autocomplete
functionality. By default it is enabled. This is a port of a change I
did in [Thanos][1].

[1]: https://github.com/thanos-io/thanos/pull/3381

Signed-off-by: Jarod Watkins <jarod@42lines.net>

* Adding full variable name

Signed-off-by: Jarod Watkins <jarod@42lines.net>
2020-11-02 16:16:54 +01:00
Julien Pivotto 7558e9d3c3
API: Make snapshot length always the same size (#8138)
Fixes #8135

Minor improvement, also we now use Int64 even on 32 bit systems.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-01 21:07:38 +01:00
Julien Pivotto 6c56a1faaa
Testify: move to require (#8122)
* Testify: move to require

Moving testify to require to fail tests early in case of errors.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* More moves

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-29 09:43:23 +00:00
Julien Pivotto 1282d1b39c
Refactor test assertions (#8110)
* Refactor test assertions

This pull request gets rid of assert.True where possible to use
fine-grained assertions.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-27 11:06:53 +01:00
James Ranson 1cffda5de7
react updates for pathPrefix (#7979)
* dynamically determine path prefix

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* minor changes per PR review

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* use Context for apiPath and pathPrefix

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* remove unhandled "/version" path

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* only process index once instead of on every req

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* remove unneeded tag fragment

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* switch api path to const

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* revert

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* update tests

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* linter updates

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* simplify

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>

* updates per peer review

Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
2020-10-22 17:22:32 +02:00
Julien Pivotto 4e5b1722b3
Move away from testutil, refactor imports (#8087)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-22 11:00:08 +02:00