Commit graph

1149 commits

Author SHA1 Message Date
Julius Volz 447d9401fc
Merge pull request #9239 from LeviHarrison/promql-trig-functions
PromQL: Add trigonometric functions
2021-09-16 14:11:40 +02:00
Levi Harrison 2c7bec758d Tabs to spaces
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 23:02:26 -04:00
Levi Harrison ed220c1ae7 Add grammar
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 23:02:25 -04:00
Augustin Husson e52204e556 fix eslint warning for codemirror-promql
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-15 13:38:48 +02:00
Julius Volz d2c0eac37f Fix linter errors in codemirror-promql module
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-09-15 11:48:21 +02:00
Augustin Husson 1b740aeb6e Merge branch 'main' into feature/use-npm-workspace
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-14 19:27:44 +02:00
Augustin Husson af7aab7937 add global mock for the matchMedia function
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-14 15:49:46 +02:00
Augustin Husson 05b9a11a62 remove jest.restoreAllMock() call
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-14 15:49:46 +02:00
Augustin Husson c3306e6366 set canvas mock
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-14 15:49:46 +02:00
Julius Volz 5498ca5214 Update React 16->17, TypeScript, and some other node deps
This updates React, TypeScript, and some other node packages (but not
everything).

A couple of notes:

- `enzyme-adapter-react-16` does not have a React 17 equivalent yet, so I
  switched to the fork `@wojtekmaj/enzyme-adapter-react-17`
- A bunch of tests are still failing because I think in the enzyme testing
  environment, a browser API (`ResizeObserver`) is missing, and maybe for other
  reasons. This needs to be explored + fixed.
- The TypeScript update introduced more stringent rules, which required fixing
  up a bunch of pieces of code a bit.
- The `use-media` package doesn't work with React 17 yet, so I just built our
  own minimal `useMedia` hook instead (just a couple of lines).
- I commented out part of the code in `withStartingIndicator.tsx` because it
  fails the now-stricter lint checks. It needs to be fixed (and not commented
  out).

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-09-14 15:46:59 +02:00
Augustin Husson 22fa0aa408
remove app package in codemirror-module (#9322)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-14 12:33:10 +02:00
George Robinson 049b4f4f13
Support customization of template options in TemplateExpander (#9290)
Signed-off-by: George Robinson <george.robinson@grafana.com>
2021-09-13 17:19:08 +05:30
Augustin Husson 19f5f44bf9 remove craco, no need for it
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-11 12:10:05 +02:00
Victor Häggqvist 9aaea327a0 use same top and bottom margin for alert filename
Signed-off-by: Victor Häggqvist <victor@snilius.com>
2021-09-10 21:21:22 +02:00
Augustin Husson 27aec91914 review the UI ci and associated command
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-10 17:18:25 +02:00
Augustin Husson 5c42b04af7 move to npm workspace
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-10 15:38:20 +02:00
Augustin Husson fa56d1e43b Merge branch 'feature/cleanup-codemirror' into feature/use-npm-workspace 2021-09-09 17:55:50 +02:00
Augustin Husson 29b788a7b5 remove app package in codemirror-module
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-09 17:52:03 +02:00
Victor Häggqvist 02cedb837d use consistent margin-bottom for all alert kinds
Signed-off-by: Victor Häggqvist <victor@snilius.com>
2021-09-08 21:28:49 +02:00
Augustin Husson c83137e757 Merge branch 'main' into update-react-and-ts
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-08 17:28:46 +02:00
Augustin Husson e1d8891a73 add global mock for the matchMedia function
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-08 17:26:24 +02:00
Augustin Husson 2cfdaf915f remove jest.restoreAllMock() call
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-08 17:13:44 +02:00
Ganesh Vernekar 1a5b21b78b
Update dependencies for v2.30.0 (#9308)
* Update Go dependencies

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Update React dependencies

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-09-07 20:17:21 +05:30
Augustin Husson b67c49a9ff Merge branch 'main' into update-react-and-ts
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-07 16:39:54 +02:00
Augustin Husson e785a0a31f set canvas mock
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-07 16:34:41 +02:00
Augustin Husson c827413755 Merge branch 'main' into update-react-and-ts
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-07 11:51:39 +02:00
SuperQ 6281d26002
Update various react-app dependencies
Update several dependencies to cleanup `npm outdated`.

Signed-off-by: SuperQ <superq@gmail.com>
2021-09-07 11:34:37 +02:00
Augustin Husson 405198f430 upgrade react-app to typescript 4
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-07 10:51:59 +02:00
Augustin Husson 5bcf2e6511 upgrade react-script to v4
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-04 15:56:36 +02:00
Augustin Husson 8fe97cc614 rely on react-scripts for most of the dev-deps
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-03 15:01:32 +02:00
Augustin Husson 4f67eb3979 fix EndpointLink test
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-02 15:31:33 +02:00
Augustin Husson 242d459685 fix 'window.ResizeObserver is not a constructor' issue
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-02 14:46:46 +02:00
Augustin Husson 5d29b7b6f7 specify the type returned for most of the function that is missing it
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-02 11:12:25 +02:00
Augustin Husson 27bd8fef40 fix condition in withStartingIndicator
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-02 10:29:20 +02:00
Julius Volz ff2d297b0a Update React 16->17, TypeScript, and some other node deps
This updates React, TypeScript, and some other node packages (but not
everything).

A couple of notes:

- `enzyme-adapter-react-16` does not have a React 17 equivalent yet, so I
  switched to the fork `@wojtekmaj/enzyme-adapter-react-17`
- A bunch of tests are still failing because I think in the enzyme testing
  environment, a browser API (`ResizeObserver`) is missing, and maybe for other
  reasons. This needs to be explored + fixed.
- The TypeScript update introduced more stringent rules, which required fixing
  up a bunch of pieces of code a bit.
- The `use-media` package doesn't work with React 17 yet, so I just built our
  own minimal `useMedia` hook instead (just a couple of lines).
- I commented out part of the code in `withStartingIndicator.tsx` because it
  fails the now-stricter lint checks. It needs to be fixed (and not commented
  out).

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-09-01 16:03:09 +02:00
Levi Harrison 70f597b033
Configure Scrape Interval and Timeout Via Relabeling (#8911)
* Configure scrape interval and timeout with labels

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-31 17:37:32 +02:00
Julius Volz dff78eb508
Switch from Reach Router to React Router (#9273)
We want to upgrade to React 17, but Reach Router does not work with React 17:
https://github.com/reach/router/issues/429

Also, the Reach + React Router projects announced an intention to join forces
and just continue as React Router:
https://reacttraining.com/blog/reach-react-router-future/

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-08-30 14:05:49 +02:00
Augustin Husson a2665a9f73
add lezer-promql module (#9229)
* add lezer-promql module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* integrate lezer-promql in codemirror-promql

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-29 15:16:25 +02:00
SuperQ e167a45c65
Add new Go build tags.
Add new go:build comments based on 1.17 formatting[0].

[0]: https://golang.org/doc/go1.17#gofmt

Signed-off-by: SuperQ <superq@gmail.com>
2021-08-27 10:24:14 +02:00
Augustin Husson 54dfee02b2
move codemirror-promql as a prometheus web module (#9188)
* move codemirror-promql as a prometheus web module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove unecessary file for the codemirror module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* change license for Apache

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix codemirror build

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-20 11:39:07 +02:00
Dorian JAMINAIS 05dba96ebf
Add option for the number of ticks in PromConsole.Graph (#9223)
Signed-off-by: Dorian Jaminais-Grellier <dorian@jaminais.fr>
2021-08-20 08:24:31 +02:00
Julius Volz bb05485c79
Fix JS/CSS asset paths for classic /config page (#9202)
Fixes https://github.com/prometheus/prometheus/issues/9130

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-08-13 18:10:31 +02:00
Augustin Husson 7291563d4d
replace yarn by npm (#9198)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-12 20:25:26 +02:00
Julien Pivotto cab96a06ef
Merge release 2.29 in main (#9196)
* PromQL: Fix start and end keywords masking label and metric names

This commit fixes an issue with the "at modifier" that introduced two
new keywords: `start` and `end`. In grouping options and in metric
names, these keywords took precedence over metric or label names, so
that those metrics and labels could no longer be referenced.

Signed-off-by: Clayton Peters <clayton.peters@man.com>

* Add in additional tests for metrics and/or labels called start/end.

Signed-off-by: Clayton Peters <clayton.peters@man.com>

* *: Cut 2.29.0-rc.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* VERSION: bump to 2.29.0-rc.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Remove experimental wording on size-based retention

Followup of #9004

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

* Fix PR reference in changelog

Signed-off-by: George Brighton <george@gebn.co.uk>

* Describe EC2 availability zone IDs at most once per refresh (#9142)

Signed-off-by: George Brighton <george@gebn.co.uk>

* Describe EC2 availability zones at most once per SD load

Closes #9142.

Signed-off-by: George Brighton <george@gebn.co.uk>

* Incorporate feedback

Signed-off-by: George Brighton <george@gebn.co.uk>

* Integrate feedback

Signed-off-by: George Brighton <george@gebn.co.uk>

* Add a compatibility note for macOS users.

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

* *: Cut v2.29.0-rc.1

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Fix `kuma_sd` targetgroup reporting (#9157)

* Bundle all xDS targets into a single group

Signed-off-by: austin ce <austin.cawley@gmail.com>

* *: cut v2.29.0-rc.2

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Rename links

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* bump codemirror-promql to 0.17.0

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* *: cut v2.29.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* tsdb: align atomically accessed int64 (#9192)

This prevents a panic in 32-bit archs:
https://pkg.go.dev/sync/atomic#pkg-note-BUG

Fixed #9190

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

* Release 2.29.1 (#9193)

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

Co-authored-by: Clayton Peters <clayton.peters@man.com>
Co-authored-by: Frederic Branczyk <fbranczyk@gmail.com>
Co-authored-by: George Brighton <george@gebn.co.uk>
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com>
Co-authored-by: Levi Harrison <git@leviharrison.dev>
Co-authored-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-12 18:38:06 +02:00
Julius Volz b7e9f2481b
Remove search keymap from new expression editor (#9184)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-08-10 17:10:41 +02:00
Frederic Branczyk fd8e8218a7
Update UI dependencies
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2021-07-29 09:11:14 +02:00
Oleg Zaytsev b1ed4a0a66
LabelNames API with matchers (#9083)
* Push the matchers for LabelNames all the way into the index.

NB This doesn't actually implement it in the index, just plumbs it through for now...

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

* Hack it up.  Does not work.

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

* Revert changes I don't understand

Can't see why do we need to hold a mutex on symbols, and the purpose of
the LabelNamesFor method.

Maybe I'll need to re-add this later.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Implement LabelNamesFor

This method provides the label names that appear in the postings
provided. We do that deeper than the label values because we know
beforehand that most of the label names we'll be the same across
different postings, and we don't want to go down an up looking up the
same symbols for all different series.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Mutex on symbols should be unlocked

However, I still don't understand why do we need a mutex here.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Fix head.LabelNamesFor

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Implement mockIndex LabelNames with matchers

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Nitpick on slice initialisation

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Add tests for LabelNamesWithMatchers

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Fix the mutex mess on head.LabelValues/LabelNames

I still don't see why we need to grab that unrelated mutex, but at least
now we're grabbing it consistently

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Check error after iterating postings

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Use the error from posting when there was en error in postings

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Update storage/interface.go comment

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

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

* Update tsdb/index/index.go comment

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

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

* Update tsdb/index/index.go wrapped error msg

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

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

* Update tsdb/index/index.go wrapped error msg

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

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

* Update tsdb/index/index.go warpped error msg

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

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

* Remove unneeded comment

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Add testcases for LabelNames w/matchers in api.go

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Use t.Cleanup() instead of defer in tests

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

Co-authored-by: Tom Wilkie <tom@grafana.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-07-20 18:08:08 +05:30
Augustin Husson f72cabb437
Add sorting and filtering to flags page (v2) (#8988)
* Add sorting and filtering to flags page

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

* Make filter understand

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

* split big state object into smaller ones

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

* use fuzzy match and sanitize html for search results

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

* use fuzzy.filter

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

* replace fuzzy lib by @nexucis/fuzzy + fix flags issues

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* replace fuzzy by @nexucis/fuzzy in ExpressionInput.tsx

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove fuzzy lib from package.json

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix flags test

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* simplify the input in the fuzzy search

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* cleanup html to be easily compatible with the dark theme

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix filtering when there is no result

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* use id to fix the test

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

Co-authored-by: Dustin Hooten <dustinhooten@gmail.com>
2021-07-01 21:15:06 +02:00
Levi Harrison 167dfa19af
React UI: Select time range with mouse drag (#8977)
* Added selection flot plugin

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Added time selection

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Added tests

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Removed irrelevant line in license header

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-30 10:40:43 +02:00
Julius Volz 664b391573
Speed up alerts page by not rendering collapsed details (#9005)
All this is doing is wrapping the inner alert details display with a
conditional `{open && ...}`.

This already improves https://github.com/prometheus/prometheus/issues/8548 a
lot for cases where there are many individual firing/pending alert elements
under each alerting rule.

E.g. for a list of 200 rules with ~100 alert elements each, this changed the page
render time from 30 seconds to 1s.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-06-28 16:14:48 +02:00