Commit graph

1057 commits

Author SHA1 Message Date
Brian Brazil 540dc7dfb0
Merge pull request #6651 from prometheus/sort-block
Don't sort postings if we only have one block.
2020-01-28 14:52:07 +00:00
Boyko 41071278b6 Change old UI link to React App to point to graph page (#6697)
* change the link to React App to point to graph page

Signed-off-by: blalov <boiskila@gmail.com>

* add search params to classic UI link

Signed-off-by: blalov <boiskila@gmail.com>

* lint fix

Signed-off-by: blalov <boiskila@gmail.com>

* remove navLink onclick

Signed-off-by: blalov <boiskila@gmail.com>

* remove left-over

Signed-off-by: blalov <boiskila@gmail.com>

* remove pkg files

Signed-off-by: blalov <boiskila@gmail.com>

* delete .vscode

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
2020-01-28 14:04:56 +01:00
Brian Brazil 38d32e0686 Don't sort postings if we only have one block.
Sorting the heads postings can be quite slow.
We only need sorted series when merging with another
querier, so only sort then.
This will make big queries that only touch the head faster,
though queries that touch both the head and a block will still
be the same speed. This probably won't help much with graphing
unless the range is under an hour, however it should make most
recording rules faster.

Add gaurantee that remote read streaming produces sorted series.

PromQL benchmarks for histograms show only 2-3% improvement, but
they're only over 1k series.

benchmark                                                old ns/op      new ns/op      delta
BenchmarkQuerierSelect/Head/1of1000000-4                 1375486282     507657736      -63.09%
BenchmarkQuerierSelect/Head/10of1000000-4                1387859004     507769850      -63.41%
BenchmarkQuerierSelect/Head/100of1000000-4               1387087935     506029110      -63.52%
BenchmarkQuerierSelect/Head/1000of1000000-4              1386869064     504521986      -63.62%
BenchmarkQuerierSelect/Head/10000of1000000-4             1386213685     505210422      -63.55%
BenchmarkQuerierSelect/Head/100000of1000000-4            1392754988     529842406      -61.96%
BenchmarkQuerierSelect/Head/1000000of1000000-4           1569414722     725059506      -53.80%
BenchmarkQuerierSelect/SortedHead/1of1000000-4           1381019902     1370495863     -0.76%
BenchmarkQuerierSelect/SortedHead/10of1000000-4          1375696209     1366789468     -0.65%
BenchmarkQuerierSelect/SortedHead/100of1000000-4         1386009422     1364519297     -1.55%
BenchmarkQuerierSelect/SortedHead/1000of1000000-4        1377700532     1364486191     -0.96%
BenchmarkQuerierSelect/SortedHead/10000of1000000-4       1383539536     1369545314     -1.01%
BenchmarkQuerierSelect/SortedHead/100000of1000000-4      1410089163     1394731339     -1.09%
BenchmarkQuerierSelect/SortedHead/1000000of1000000-4     1634744148     1581554956     -3.25%
BenchmarkQuerierSelect/Block/1of1000000-4                881741242      879839470      -0.22%
BenchmarkQuerierSelect/Block/10of1000000-4               880381562      882846038      +0.28%
BenchmarkQuerierSelect/Block/100of1000000-4              887519357      881016916      -0.73%
BenchmarkQuerierSelect/Block/1000of1000000-4             902194205      883433524      -2.08%
BenchmarkQuerierSelect/Block/10000of1000000-4            892321964      885130170      -0.81%
BenchmarkQuerierSelect/Block/100000of1000000-4           938604466      933527150      -0.54%
BenchmarkQuerierSelect/Block/1000000of1000000-4          1313510845     1295881124     -1.34%

benchmark                                                old allocs     new allocs     delta
BenchmarkQuerierSelect/Head/1of1000000-4                 4000056        4000018        -0.00%
BenchmarkQuerierSelect/Head/10of1000000-4                4000074        4000036        -0.00%
BenchmarkQuerierSelect/Head/100of1000000-4               4000254        4000216        -0.00%
BenchmarkQuerierSelect/Head/1000of1000000-4              4002054        4002016        -0.00%
BenchmarkQuerierSelect/Head/10000of1000000-4             4020054        4020016        -0.00%
BenchmarkQuerierSelect/Head/100000of1000000-4            4200054        4200016        -0.00%
BenchmarkQuerierSelect/Head/1000000of1000000-4           6000054        6000016        -0.00%
BenchmarkQuerierSelect/SortedHead/1of1000000-4           4000071        4000071        +0.00%
BenchmarkQuerierSelect/SortedHead/10of1000000-4          4000089        4000089        +0.00%
BenchmarkQuerierSelect/SortedHead/100of1000000-4         4000269        4000269        +0.00%
BenchmarkQuerierSelect/SortedHead/1000of1000000-4        4002069        4002069        +0.00%
BenchmarkQuerierSelect/SortedHead/10000of1000000-4       4020069        4020069        +0.00%
BenchmarkQuerierSelect/SortedHead/100000of1000000-4      4200069        4200069        +0.00%
BenchmarkQuerierSelect/SortedHead/1000000of1000000-4     6000069        6000069        +0.00%
BenchmarkQuerierSelect/Block/1of1000000-4                6000023        6000022        -0.00%
BenchmarkQuerierSelect/Block/10of1000000-4               6000059        6000058        -0.00%
BenchmarkQuerierSelect/Block/100of1000000-4              6000419        6000418        -0.00%
BenchmarkQuerierSelect/Block/1000of1000000-4             6004019        6004018        -0.00%
BenchmarkQuerierSelect/Block/10000of1000000-4            6040019        6040018        -0.00%
BenchmarkQuerierSelect/Block/100000of1000000-4           6400019        6400018        -0.00%
BenchmarkQuerierSelect/Block/1000000of1000000-4          10000020       10000019       -0.00%

benchmark                                                old bytes     new bytes     delta
BenchmarkQuerierSelect/Head/1of1000000-4                 229192200     176001176     -23.21%
BenchmarkQuerierSelect/Head/10of1000000-4                229193352     176002328     -23.21%
BenchmarkQuerierSelect/Head/100of1000000-4               229204872     176013848     -23.21%
BenchmarkQuerierSelect/Head/1000of1000000-4              229320072     176129048     -23.20%
BenchmarkQuerierSelect/Head/10000of1000000-4             230472072     177281048     -23.08%
BenchmarkQuerierSelect/Head/100000of1000000-4            241992072     188801048     -21.98%
BenchmarkQuerierSelect/Head/1000000of1000000-4           357192072     304001048     -14.89%
BenchmarkQuerierSelect/SortedHead/1of1000000-4           229193928     229193928     +0.00%
BenchmarkQuerierSelect/SortedHead/10of1000000-4          229195080     229195080     +0.00%
BenchmarkQuerierSelect/SortedHead/100of1000000-4         229206600     229206600     +0.00%
BenchmarkQuerierSelect/SortedHead/1000of1000000-4        229321800     229321800     +0.00%
BenchmarkQuerierSelect/SortedHead/10000of1000000-4       230473800     230473800     +0.00%
BenchmarkQuerierSelect/SortedHead/100000of1000000-4      241993800     241993800     +0.00%
BenchmarkQuerierSelect/SortedHead/1000000of1000000-4     357193800     357193800     +0.00%
BenchmarkQuerierSelect/Block/1of1000000-4                227201516     227201500     -0.00%
BenchmarkQuerierSelect/Block/10of1000000-4               227202924     227202908     -0.00%
BenchmarkQuerierSelect/Block/100of1000000-4              227217036     227217020     -0.00%
BenchmarkQuerierSelect/Block/1000of1000000-4             227358156     227358140     -0.00%
BenchmarkQuerierSelect/Block/10000of1000000-4            228769356     228769340     -0.00%
BenchmarkQuerierSelect/Block/100000of1000000-4           242881356     242881340     -0.00%
BenchmarkQuerierSelect/Block/1000000of1000000-4          384001616     384001600     -0.00%

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2020-01-28 09:14:56 +00:00
Harkishen Singh c1e49d50c5 Adds support for rules screen in react-ui (#6503)
* base

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* base of rules page

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* initial version

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* removed unused function

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* version 1

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions.

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* new fetching pattern

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2020-01-27 10:27:43 +01:00
Julius Volz d996ba20ec
React UI: Support local timezone on /graph (#6692)
* React UI: Support local timezone on /graph

This partially implements
https://github.com/prometheus/prometheus/issues/500 in the sense that it
only addresses the /graph page, and only allows toggling between UTC and
local (browser) time, but no arbitrary timezone selection yet.

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

* Fixup: Also display TZ offset in tooltip

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

* Just show offset, not timezone name abbreviation

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-01-24 23:44:18 +01:00
Julius Volz a677622184
React UI: Send cookies on fetch() on older browsers (#6553)
* React UI: Send cookies on fetch() on older browsers

Fixes https://github.com/prometheus/prometheus/issues/6428

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

* Fix fetch() tests to expect new options

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-01-20 16:50:32 +01:00
Julien Pivotto 29086533fd web: use chained WithInstrumentation (#6661)
* web: use chained WithInstrumentation

Requires an update of github.com/prometheus/common
* Update yaml.v2

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-01-19 00:07:10 +00:00
Boyko 0f84d5b2cf React UI: broken graph page browser history (#6659)
* add panel state for the expression input

Signed-off-by: blalov <boiskila@gmail.com>

* remove redundant test

Signed-off-by: blalov <boiskila@gmail.com>
2020-01-18 23:40:25 +01:00
Boyko c8469ecaf5 React UI: hide non selected alert types (#6642)
* hide non selected alert types

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* revert 'show annotations' checkbox to be always visible

Signed-off-by: blalov <boiskila@gmail.com>
2020-01-16 22:22:47 +01:00
Tobias Guggenmos 3a204be6b7 PromQL: Fix string and parentheses handling in engine (#6612)
* WIP: PromQL: Allow engine to return strings

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>

* Add test suggested by @roidelapluie

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>

* Fix typo in React UI

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>

* Fix parenthesis handling for functions and aggregator params

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>

* Add more tests

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>

* Fix React UI test

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2020-01-15 18:31:58 +01:00
Boyko bab47b58f5 ReactUI: folder re-organization (#6601)
* remove redundant sanitizeHTML abstraction

Signed-off-by: blalov <boiskila@gmail.com>

* organize folders

Signed-off-by: blalov <boiskila@gmail.com>

* move hooks outside common folder

Signed-off-by: blalov <boiskila@gmail.com>

* move PathPrefix interface in types

Signed-off-by: blalov <boiskila@gmail.com>

* remove config folder

Signed-off-by: blalov <boiskila@gmail.com>

* remove redundant snapshots

Signed-off-by: blalov <boiskila@gmail.com>

* rename common folder

Signed-off-by: blalov <boiskila@gmail.com>

* merge utils files

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* sync with master

Signed-off-by: blalov <boiskila@gmail.com>
2020-01-14 19:34:48 +01:00
Boyko e12e5ecc8f ReactUI: adopt grafana flot fix for stacked graphs (#6603)
* adopt grafana flot fix for stacked graphs

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* remove flot as dependencie

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* disable eslint error in flot.js

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* fix broken test due to wrong import

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* bring back flot crosshair plugin

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* trying to prevent CI out of memory by adding test script --runInBand flag

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* additional notices regarding origin of the flot vendor

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* move flot in own folder

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* move text on top

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
2020-01-14 16:12:08 +01:00
Julien Pivotto e7f7b6a06f Query Log: Add source IP from console queries (#6593)
* Query Log: Add source IP from console queries

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-01-10 12:56:36 +00:00
Daniel Swarbrick 097fda1440 Match closing tag to opening button tag (#6587)
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@cloud.ionos.com>
2020-01-09 10:58:27 +00:00
Julien Pivotto 9d9bc524e5 Add query log (#6520)
* Add query log, make stats logged in JSON like in the API

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-01-08 13:28:43 +00:00
Tobias Guggenmos 3d6cf1c289 PromQL: Make parser completely generated (#6548)
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2020-01-08 11:04:47 +00:00
Boyko 1637ad2717 ReactUI: replace togglers tabs with checkboxes (#6543)
* replace togglers tabs with checkboxes

Signed-off-by: blalov <boiskila@gmail.com>

* create state-color tuples config for checkboxes rendering

Signed-off-by: blalov <boiskila@gmail.com>

* separate filters from show-annotations checkbox

Signed-off-by: blalov <boiskila@gmail.com>

* style improvements

Signed-off-by: blalov <boiskila@gmail.com>

* lint fix

Signed-off-by: blalov <boiskila@gmail.com>

* style adjustments

Signed-off-by: blalov <boiskila@gmail.com>
2020-01-07 16:12:38 +01:00
Josh Soref 91d76c8023 Spelling (#6517)
* spelling: alertmanager

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attributes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: autocomplete

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bootstrap

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: caught

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: chunkenc

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compaction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: corrupted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deletable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fine-grained

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: number

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overlapping

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: possible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: postings

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: procedure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: programmatic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: queuing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: querier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repairing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: received

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reproducible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retention

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sample

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: segements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: semantic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: software [LICENSE]

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: staging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: timestamp

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unfortunately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uvarint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subsequently

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ressamples

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-01-02 15:54:09 +01:00
Harkishen Singh edf8f135bc Adds support service discovery page in react ui (#6394)
* active targets component completed

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* support for service-discovery in react ui

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* restored prev files

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* used fc

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* removed trivial keys

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* FC based labels

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implmented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* minor word change

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* before dropped addressed

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* linted

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions. removed false styles

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions. Unified buttons with targets screen.

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* component for ToggleButton

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* removed false Button

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* implemented suggestions.

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* tests for ToggleMoreLess component

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* linted

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* fixed nested h3. implemented suggestions

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>

* linted

Signed-off-by: Harkishen Singh <harkishensingh@hotmail.com>
2019-12-31 18:41:50 +01:00
Brian Brazil 767fa704b6 Load only some offsets into the symbol table into memory.
Rather than keeping the entire symbol table in memory, keep every nth
offset and walk from there to the entry we need. This ends up slightly
slower, ~360ms per 1M series returned from PostingsForMatchers which is
not much considering the rest of the CPU such a query would go on to
use.

Make LabelValues use the postings tables, rather than having
to do symbol lookups. Use yoloString, as PostingsForMatchers
doesn't need the strings to stick around and adjust the API
call to keep the Querier open until it's all marshalled.

Remove allocatedSymbols memory optimisation, we no longer keep all the
symbol strings in heap memory. Remove LabelValuesFor and LabelIndices,
they're dead code. Ensure we've still tests for label indices,
and add missing test that we can work with old V1 Format index files.

PostingForMatchers performance is slightly better, with a big drop in
allocation counts due to using yoloString for LabelValues:

benchmark                                                               old ns/op     new ns/op     delta
BenchmarkPostingsForMatchers/Block/n="1"-4                              36698         36681         -0.05%
BenchmarkPostingsForMatchers/Block/n="1",j="foo"-4                      522786        560887        +7.29%
BenchmarkPostingsForMatchers/Block/j="foo",n="1"-4                      511652        537680        +5.09%
BenchmarkPostingsForMatchers/Block/n="1",j!="foo"-4                     522102        564239        +8.07%
BenchmarkPostingsForMatchers/Block/i=~".*"-4                            113689911     111795919     -1.67%
BenchmarkPostingsForMatchers/Block/i=~".+"-4                            135825572     132871085     -2.18%
BenchmarkPostingsForMatchers/Block/i=~""-4                              40782628      38038181      -6.73%
BenchmarkPostingsForMatchers/Block/i!=""-4                              31267869      29194327      -6.63%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",j="foo"-4              112733329     111568823     -1.03%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",i!="2",j="foo"-4       112868153     111232029     -1.45%
BenchmarkPostingsForMatchers/Block/n="1",i!=""-4                        31338257      29349446      -6.35%
BenchmarkPostingsForMatchers/Block/n="1",i!="",j="foo"-4                32054482      29972436      -6.50%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",j="foo"-4              136504654     133968442     -1.86%
BenchmarkPostingsForMatchers/Block/n="1",i=~"1.+",j="foo"-4             27960350      27264997      -2.49%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!="2",j="foo"-4       136765564     133860724     -2.12%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!~"2.*",j="foo"-4     163714583     159453668     -2.60%

benchmark                                                               old allocs     new allocs     delta
BenchmarkPostingsForMatchers/Block/n="1"-4                              6              6              +0.00%
BenchmarkPostingsForMatchers/Block/n="1",j="foo"-4                      11             11             +0.00%
BenchmarkPostingsForMatchers/Block/j="foo",n="1"-4                      11             11             +0.00%
BenchmarkPostingsForMatchers/Block/n="1",j!="foo"-4                     17             15             -11.76%
BenchmarkPostingsForMatchers/Block/i=~".*"-4                            100012         12             -99.99%
BenchmarkPostingsForMatchers/Block/i=~".+"-4                            200040         100040         -49.99%
BenchmarkPostingsForMatchers/Block/i=~""-4                              200045         100045         -49.99%
BenchmarkPostingsForMatchers/Block/i!=""-4                              200041         100041         -49.99%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",j="foo"-4              100017         17             -99.98%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",i!="2",j="foo"-4       100023         23             -99.98%
BenchmarkPostingsForMatchers/Block/n="1",i!=""-4                        200046         100046         -49.99%
BenchmarkPostingsForMatchers/Block/n="1",i!="",j="foo"-4                200050         100050         -49.99%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",j="foo"-4              200049         100049         -49.99%
BenchmarkPostingsForMatchers/Block/n="1",i=~"1.+",j="foo"-4             111150         11150          -89.97%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!="2",j="foo"-4       200055         100055         -49.99%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!~"2.*",j="foo"-4     311238         111238         -64.26%

benchmark                                                               old bytes     new bytes     delta
BenchmarkPostingsForMatchers/Block/n="1"-4                              296           296           +0.00%
BenchmarkPostingsForMatchers/Block/n="1",j="foo"-4                      424           424           +0.00%
BenchmarkPostingsForMatchers/Block/j="foo",n="1"-4                      424           424           +0.00%
BenchmarkPostingsForMatchers/Block/n="1",j!="foo"-4                     552           1544          +179.71%
BenchmarkPostingsForMatchers/Block/i=~".*"-4                            1600482       1606125       +0.35%
BenchmarkPostingsForMatchers/Block/i=~".+"-4                            17259065      17264709      +0.03%
BenchmarkPostingsForMatchers/Block/i=~""-4                              17259150      17264780      +0.03%
BenchmarkPostingsForMatchers/Block/i!=""-4                              17259048      17264680      +0.03%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",j="foo"-4              1600610       1606242       +0.35%
BenchmarkPostingsForMatchers/Block/n="1",i=~".*",i!="2",j="foo"-4       1600813       1606434       +0.35%
BenchmarkPostingsForMatchers/Block/n="1",i!=""-4                        17259176      17264808      +0.03%
BenchmarkPostingsForMatchers/Block/n="1",i!="",j="foo"-4                17259304      17264936      +0.03%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",j="foo"-4              17259333      17264965      +0.03%
BenchmarkPostingsForMatchers/Block/n="1",i=~"1.+",j="foo"-4             3142628       3148262       +0.18%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!="2",j="foo"-4       17259509      17265141      +0.03%
BenchmarkPostingsForMatchers/Block/n="1",i=~".+",i!~"2.*",j="foo"-4     20405680      20416944      +0.06%

However overall Select performance is down and involves more allocs, due to
having to do more than a simple map lookup to resolve a symbol and that all the strings
returned are allocated:

benchmark                                           old ns/op     new ns/op      delta
BenchmarkQuerierSelect/Block/1of1000000-4           506092636     862678244      +70.46%
BenchmarkQuerierSelect/Block/10of1000000-4          505638968     860917636      +70.26%
BenchmarkQuerierSelect/Block/100of1000000-4         505229450     882150048      +74.60%
BenchmarkQuerierSelect/Block/1000of1000000-4        515905414     862241115      +67.13%
BenchmarkQuerierSelect/Block/10000of1000000-4       516785354     874841110      +69.29%
BenchmarkQuerierSelect/Block/100000of1000000-4      540742808     907030187      +67.74%
BenchmarkQuerierSelect/Block/1000000of1000000-4     815224288     1181236903     +44.90%

benchmark                                           old allocs     new allocs     delta
BenchmarkQuerierSelect/Block/1of1000000-4           4000020        6000020        +50.00%
BenchmarkQuerierSelect/Block/10of1000000-4          4000038        6000038        +50.00%
BenchmarkQuerierSelect/Block/100of1000000-4         4000218        6000218        +50.00%
BenchmarkQuerierSelect/Block/1000of1000000-4        4002018        6002018        +49.97%
BenchmarkQuerierSelect/Block/10000of1000000-4       4020018        6020018        +49.75%
BenchmarkQuerierSelect/Block/100000of1000000-4      4200018        6200018        +47.62%
BenchmarkQuerierSelect/Block/1000000of1000000-4     6000018        8000019        +33.33%

benchmark                                           old bytes     new bytes     delta
BenchmarkQuerierSelect/Block/1of1000000-4           176001468     227201476     +29.09%
BenchmarkQuerierSelect/Block/10of1000000-4          176002620     227202628     +29.09%
BenchmarkQuerierSelect/Block/100of1000000-4         176014140     227214148     +29.09%
BenchmarkQuerierSelect/Block/1000of1000000-4        176129340     227329348     +29.07%
BenchmarkQuerierSelect/Block/10000of1000000-4       177281340     228481348     +28.88%
BenchmarkQuerierSelect/Block/100000of1000000-4      188801340     240001348     +27.12%
BenchmarkQuerierSelect/Block/1000000of1000000-4     304001340     355201616     +16.84%

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-12-17 18:56:58 +00:00
Boyko b90b5736b9 Allow sec timestamp (#6460)
* adding seconds timestamp to time input

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* calc time range properly

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* fix test

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* unify table and graph time inputs

Signed-off-by: blalov <boiskila@gmail.com>

* rename calcTimeRange func

Signed-off-by: blalov <boiskila@gmail.com>
2019-12-17 10:50:58 +01:00
Dustin Hooten fce2e131db React UI: Fix issue when changing query then time, the old query executed (#6437)
* React UI: Fix issue when changing query then time, the old query is executed

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* pr feedback

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* more pr feedback

Signed-off-by: Dustin Hooten <dhooten@splunk.com>
2019-12-12 23:22:12 +01:00
gotjosh e1f2da74a3 api: provide metadata for a single metric
This adds support for a new query param on the new `api/v1/metadata`
endpoint that provides metadata for a specified metric via the V1 API.

It collapses metadata that is equal across all targets, and aggregates
under the same metric name the ones that differ.

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-10 21:17:49 +00:00
gotjosh 4a13c844b7 Add periods to comments on tests.
Signed-off-by: gotjosh <josue@grafana.com>
2019-12-10 18:11:15 +00:00
gotjosh 0a0a228db3 api: provide per metric metadata (#6420)
* api: provide per metric metadata

This adds a new endpoint that provides per metric metadata via the V1 API.

It collapses metadata that is equal across all targets, and aggregates under the same metric name the ones that differ.

* Allow tests to be asserted on response length

Some tests e.g. limit on API responses, don't require an assertion on
equality.

This allows us to assert against response length instead of
equality.

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-10 14:56:16 +00:00
Boyko 1c66aea992 React UI: Implement alerts page (#6402)
* url filter rules param

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* address review changes

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* ui initial commit

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* improve ui

Signed-off-by: blalov <boiskila@gmail.com>
Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* fix typo in component name

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* create query link + ui enhancements

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* add count to state labels

Signed-off-by: blalov <boiskila@gmail.com>

* put alerts table render in the right place

Signed-off-by: blalov <boiskila@gmail.com>

* refactoring

Signed-off-by: blalov <boiskila@gmail.com>

* fix rules endpoint test

Signed-off-by: blalov <boiskila@gmail.com>

* lint fixes

Signed-off-by: blalov <boiskila@gmail.com>

* test query params

Signed-off-by: blalov <boiskila@gmail.com>

* refactoring

Signed-off-by: blalov <boiskila@gmail.com>

* review changes

Signed-off-by: blalov <boiskila@gmail.com>

* adding down arrow as click indicator in Alert

Signed-off-by: blalov <boiskila@gmail.com>

* add period at the end of the comment

Signed-off-by: blalov <boiskila@gmail.com>

* review changes

Signed-off-by: blalov <boiskila@gmail.com>

* remove left-over css

Signed-off-by: blalov <boiskila@gmail.com>

* adding expand/collapse arrows on Alert

Signed-off-by: blalov <boiskila@gmail.com>

* create proper expression for alert name

Signed-off-by: blalov <boiskila@gmail.com>
2019-12-09 23:42:59 +01:00
gotjosh 7bb73a9abd fix: flaky test for api/v1/targets/metadata. (#6436)
* Allows sorting of responses from the API in tests

Fixes flaky test for api/v1/targets/metadata.

Allows sorting of responses from the API. For our tests to be deterministic, we need to ensure the response from the API follows an order. This structure allows us to define one.

Fixes #6431

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-09 21:36:38 +00:00
Tobias Guggenmos 35c1f31721 PromQL: Use more standart format for error positions (#6433)
The most common format (used by go, gcc and clang) for compiler error positions seems to be

`filename:line:char:` or `line:char:` if the filename is unknown.

This PR adapts the PromQL parser to use this convention.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-12-09 16:39:03 +00:00
gotjosh 428089f83f api: tests for /target/metadata API endpoint
This commit introduces several test cases for the current /targets/metadata API endpoint.

To achieve so, we use a mock of the metadataStore and inject it to the targets under test.

Currently, three success cases are covered: with a metric name, with a target matcher, and with both. As for the failure scenario, the one where we couldn't match against a particular metric is covered.

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-05 10:30:00 +00:00
gotjosh 4bf9c6bb82 Allow targets to be injected as arguments when creating a testTargetRetriever
Previously, the struct `testTargetRetriever` had hardcoded active and dropped targets. This made it difficult to change the target information depending on the test case.

This change introduces a way to define them as arguments and pass it to a constructor for building. It lays a foundation for dynamically defining targets with various set of arguments to test different scenarios.

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-05 10:29:28 +00:00
Boyko 315b28439f Graph multi series select (#6391)
* adding graph series multi select support

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* skip inital plot draw from ResizeDetector

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
Signed-off-by: blalov <boiskila@gmail.com>

* fix unit tests

Signed-off-by: blalov <boiskila@gmail.com>

* extract Legend as component

Signed-off-by: blalov <boiskila@gmail.com>

* create legend state interface

Signed-off-by: blalov <boiskila@gmail.com>

* fix click selection issue

Signed-off-by: blalov <boiskila@gmail.com>

* fix single series select bug

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* review changes

Signed-off-by: blalov <boiskila@gmail.com>
2019-12-03 20:20:45 +01:00
Boyko 28470c229c React UI: Graph refactoring (#6382)
* move graph related files into own folder

Signed-off-by: blalov <boiskila@gmail.com>

* move graph helper functions into own file

Signed-off-by: blalov <boiskila@gmail.com>

* fix typo in file name

Signed-off-by: blalov <boiskila@gmail.com>

* fix typo in file name and lint fixes

Signed-off-by: blalov <boiskila@gmail.com>
2019-11-27 16:51:40 +01:00
Boyko fa1489e35c React UI: Improve graph legend hover performance (#6367)
* improve hover performance

Signed-off-by: blalov <boyko.lalov@tick42.com>

* increase graph tests coverage

Signed-off-by: blalov <boiskila@gmail.com>

* wrap plotSetAndDraw into requestAnimationFrame to achieve smooth hover effect

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* unit tests

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* add destroy plot method to types

Signed-off-by: blalov <boiskila@gmail.com>

* make chart undefined by default

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* make destroy plot test more meaningful

Signed-off-by: Boyko Lalov <boiskila@gmail.com>

* remove chart.destroy extra check

Signed-off-by: Boyko Lalov <boiskila@gmail.com>
2019-11-26 20:48:53 +01:00
Boyko 731ca08acd React UI: Graph legend (#6321)
* initial commit

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* eslint fixes

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* hover bug fix

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* refactoring

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* remove unnecessary check

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* fix tests

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* lint fix

https://github.com/prometheus/prometheus/issues/6268
Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* fix typos

Fixes<https://github.com/prometheus/prometheus/issues/6268>

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* init hover events if can

Fixes: <https://github.com/prometheus/prometheus/issues/6268>

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* review changes

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* fix activeIndex bug

Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* extend plot options types

Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* adding more types

Signed-off-by: blalov <boyko.lalov@tick42.com>

* fix branch after wrong force push

Signed-off-by: blalov <boyko.lalov@tick42.com>

* unit test fixes

Signed-off-by: blalov <boyko.lalov@tick42.com>

* remove unused variables

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-11-24 13:14:57 +01:00
Julius Volz cb92a45bf3
React UI: Make test spy attachment more jest-y (#6361)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-24 13:14:01 +01:00
Julius Volz 22d884b38e
React UI: Fix tests harder (#6316)
* React UI: Fix tests harder

Again not sure why this passed last time (?), but now I was getting an
error about 'NaN' not being a valid value to assign to the 'height'
property of the input element. This changes it so that only the blur()
function is actually mocked out on the active input element.

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

* Fixup

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-22 16:20:07 +01:00
Julius Volz 20ec57160c
React UI: Clarify VSCode usage requirements (#6357)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-22 14:55:32 +01:00
Julius Volz d2cb05846b
React UI: Add /tsdb-status to React-handled routes (#6313)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-20 15:50:52 +01:00
Boyko 3e3b7ceb0b React UI: Change the dynamic react key with static id (#6325)
* change the dynamic key with static id for react key prop

Signed-off-by: blalov <boyko.lalov@tick42.com>

* test fix

Signed-off-by: blalov <boyko.lalov@tick42.com>

* add initial panel on did mount

Signed-off-by: blalov <boyko.lalov@tick42.com>

* lint fix

Signed-off-by: blalov <boyko.lalov@tick42.com>

* remove filter for empty expression

Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactoring

Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactor encodePanelOptionsToQueryString

Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactor encodePanelOptionsToQueryString

Signed-off-by: blalov <boyko.lalov@tick42.com>

* revert to format range/endTime

Signed-off-by: blalov <boyko.lalov@tick42.com>

* urlParams unit tests

Signed-off-by: blalov <boyko.lalov@tick42.com>

* unit tests adjustments

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
2019-11-20 15:33:03 +01:00
Tom Wilkie de0a772b8e Port tsdb to use pkg/labels. (#6326)
* Port tsdb to use pkg/labels.

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

* Get tests passing.

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

* Remove useless cast.

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

* Appease linters.

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

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-11-18 11:53:33 -08:00
Julius Volz 85cae37107
React UI: Add better docs for the React UI (#6315)
* React UI: Add better docs for the React UI

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

* Fixups

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

* Fixup

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-14 19:53:10 +01:00
Julius Volz 2a6df53416
React UI: Make link to classic UI work (#6320)
It being a Reach Router <Link> caused the Reach router to not actually
leave the React app, even though the destination path was not a path
handled by the Reach Router.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-14 18:46:39 +01:00
Julius Volz 8ee3b8c848
React UI: Fix "<path-prefix>/new" -> "<path-prefix>/new/" redirect (#6319)
Fixes https://github.com/prometheus/prometheus/issues/6163

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-14 14:58:22 +01:00
Tobias Guggenmos be2bcc50a2 Fix target metadata API for empty match_targets (#6303)
According to the documentation, the target metadata API accepts it,
if no value for match_target has been provided. This was not the case
in the implementation.

This commit make the API behave as described in the docs.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-14 12:09:44 +01:00
Boyko 12d347e4db unit test fixes (#6314)
Signed-off-by: Boyko Lalov <boyskila@gmail.com>
2019-11-13 14:58:45 +01:00
Julius Volz e110402d44
React UI: Fix build (#6312)
This fixes two TypeScript errors. Not sure why we didn't catch the
breakage in the PR CI tests... also, updating TypeScript just for good
measure.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-13 13:36:43 +01:00
Boyko 8a9509b0a8 Replace fetching hooks with class render prop component (#6267)
* replace fetching hooks with class render prop component

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* rename Fetcher

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* status page markup separated from fetcher component

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* fetch api reusability

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* extract Config and Flags pages as 'dumb' components

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* more components splitting

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* implement fetchWithstatus HOC

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* refactor changed files tests

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* switching back to hooks.

Signed-off-by: blalov <boyko.lalov@tick42.com>
Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* fetch response bug fix

Signed-off-by: Boyko Lalov <boyskila@gmail.com>

* make wrapped by withstatusIndicator components names consistent

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
2019-11-12 14:35:47 +01:00
Sharad Gaur a85e7aac0e Adding TSDB Stats Page in React UI (#6281)
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
2019-11-12 11:15:20 +01:00
Boyko fc309a35bb update panels on back button pressed (#6300)
Signed-off-by: Boyko Lalov <boyskila@gmail.com>
2019-11-12 10:21:23 +01:00
Dustin Hooten ca60bf298c React UI: Implement /targets page (#6276)
* Add LastScrapeDuration to targets endpoint

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Scrape job name to targets endpoint

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Implement the /targets page in react

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add state query param to targets endpoint

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Use state filter in api call

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* api feedback

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* pr feedback frontend

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Implement and use localstorage hook

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* PR feedback

Signed-off-by: Dustin Hooten <dhooten@splunk.com>
2019-11-11 22:42:24 +01:00
Julien Pivotto d2257cb7d8 React UI: Display small numbers correctly (#6274)
Closes #6272

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-11-06 12:37:17 +01:00
David Leadbeater 129dbdaf74 Ensure warnings are escaped (#6279)
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2019-11-06 07:55:28 +00:00
Julius Volz 431844f0a7
React UI: Mark not-yet-done pages as under construction (#6277)
This is a quick change because the release is about to be cut in a few
hours and it would be good to clarify to users what the empty pages in
the new UI are about.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-05 20:09:37 +01:00
Julius Volz 3836cc1997 React UI: Fix left/right icons in the time picker (#6275)
https://github.com/prometheus/prometheus/pull/6193 removed these icons
from the font library, but the non-React timepicker library requires
these.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-05 08:15:18 -07:00
Sharad Gaur e94503ff5c Head Cardinality Status Page (#6125)
* Adding TSDB Head Stats like cardinality to Status Page

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Moving mutx to Head

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Renaming variabls

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Renaming variabls and html

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Removing unwanted whitespaces

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Adding Tests, Banchmarks and Max Heap for Postings Stats

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Adding more tests for postingstats and web handler

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Adding more tests for postingstats and web handler

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Remove generated asset file that is no longer used

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>

* Changing comment and variable name for more readability

Signed-off-by: Sharad Gaur <sgaur@splunk.com>

* Using time.Duration in postings status function and removing refresh button from web page

Signed-off-by: Sharad Gaur <sgaur@splunk.com>
2019-11-04 19:06:13 -07:00
Boyko 7293c859ab pass the value to the input instead to downshift (#6235)
* pass the value to the input instead to downshift

Signed-off-by: blalov <boyko.lalov@tick42.com>

* adjust expression input tests

Signed-off-by: blalov <boyko.lalov@tick42.com>

* improve ExpressionInput test coverage

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-11-04 13:15:25 +01:00
Julius Volz 95554074d8
React UI: Support custom path prefixes (#6264)
* React UI: Support custom path prefixes

The challenge was that the path prefix can be set dynamically as a flag
on Prometheus, but the React app bundle is statically compiled in to
expect a given path prefix. By adding a placeholder value to the React
app's index.html and replacing it in Prometheus with the right path
prefix during serving, this injects Prometheus's path prefix into the
React app via a global const.

Threading the path prefix into the different React components could have
been done with React's Contexts (https://reactjs.org/docs/context.html),
but I found the consumer side of context values to be a bit cumbersome
(wrapping entire components in context consumers), so I ended up
preferring direct threading of the path prefix values to components that
needed them. Also, using contexts in tests is more verbose than just
passing in path prefix values directly.

Fixes https://github.com/prometheus/prometheus/issues/6163

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

* Review feedback

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-04 09:17:50 +01:00
Julius Volz 5bc935337a
React UI: Simpler and relative-only query URL building (#6263)
I prefer just keeping it dumb (and it helps with a current Netlify
deploy hack I have).

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-03 13:21:35 +01:00
Julius Volz 8c0b76d1da
React UI: Improve styling of autocomplete sections (#6228)
* React UI: Improve styling of autocomplete sections

I removed the Card-related components and went back to normal <ul>/<li>,
since the style that Cards added just got in the way (like adding extra
borders and rounding, etc.), and from the examples at
https://getbootstrap.com/docs/4.3/components/card/, it doesn't seem like
multiple Cards are meant to be used as part of a larger list
(style-wise).

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

* Address review feedback

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-03 12:47:47 +01:00
Julius Volz fffb5ca1e9
React UI: More conversions to Function Components (#6259)
* React UI: More conversions to Function Components

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

* Address chat feedback over Riot

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-02 21:45:22 +01:00
Boyko cb7cbad5f9 WIP: status page - API and UI (#6243)
* status page initial commit

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactor useFetch

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactoring

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* adding tests

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* snapshot testing

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* fix wrong go files formatting

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* change the snapshot library

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* update api paths

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* move test folder outside src

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* useFetches tests

Signed-off-by: blalov <boyko.lalov@tick42.com>

* sticky navbar

Signed-off-by: Boyko Lalov <boyskila@gmail.com>
Signed-off-by: blalov <boyko.lalov@tick42.com>

* handle runtimeInfo error on Gather() and add json tags to RuntimeInfo struct

Signed-off-by: blalov <boyko.lalov@tick42.com>

* refactor alert managers section

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-11-02 16:53:32 +01:00
Chris Marchbanks f17a0e17aa Implement the /flags page in react (#6248)
* Implement the /flags page in react

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>

* Use custom react hook for calling api

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-11-02 10:27:36 +01:00
Michał 040425b0eb filtering alerts by state and display count of alerts in each state (#5758)
* local storage selectedTab on targets tab was renamed

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>

* added filters when displaying alerts

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>

* function was simplified

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>

* fixed rebase

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>

* minor rename

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>

* Active -> Pending

Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
2019-10-29 11:09:52 +01:00
Dustin Hooten e0443e6fa3 Add unit tests for react-app (#6234)
* Add MetricFormat unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add App unit tests; Add debug script

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Checkbox unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add SeriesName unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add QueryStatsView unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Legend unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Remove unused utils/func

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add utils/urlParams unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add utils/timeFormat unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add ExpressionInput unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add GraphControls unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add TimeInput unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add DataTable unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add SanitizeHTML unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Graph unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Extract utils/html

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add PanelList unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Panel unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add react-ui test coverage report to CI

Signed-off-by: Dustin Hooten <dhooten@splunk.com>
2019-10-28 18:09:48 +01:00
CSTDev 3b39f6ae45 WIP: React UI Linting rules (#6206)
* Initial react-ui linting rules

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Add react linting to build process

Move eslint config to its own file to keep package.json clearer.

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Linting changes from master

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Move CI linting to makefile and travis

Also add trailing comma to multiline imports.

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Add lint fix target to makefile

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Lint latest master

Signed-off-by: cstdev <pietomb00@hotmail.com>
2019-10-28 15:02:42 +01:00
Julius Volz e8027ba515
React UI: Serve React UI under /new (#6229)
This makes React UI URLs look nicer than the previous
/static/graph-new/app.html, but internally still serves all React UI
files from the compiled-in static assets directory.

Also, to allow future usage of the React / Reach router, we need to
serve the main React app's index.html on certain sub-paths that
correspond to current Prometheus's UI pages, instead of trying to serve
actual files that match the provided path name.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-28 10:45:53 +01:00
Ben Kochie 3f3986ed53 Adjust React query stats font (#6238)
* Use root relative font size rather than px to avoid hidpi issues.
* Darken to 50% saturation of base font color.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-10-28 10:22:36 +01:00
Julius Volz c83094b443
React UI: Implement /config page (#6236)
* React UI: Implement /config page

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

* Address review comments

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-28 10:00:00 +01:00
Boyko 8afa8452fd reach router integration initial commit (#6232)
Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-10-27 22:03:39 +01:00
Julius Volz db76da7603
React UI: Fix initial setting of past queries (#6226)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-26 22:20:52 +02:00
Julius Volz 9698262b63
React UI: Simplify query history setting code (#6225)
The metric names only get loaded once initially, so there is no reason
to mix them up with the handling of ongoing query history.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-26 21:17:24 +02:00
Boyko dab87ca281 split autocomplete dropdown in to groups (#6211)
* split autocomplete dropdown in to groups

Signed-off-by: blalov <boyko.lalov@tick42.com>

* fix autocomplete flickering

Signed-off-by: blalov <boyko.lalov@tick42.com>

* fix expression input issue.

Signed-off-by: blalov <boyko.lalov@tick42.com>

* select autocomplete item issue fix

Signed-off-by: blalov <boyko.lalov@tick42.com>

* remove metric group abstraction

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-10-26 19:50:22 +02:00
Julius Volz 8cf054849f
Update more web/ui/README.md bits for new UI (#6197)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-25 10:19:21 +02:00
Boyko e235af9c47 migrate query history (#6193)
* migrate query history

Signed-off-by: blalov <boyko.lalov@tick42.com>

* update lock file

Signed-off-by: blalov <boyko.lalov@tick42.com>

* set expression input height when item is selected

Signed-off-by: blalov <boyko.lalov@tick42.com>

* pr review changes

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-10-23 22:18:41 +02:00
CSTDev 4262ad92ce React ui add query stats (#6190)
* Adds the query stats to UI

Adds the query load time, resolution and total number of time series,
as the current UI has

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Implement unit test for QueryStats

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Tidy Query Stats component

Rename it and expose a interface for the values it displays
Make it a functional component as it has no state or lifecycle
Better null/undefined checks
Only render if needed, decided by the panel
Remove old stats if the next errors

Signed-off-by: cstdev <pietomb00@hotmail.com>
2019-10-23 12:47:37 +02:00
Julius Volz 1c238ac086
Add links between classic and new UIs (#6191)
The links preserve the graph settings between the two UIs.

Fixes https://github.com/prometheus/prometheus/issues/6162

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-21 20:18:47 +02:00
Boyko b5a16a8f86 make expression input controlled (#6174)
* make expression input controlled

Signed-off-by: blalov <boyko.lalov@tick42.com>

* close menu explicitly  when autosuggestion dropdown is hidden

Signed-off-by: blalov <boyko.lalov@tick42.com>
2019-10-20 22:52:29 +02:00
Ritesh Shrivastav 0f91ff4540 React UI: Sanitize HTML string to allow only supported elements (#6165)
* Add component to sanitize html

Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>

* Use SanitizeHTML component to allow only supported elements

Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>

* Add allowedTags props in SanitizeHTML component

Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>
2019-10-17 20:52:24 +02:00
Julius Volz ccac71ca5a
Update all React app node modules (#6153)
* Update all React app node modules

I ran "yarn upgrade --latest" and then fixed items that caused errors
with new linter settings in the React UI source.

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

* Fix more React UI lint errors that fail CI

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-17 16:34:02 +02:00
Julius Volz 63899f5529
Remove obsolete console.log() statements (#6159)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-17 16:24:07 +02:00
Julius Volz bca6e90ea6
Integrate beginning of React UI (#5694)
* Initial commit from Create React App

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

* Initial Prometheus expression browser code

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

* Grpahing, try out echarts

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

* Switch to flot

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

* Add metrics fetching and stuff

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

* Autosuggest and graph improvements

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

* Start implementing graph controls, add loading spinner

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

* So many new features and fixes

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

* Fixed and built more features

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

* Make datetimepicker clear work

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

* Don't abort when executing empty expression

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

* Remove TabPaneAlert

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

* Split components into separate files

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

* Add table time input

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

* Move first files to TypeScript!

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

* More TypeScript conversions

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

* More TS conversions

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

* More TS conversions

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

* More TS conversions

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

* More TS conversions

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

* More TS fixes

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

* Convert Graph to TS

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

* Changes

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

* Resize detector, start building legend, axis font colors

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

* Make graph legend work

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

* Add URL params support and much more

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

* Put panel state into panel list, write URL options

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

* Change order of Graph and Table tabs

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

* Generalize time input naming more

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

* Work on history functionality

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

* npm updates

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

* Move loading indicator into "Execute" button

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

* Fix typo

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

* Revert "Move loading indicator into "Execute" button"

This reverts commit ce7daee1f1af35da6c0d8b5517272839285ccfec.

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

* Improve error message when failing to fetch server time

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

* Move all code to Prometheus repo target dir

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

* Add react-app Makefile step and check in generated assets

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

* Add preliminary npm packages notice to NOTICE file

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

* Update React app's favicon and metadata

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

* Remove RP server refs, cleanups

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

* Use CircleCI image that includes NodeJS

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

* Add some missing React output assets

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

* Preserve CRLF in generated React files

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

* Switch from npm to yarn for React UI

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

* Save npm licenses and include them in release tarball

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

* Install npm on Travis

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

* Remove npm license tarball from source

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

* Remove React graph bundle from source

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

* Don't check in any compiled web assets

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

* Update README.md with node/yarn/React UI info

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

* Fix asset build step on CircleCI promu crossbuild

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

* Try to fix multi-arch go generate

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

* Remove check_assets from Travis CI build

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

* Prevent rebuilding of unchanged React app parts

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

* Fix npm license tarball path for promu

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

* Simplify Makefile

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

* Clarify build instructions in README.md

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

* Make minimal JS test pass

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

* Integrate React app tests into Makefile

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

* Separate react-app-tests target, but run it from CI

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

* Fix working directory for React app tests

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

* Remove local modifications to Makefile.common

This means that CircleCI will not run the React app tests, but at least
Travis still will...

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

* Depend on node_modules path for npm_licenses target

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

* Simplify tarball/docker/build Makefile targets

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

* Include React tests in "test" target

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

* Remove reference to removed "check_assets" target

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

* Do initial resize of expression input field

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

* Add React app proxying to local Prometheus in dev mode

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-10-17 14:38:09 +02:00
Krasi Georgiev 81d284f806
Merge the 2.13 release branch to master (#6117) 2019-10-09 17:41:46 +02:00
Giedrius Statkevičius ad58fc4765 ui: handle null response properly (#6071)
* web/ui: handle null case

The call might sometimes return /api/v1/label/__name__/values the
following:

```
{"status":"success","data":null}
```

Then the `index.js` file assumes that `data` is not `null`. However,
that assumption fails and then we get this error in the console:

```
graph.js?v=foo:317 Uncaught TypeError: Cannot read property 'length' of null
    at Object.success (graph.js?v=foo:317)
...
```

Then it becomes impossible to, for example, send a simple query like
`time()` and graph the results.

Fix it by using an empty array as the result if it is `null`.

Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>

* ui: update static assets data

Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
2019-10-08 19:52:12 -06:00
Sven Nebel 27bbc235e0 Improve message when Lifecycle API is not enabled
Signed-off-by: Sven Nebel <nebel.sven@gmail.com>
2019-09-25 10:57:21 +01:00
Sven Nebel d186d85649 Return 403 with PUT verb if lifecycle is not enabled
Signed-off-by: Sven Nebel <nebel.sven@gmail.com>
2019-09-25 10:57:11 +01:00
Yao Zengzeng 8744afdd1e cleanup redundant code of TestEndpoints (#6022)
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
2019-09-18 11:40:50 +01:00
Goutham Veeramachaneni 4c648eddf4
vendor: Update json-iterator (#6030)
Also add explicit support for NaN/Inf

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2019-09-17 19:22:26 +05:30
Simon Pasquier 26e8d25e0b
web/ui: avoid truncated Y-axis values (#6014)
* web/ui: avoid truncated Y-axis values

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Fix missing semi-colon

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-12 09:42:19 +02:00
Harkishen-Singh 74a9422147 move "remove graph" close to query area
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
2019-09-05 18:25:36 +05:30
Max cb5213e914 Change the global variable 'name' to a local variable so that it can not populate the global space. (#5970)
* Change the global variable 'name' to a  local variable so that it can not populate the global space.

Signed-off-by: 朱正浩,Zhu Zhenghao <zhenghao.zhu@daocloud.io>

* run make assets

Signed-off-by: 朱正浩,Zhu Zhenghao <zhenghao.zhu@daocloud.io>
2019-08-31 08:33:31 -06:00
Yao Zengzeng 21c9789083 multiple queries test for StreamRead (#5969)
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
2019-08-29 11:57:38 +01:00
Stanislav Putrya 6141a8bd7c Show warnings in UI if query have returned some warnings (#5964)
* Show warnings in UI if query have returned some warnings
+ improve warning (error) text if query to remote was finished with error
* Add prefixes for remote_read errors

Signed-off-by: Stan Putrya <root.vagner@gmail.com>
2019-08-28 14:25:28 +01:00
Harkishen Singh f0bb8129c3 Fixes service-discovery view when accessed from unhealthy targets (#5915)
* fix service-discovery view

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* updated localStorage logic

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* sign off

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* committed vfs unicodes

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
2019-08-21 13:57:08 +02:00
Bartek Płotka 48b2c9c8ea
remote-read: streamed chunked server side; Extended protobuf; Added chunked, checksumed reader (#5703)
Part of: https://github.com/prometheus/prometheus/issues/4517 and https://github.com/improbable-eng/thanos/issues/488

Changes:
* Extended protobuf for chunked remote read and negotation.
* Added checksumed, chunked Writer/Reader.
* Added Server side implementation for chunked streamed remote-read.


Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
2019-08-19 21:16:10 +01:00
Ganesh Vernekar 5ecef3542d
Cleanup after merging tsdb into prometheus
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-08-13 14:04:14 +05:30
Chris Marchbanks 0685eb5395
Refactor testutil.NewStorage into a new package
This avoids a circular dependency between the testutil and storage
packages.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-08-08 19:43:04 -06:00
slava 5e974d3170 Fix context for the showWarning function (#5833)
* Fix context for the showWarning function

If the difference between the current time on a client and time on a server is quite big, Prometheus tries to show a related warning in UI on the Graph tab. But in the code, an incorrect context is used to invoke this method. As a result, an error is showed in the web developer console and the whole page stop working at all. This commit fixes the context.

CC @juliusv

Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>

* Fix context for the showWarning function

Fixed assets

CC @juliusv

Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>
2019-08-05 20:03:12 +02:00
@aifsair 0f00737308 Fix log config setup (#5807)
The return value of Set() was not checked.
Hence, the typo ("al" instead of "af") wasn't catched.

Signed-off-by: François (fser) <fser@code-libre.org>
2019-07-29 18:00:30 +01:00
Tariq Ibrahim 9fe9e66cfd
remove the dependency on cockroachdb in prometheus
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2019-07-09 01:27:17 -07:00
Thomas Jackson fef150f1b5 Add tests to ensure we can marshal and unmarshal our min/max times (#5734)
* Add tests to ensure we can marshal and unmarshal our min/max times

Related to https://github.com/prometheus/client_golang/issues/614

Instead of implementing all the time parsing, we can special-case handle
these 2 times. This means if times in this format show up that
time.Parse can't handle they will still error, but we can marshal/parse
our own min/max time

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-07-08 10:43:59 +01:00
Sylvain Rabot 7cd5cf0b69 Sanitize HTML output (#5665)
* Compact html output
* Fix html style block location

Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
2019-06-25 13:39:34 +01:00
Simon Pasquier be67b8d460
web: fix flaky TestHTTPMetrics() (#5695)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-24 15:48:15 +02:00
Simon Pasquier d7f38dfdde
web: add 'code' label to HTTP metrics (#5640)
* web: add prometheus_http_requests_total metrics

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Add unit test for requestCounter metric

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-19 17:56:04 +02:00
Thomas Jackson 91d7175eaa Add storage.Warnings to LabelValues and LabelNames (#5673)
Fixes #5661

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2019-06-17 08:31:17 +01:00
Alex Salt d6a4daa26a web api: handle alert with Infinity/NaN values (#5582)
* web/api/v1: alert value as string in alert/rules endpoints

Signed-off-by: Alexander Saltykov <alexander-s@yandex-team.ru>
2019-05-21 10:41:54 +01:00
Tariq Ibrahim c4b57ac4e2
fix minor issue in the <a> tag of rules.html
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2019-05-16 13:00:35 -07:00
pbhudiaBAE 43953b105b Sorting alerts by group name in /alerts (#5448)
* Working group name

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Working categorised by group name

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Changed group sorting in web

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Fixed group sorting and comments

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Fixed group sorting and comments with gofmt

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Added file and group name

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* reverted back to full path to yml file

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>
2019-05-14 23:14:27 +02:00
mrasu 3a7a743bc4 Consistent Content-Type for js and css (#5551)
Currently, When `/etc/mime.types` has a unusual mime type, web of prometheus uses the type and you may get unexpected result.
With this change, web returns consistent Content-Type header for static js and css files

To reproduce:
1. Add a type at the end of `/etc/mime` like `text/x-js js`
2. Run prometheus
3. Request js file like `http://localhost:9090/static/vendor/js/jquery.min.js`
4. You will see Content-Type of the response is `text/x-js` instead of `application/javascript`

Signed-off-by: mrasu <m.rasu.hitsuji@gmail.com>
2019-05-09 16:10:15 +01:00
Simon Pasquier 45506841e6
*: enable all default linters (#5504)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-03 15:11:28 +02:00
Simon Pasquier 03b90b4645
web/ui: update to Bootstrap 4.3.1 (#5506)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-30 10:16:36 +02:00
Bjoern Rabenstein 38d518c0fe Rework #5009 after comments
Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-04-17 01:40:10 +02:00
Bjoern Rabenstein a92ef68dd8 Fix staticcheck errors
Not sure why they only show up now.

Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-04-17 01:40:10 +02:00
Sylvain Rabot 335a34486e Add external labels to template expansion
This affects the expansion of templates in alert labels and
annotations and console templates.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2019-04-17 01:40:10 +02:00
Simon Pasquier 81c4248081
*: bump gRPC and protobuf dependencies (#5367)
The goal is to remove almost all references to the
golang.org/x/net/context package.

github.com/gogo/protobuf => v1.2.1
google.golang.org/grpc => v1.19.1
github.com/grpc-ecosystem/grpc-gateway => v1.18.5

It also replaces github.com/cockroachdb/cmux by github.com/soheilhy/cmux
because of [1] which fixes #3909 incidentally.

[1] https://github.com/grpc/grpc-go/issues/2636

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-04 11:55:32 +02:00
Bob Shannon 8c8bb82d04 Add support for POSTing to /series endpoint (#5422)
* Add support for POSTing to /series endpoint
* Document query API POST support

Signed-off-by: Bob Shannon <bob.m.shannon@gmail.com>
2019-04-02 18:00:29 +01:00
Ganesh Vernekar 0afd172224
Merge pull request #5416 from prometheus/release-2.8
Merge 2.8.1 into master
2019-03-29 15:20:49 +05:30
Simon Pasquier 7328cb6cc2 web/ui: display the job label in /targets
PR #4806 was removed accidentally by #5192 (Bootstrap upgrade).

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-26 16:52:48 +01:00
Tariq Ibrahim 8fdfa8abea refine error handling in prometheus (#5388)
i) Uses the more idiomatic Wrap and Wrapf methods for creating nested errors.
ii) Fixes some incorrect usages of fmt.Errorf where the error messages don't have any formatting directives.
iii) Does away with the use of fmt package for errors in favour of pkg/errors

Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-26 00:01:12 +01:00
Bharath 91306bdf24 Support non POST methods for Lifecycle and Admin APIs (#5376)
Signed-off-by: Bharath Thiruveedula <bharath_ves@hotmail.com>
2019-03-20 17:33:45 +00:00
Matthias Loibl b7e978d255 web/ui: Fix padding in navbar container (#5371)
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2019-03-18 23:17:49 +01:00
Tom Wilkie c7b3535997 Use pkg/relabelling in remote write.
- Unmarshall external_labels config as labels.Labels, add tests.
- Convert some more uses of model.LabelSet to labels.Labels.
- Remove old relabel pkg (fixes #3647).
- Validate external label names.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2019-03-18 20:31:12 +00:00
Julien Pivotto 6c72cdb1e1 Add GODEBUG to the runtime page (#5324)
This is useful, e.g. with go 1.12 to see if TLS1.3 has been enabled.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-03-18 11:10:13 +00:00
Tariq Ibrahim d6f0e14ac6 fix redundant err!=nil check in web.go (#5346)
Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-12 16:25:46 +00:00
Krasi Georgiev 9d96ada510 Display correct values for the retention in the flags web gui. (#5322)
* Display correct values for the retention in the flags web gui.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>

* adding a log entry

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>

* added the retention info to the runtime status page

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>

* simplify the retention display

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-03-11 22:48:57 +05:30
Julien Pivotto 6152df44c2 ui: Expand expression_select to 220px
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-03-11 17:24:25 +01:00
Ganesh Vernekar 46e0587cb3
Merge pull request #5318 from roidelapluie/sdtag
ui: remove extra table tag in service discovery
2019-03-11 20:13:13 +05:30
Julien Pivotto 5a162dc1ab
ui: remove extra table tag in service discovery
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-03-09 11:02:14 +01:00
Julien Pivotto 981f9208fb
ui: Remove time picker borders
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2019-03-08 22:58:31 +01:00
David 38fea83c1f Debounce input key press handling (#5309)
- input key handler causes 2 layout cycles on each keypress which can
clog up browser rendering when typing quickly
- this change adds a debounce to the key press handler of 500ms

Fixes #5308
Signed-off-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
2019-03-06 16:16:55 +01:00
Julius Volz 795c989d36 Merge branch 'master' into bootstrap4
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-19 22:32:55 +00:00
Palash Nigam 09208b1a58 queryRange: Add more descriptive error messages (#5229)
Fixes: https://github.com/prometheus/prometheus/issues/4811

Signed-off-by: Palash Nigam <npalash25@gmail.com>
2019-02-19 19:16:14 +00:00
Julius Volz fdbaef86df Re-add typeahead license header to minified file
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 22:50:20 +00:00
Julius Volz 661f0127bc Rebuild web assets
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 22:50:16 +00:00
Julius Volz ed635190ba Re-add popper.js to fix target label tooltips
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 19:40:57 +00:00
Julius Volz 7b724cea3a Whitespace and other cleanups
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 19:40:52 +00:00
Julius Volz 7244ef3783 Add more top/bottom spacing for All/Unhealthy buttons
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 19:40:48 +00:00
Julius Volz 028e99e3d6 Remove spacing between All/Unhealthy buttons
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 19:40:44 +00:00
Julius Volz 45b91e8e80 Fix copy&paste button on /config, move pre style to CSS
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-02-17 19:40:30 +00:00
Julius Volz cd569b51d9 Merge branch 'master' into bootstrap4 2019-02-17 17:22:41 +00:00
Callum Styan 6f69e31398 Tail the TSDB WAL for remote_write
This change switches the remote_write API to use the TSDB WAL.  This should reduce memory usage and prevent sample loss when the remote end point is down.

We use the new LiveReader from TSDB to tail WAL segments.  Logic for finding the tracking segment is included in this PR.  The WAL is tailed once for each remote_write endpoint specified. Reading from the segment is based on a ticker rather than relying on fsnotify write events, which were found to be complicated and unreliable in early prototypes.

Enqueuing a sample for sending via remote_write can now block, to provide back pressure.  Queues are still required to acheive parallelism and batching.  We have updated the queue config based on new defaults for queue capacity and pending samples values - much smaller values are now possible.  The remote_write resharding code has been updated to prevent deadlocks, and extra tests have been added for these cases.

As part of this change, we attempt to guarantee that samples are not lost; however this initial version doesn't guarantee this across Prometheus restarts or non-retryable errors from the remote end (eg 400s).

This changes also includes the following optimisations:
- only marshal the proto request once, not once per retry
- maintain a single copy of the labels for given series to reduce GC pressure

Other minor tweaks:
- only reshard if we've also successfully sent recently
- add pending samples, latest sent timestamp, WAL events processed metrics

Co-authored-by: Chris Marchbanks <csmarchbanks.com> (initial prototype)
Co-authored-by: Tom Wilkie <tom.wilkie@gmail.com> (sharding changes)
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-02-12 11:39:13 +00:00
Maria Nemtinova 8e3a39f725 Web UI QoL improvements (#5201)
1. Added an ability to resize text area on mouseclick
2. Remember selected target status button on page reload

Signed-off-by: Maria Nemtinova <nemtinovamasha@gmail.com>
2019-02-12 00:22:05 +01:00
Minh-Long Do b26b5c9e96 Add rendering test of template based web endpoints (#5188)
Signed-off-by: Minh-Long  Do <minhlong.langos@gmail.com>
2019-02-08 10:17:47 +00:00
jritchieBAE b8f0a41745 Update to Bootstrap 4.1.3 (#5192)
* web: updated bootstrap3-typeahead file to work with bootstrap 4.0.0

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: Replaced bootstrap-3.3.1 with bootstrap 4.0.0

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: Added bootstrap4-glyphicons as 4.0.0 doesnt include bootstrap3 glyphicons

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated js jquery to 3.3.1

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated _base.html to import new bootstrap 4.0.0, jquery3.3.1 and bootstrap class tags to be 4.0 compatible

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: _base.html missed word out in title tag (Server).

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated alerts.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated config.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated flags.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated service-discovery.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated status.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated targets.html class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: updated graph_template.handlebar class names and tags to be bootstrap 4 compatible.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: alerts.css fix for button color inheritance on alerts page.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: graph.css fix for color inheritance.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: prometheus.css updated to fix nav bar.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* web: previous merge conflict not fixed correctly on _base.html

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* menu.lib and prom.lib imports updated

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* bootstrap 4.1.3 imported

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Bootstrap 4.1.3 imported into _base.html

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* bootstrap 4.1.3 imported into prom.lib

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* menu.lib style adjusted to view sidebar

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Alert colour uplifted to bootstrap 4.1.3

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Alerts display code reformatted similarly to config

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Consoles pages adjusted to account for new navbar

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* LHS Menu fixed in console pages

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Minor changes to prom_console to adjust lhs nav

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Prom.lib and some css updated to fix console graph controls

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Bootstrap 4.0.0 files removed

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Consoles configured so that the graph fits with the new side bar, css files also adjusted

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Import popper.min.js for dropdowns

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Popper.min.js imported locally

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Re-added #4764 and fixed css

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Removed .DS_Store

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Rebuilt assets

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* Spaces between buttons and inputs on graph page removed

Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com>

* fixed spacing in buttons on /targets

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* Updated vfsdata.go

Signed-off-by: Pritam Bhudia <pritam.bhudia@baesystems.com>

* fixed typeahead issue

Signed-off-by: James Ritchie <james.g.ritchie@baesystems.com>

* added css for dropdown

Signed-off-by: James Ritchie <james.g.ritchie@baesystems.com>

* changed order of css imports

Signed-off-by: James Ritchie <james.g.ritchie@baesystems.com>

* tinkered with CSS changes to make keyboard select and mouseover match

Signed-off-by: James Ritchie <james.g.ritchie@baesystems.com>
2019-02-07 22:18:09 +01:00
zhulongcheng fd964426a7 web: predeclare and reuse errors (#5180)
Predeclare and reuse errors to reduce duplicate code

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-02-04 13:06:26 +01:00
zhulongcheng a75f8a8e05 update error message in extractTimeRange (#5179)
Update error message in the extractTimeRange function
to match function's logic

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-02-03 09:29:23 +00:00
Simon Pasquier a60431f3cd Merge v2.7.1 into master (#5170)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-02-01 09:54:12 +01:00
Vishnunarayan K I 108b9b0e5f Limit number of merics in prometheus UI (#5139)
Signed-off-by: Vishnunarayan K I <appukuttancr@gmail.com>
2019-01-31 17:03:50 +00:00
Hrishikesh Barman a1f34bec2e Added CORS Origin flag (#5011)
Signed-off-by: Hrishikesh Barman <hrishikeshbman@gmail.com>
2019-01-17 15:01:06 +00:00
Matt Layher 302148fd69 *: apply gofmt -s
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-01-16 17:28:14 -05:00
Callum Styan 5358f76c5c update remote write path proto so that Labels/Timeseries can't be nil (#4957)
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-01-15 19:13:39 +00:00
Simon Pasquier 375ad1185c
*: bump gRPC dependencies (#5075)
* *: bump gRPC dependencies

This change updates the gRPC dependencies to more recent versions:

* github.com/gogo/protobuf => v1.2.0
* github.com/grpc-ecosystem/grpc-gateway => v1.6.3
* google.golang.org/grpc => v1.17.0

In addition scripts/genproto.sh leverages Go modules information instead of
hardcoding SHA1 commits. This ensures that the code is generated from
the exact same sources.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Run 'make proto' in CI

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Revert tabs -> spaces change

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Fix 'make proto' step

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* 'go get' grpc/protobuf dependencies

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Prepopulate cache with go mod download

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-15 15:32:05 +01:00
Simon Pasquier f678e27eb6
*: use latest release of staticcheck (#5057)
* *: use latest release of staticcheck

It also fixes a couple of things in the code flagged by the additional
checks.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Use official release of staticcheck

Also run 'go list' before staticcheck to avoid failures when downloading packages.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 14:47:38 +01:00
Tom Wilkie 6e08029b56
Move err to be the last return value from storage.Select. (#5054)
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2019-01-02 11:10:13 +00:00
SenXuDC 8fd0c0ab2e fix typo imeplements -> implements (#4979)
Signed-off-by: SenXuDC <sen.xu@daocloud.io>
2018-12-18 11:52:16 +01:00
Julius Volz 11a52be1d8
Better rounding for incoming query timestamps (#4941)
Fixes https://github.com/prometheus/prometheus/issues/4939

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2018-12-03 20:25:54 +08:00
mknapphrt f0e9196dca Return warnings on a remote read fail (#4832)
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2018-11-30 14:27:12 +00:00
Simon Pasquier 77ee41084f
web: group targets by job then instance (#4898)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-30 15:24:15 +01:00
Simon Pasquier 632626b553
web: deduplicate handler label for HTTP metrics (#4752)
* web: deduplicate handler label for HTTP metrics

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* remove instrumentHandlerFunc

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-30 13:30:32 +01:00
Ben Kochie c6399296dc
Fix spelling/typos (#4921)
* Fix spelling/typos

Fix spelling/typos reported by codespell/misspell.
* UK -> US spelling changes.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-11-27 17:44:29 +01:00
Simon Pasquier 0bb810d126
discovery/marathon: fix leaked connections (#4915)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-27 14:58:27 +01:00
Stafford Williams 328d81999a /config: Added Copy to clipboard button for /config (#4410)
* added `Copy to clipboard` button

Signed-off-by: Stafford Williams <stafford.williams@gmail.com>

* generate vsfdata

Signed-off-by: Stafford Williams <stafford.williams@gmail.com>

* new lines

Signed-off-by: Stafford Williams <stafford.williams@gmail.com>

* single newline

Signed-off-by: Stafford Williams <stafford.williams@gmail.com>
2018-11-27 16:05:26 +08:00
Frederic Branczyk f9c93b3686
Merge pull request #4905 from simonpasquier/cherrypick-4840
Cherrypick 4840
2018-11-26 10:35:02 +01:00
David Coles 1591ebf985 ui: Fix hover when metric has null value. (#4906)
When a metric has a null value, number formatters like
`humanizeNoSmallPrefix` will throw "Uncaught TypeError: Cannot read
property 'toPrecision' of null".

This is fixed by explicitly checking for `null` and returning the string
"null".

Note: This is usually not seen as rickshaw doesn't show annotations for
null values, but still calls the formatter.

Signed-off-by: David Coles <coles.david@gmail.com>
2018-11-25 14:16:48 +08:00
Fabian Reinartz a9803e9ecb Correctly skip mismatching targets
Signed-off-by: Fabian Reinartz <freinartz@google.com>
2018-11-23 17:10:31 +01:00
Alex Yu 5dcce32ef8 update promlog to latest version (#4876)
* update promlog to latest version

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* Update api tests, fix main setup

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* tidy go.sum

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* revendor prometheus/common

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* only initialize config; use kingpin for remote_storage_adapter

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* actually parse the flags

Signed-off-by: Alex Yu <yu.alex96@gmail.com>

* clean up imports

Signed-off-by: Alex Yu <yu.alex96@gmail.com>
2018-11-23 14:22:40 +01:00
achiuBAE a9050c45f6 Allow setting the Prometheus instance document title through a flag. (#4841)
* web: added ability to set page title through flag.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* Reformatted variable names and Flag description for readability.

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* assets_vfsdata.go

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* Flag name changed from web.ui-title to web.page-title

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>

* make assets

Signed-off-by: Andrew Chiu <andrew.chiu2@baesystems.com>
2018-11-21 12:45:06 +08:00
Simon Pasquier 87abb279e4
web: log stack traces on panic (#4221)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-20 14:25:03 +01:00
Ganesh Vernekar ca93fd544b /api/v1/labels endpoint for getting all label names (#4835)
* vendor: update tsdb

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

* /api/v1/labels endpoint

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

* regex matchers for API

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

* Add docs

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

* Matchers behaving as OR

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

* Removed the matchers

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

* vendor: update tsdb using go mod

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

* vendor update: tsdb

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

* Added LabelNames() to storage.Querier

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

* Test for api.labelNames

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

* Nits

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-11-19 15:51:14 +05:30
Simon Pasquier 6fa8de132b
web/v1/api: add tests for admin actions (#4767)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-15 14:22:16 +01:00
Frederic Branczyk 5464c64853
Merge pull request #4802 from simonpasquier/go-modules
Switch to Go modules
2018-11-15 11:43:44 +01:00
Goutham Veeramachaneni 7acedbce64
web(api): Make query and range api errors match
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2018-11-14 15:25:54 +05:30
Simon Pasquier 181f07ef26
web: avoid proxy to connect to the local gRPC server (#4572)
By default the gRPC client of the REST API gateway relies on the
HTTP_PROXY variable to connect to the local gRPC server which isn't
desired as the server runs in the same process. This change uses a
custom dialer that connects directly to the server's address.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-13 14:42:23 +01:00
Simon Pasquier d89c01b065 web/ui: fix asset generation for Go modules installs
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-12 10:56:21 +01:00
Simon Pasquier bf9a1d3d15 *: fix assets generation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-12 10:38:29 +01:00
Simon Pasquier 0a319b001a Update documentation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-09 15:01:15 +01:00
Simon Pasquier 5230e2730a
*: check that assets are up-to-date (#4731)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-09 11:31:36 +01:00
Simon Pasquier 147f2061d5 web: display job label in targets page
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-10-30 16:20:43 +01:00
Frederic Branczyk ad5139fcba
Merge pull request #4783 from simonpasquier/fix-targets-api
web/api/v1: fix targets endpoint
2018-10-26 15:37:12 +02:00
Wei Guo 742583e836 Support to query elements by a specific time (#4764)
* support to query elements by a specific time

Signed-off-by: Wei Guo <me@imkira.com>
2018-10-26 14:16:40 +02:00
Simon Pasquier a308a186e4 web/api/v1: fix targets endpoint
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-10-25 11:10:26 +02:00
Brian Brazil 9c03e11c2c Hook OpenMetrics parser into scraping.
Extend metadata api to support units.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-10-18 13:58:00 +01:00
Ariya Hidayat a0ba9b7f3e Avoid browser's spell-checking the Expression field (#4728)
Signed-off-by: Ariya Hidayat <ariya.hidayat@gmail.com>
2018-10-17 10:54:16 +02:00
Simon Pasquier c4a6acfb1e
*: move to go 1.11 (#4626)
* *: move to go 1.11

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Reduce number of places where we specify the Go version

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-10-16 09:41:45 +02:00
Goutham Veeramachaneni ffb7f829ec
Merge pull request #4730 from prometheus/release-2.4
Release 2.4
2018-10-12 14:15:42 -07:00
Will Hegedus 193ebe7e34 Updates to /targets and /rules (scrape duration, last evaluation time) (#4722)
* Add evaluationTimestamp (Last Evaluation) column to display on /rules
Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>

* Add lastScrapeDuration ("Scrape Duration") to display on /targets
Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>

* Updates based on Julius' feedback

Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>

* Update to set timestamp to when eval started (after eval completes)

Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>

* Update /rules to display time since last evaluation

Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>

* Re-order Last Eval/Eval Time to be consistent with targets page

Signed-off-by: Will Hegedus <wbhegedus@liberty.edu>
2018-10-12 18:26:59 +02:00
Tariq Ibrahim d371697841 Adding new metric type to track in-flight queries via the remote read API endpoint. (#4699)
* Adding new metric type to track in-flight queries via the remote read API endpoint.

Signed-off-by: tariqibrahim <tariq.ibrahim@microsoft.com>

* fix review comments

Signed-off-by: tariqibrahim <tariq.ibrahim@microsoft.com>

* fix comments

Signed-off-by: tariqibrahim <tariq.ibrahim@microsoft.com>
2018-10-10 16:09:08 -07:00
Benji Visser eb4cc37e50 Update moment.js and moment-timezone.js (#4679)
* upgrading moment-timezome (0.5.13 -> 0.5.17)
* upgrading dependency moment (2.16.0 -> 2.22.2)

Signed-off-by: noqcks <benny@noqcks.io>
2018-10-10 09:48:06 +01:00
Julien Pivotto 17fea5478a Improve rule views by wrapping lines (#4702)
With the addition of the errors in the views list, it is now difficult
to have a view on all the rules in a screen witdh.

This commit adds wrapping to improve the overall display of the rules
page.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2018-10-07 15:31:16 +01:00
Callum Styan 9bca041285 WIP: keep track of samples per query, set a max # of samples (#4513)
* keep track of samples per query, set a max # of samples that can be in
memory at once

Signed-off-by: Callum Styan <callumstyan@gmail.com>
2018-10-02 12:59:19 +01:00
Simon Pasquier 3c00eeaf16 web/api/v1: fix optional skip_head for snapshot (#4674)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-10-02 16:18:07 +05:30
Krasi Georgiev 47a673c3a0
process scrape loops reloading in parallel (#4526)
The scrape manage receiver's channel now just saves the target sets
and another backgorund runner updates the scrape loops every 5 seconds.
This is so that the scrape manager doesn't block the receiving channel
when it does the long background reloading of the scrape loops.

Active and dropped targets are now saved in each scrape pool instead of
the scrape manager. This is mainly to avoid races when getting the
targets via the web api.

When reloading the scrape loops now happens in parallel to speed up the
final disared state and this also speeds up the prometheus's shutting
down.

Also updated some funcs signatures in the web package for consistency.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-09-26 12:20:56 +03:00
Tom Wilkie 4c52400708
Limit concurrent remote reads. (#4656)
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2018-09-25 20:07:34 +01:00
Tom Wilkie d3a1ff1abf
Reduce memory usage of remote read by reducing pointer usage. (#4655)
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2018-09-25 19:14:00 +01:00
Goutham Veeramachaneni 1a5a3d3be6
Merge pull request #4645 from prometheus/release-2.4
Merge release-2.4 into master
2018-09-21 15:38:12 +05:30
Simon Pasquier 2d7f562ed6 web: fix asset paths for Windows platforms (#4616)
* web: fix asset paths for Windows platforms

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* web: add tests

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-09-19 12:50:53 +05:30
Goutham Veeramachaneni 9ee4b05d16
Better link for docs (#4593)
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2018-09-13 15:26:41 +05:30
Goutham Veeramachaneni 3e87c04b83
Logger is nil for API. Fixes #4577 (#4583)
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2018-09-06 16:07:48 +05:30
Tom Wilkie 457e4bb58e
Limit the number of samples remote read can return. (#4532)
* Limit the number of samples remote read can return.

- Return 413 entity too large.
- Limit can be set be a flag.  Allow 0 to mean no limit.
- Include limit in error message.
- Set default limit to 50M (* 16 bytes = 800MB).

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2018-09-05 15:50:50 +02:00
Simon Pasquier 75bd348135 web: clean up api/v2 (#4554)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-08-29 12:55:46 +05:30
Thomas Jackson f0a1ebc19d Add SelectParams to Select for federation (#4546)
When prom2 came out the storage querier interface consolidated to a
single Select() method. While doing this it makes it impossible as the
implementer of the querier to know if you are being called for metadata
or actual data. The workaround has been to check if the SelectParams are
nil, which the federation call is always nil. This has 2 negative
consequences (1) remote implementations interpret this as a metadata
call, which makes the federation endpoint return nothing. (2) this means
that the storage implementations don't get the same information passed
down to them as far as SelectParams goes.

This diff simply adds SelectParams to the Select() call in the
federation handler

Mitigation for #4057

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
2018-08-28 11:23:31 +01:00