Commit graph

7337 commits

Author SHA1 Message Date
Simon Pasquier 941568839a
docs: update /api/v1/rules documentation (#6449)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-12-11 17:06:17 +01:00
Simon Pasquier b15dda9e07
util/promlint: simplify sorting function (#6448)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-12-11 15:45:26 +01:00
Brian Brazil 4df814f509
Don't buffer up tables in memory on compaction. (#6422)
We can instead write it as we go, and then go back and write in the
length at the end.

Also fix the compaction benchmark, which indicates no changes.

For the benchmark, this brings maximum memory usage of the buffers 
from ~200kB down to 128B.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-12-11 12:49:13 +00:00
johncming 83cda784d2 skip empty alerts. (#6444)
Signed-off-by: johncming <johncming@yahoo.com>
2019-12-11 10:03:50 +00:00
Frederic Branczyk e53f751765
Merge pull request #6445 from RainbowMango/pr_fix_promlint_order_algo
Fix promlint order algorithm not work issue
2019-12-11 11:00:03 +01:00
RainbowMango f9de671cdd Fix promlint order algorithm not work issue.
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2019-12-11 14:56:28 +08: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
Mitsuhiro Tanda 466cc36ba0 upgrade aws-sdk-go (#6429)
Signed-off-by: Mitsuhiro Tanda <mitsuhiro.tanda@gmail.com>
2019-12-09 23:16:18 +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 5c503d85f7 PromQL: export lexer (#6435)
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-12-09 19:03:31 +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
Tobias Guggenmos cd39ebe7c6 PromQL: export function list (#6434)
This PR exports the list of supported PromQL functions and their signatures.

The reason for that is that the PromQL language server likes to use that list.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-12-09 15:33:43 +00:00
johncming 0ae048ff78 tsdb: add error details in log. (#6415)
Signed-off-by: johncming <johncming@yahoo.com>
2019-12-09 10:37:01 +00:00
Mark Nevill b0a5c51b95 Return unused point slice to pool in Call and VectorSelector eval. (#6427)
Signed-off-by: Mark Nevill <mark.nevill@gmail.com>
2019-12-09 10:32:40 +00:00
Ben Ye c0250cf120 Fix some typos(#6423)
Signed-off-by: yeya24 <yb532204897@gmail.com>
2019-12-08 19:16:46 +00:00
Tobias Guggenmos 3bb715031f PromQL: Use generated parser to parse label matchers (#6410)
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-12-05 16:16:12 +00:00
Garrett 5a9c4acfbf Pushdown aggregator group by through read hint (#6401)
* Pushdown aggregator group by through read hint

Implement https://github.com/prometheus/prometheus/issues/6400

* add temporal aggregation pushdown support

Signed-off-by: xiancli <xiancli@ebay.com>
2019-12-05 14:06:28 +00:00
Brian Brazil 0ae4899c47
Merge pull request #6409 from gotjosh/tests-for-target-metadata
Add tests for /api/v1/target/metadata
2019-12-05 10:49:16 +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 05842176a6 Make the scrape.metricMetadataStore interface public
To test the implementation of our metric metadata API, we need to represent various states of metadata in the scrape metadata store. That is currently not possible as the interface and method to set the store are private.

This changes the interface, list and get methods, and the SetMetadaStore function to be public.

Incidentally, the scrapeCache implementation needs to be renamed to match the new signature.

Signed-off-by: gotjosh <josue@grafana.com>
2019-12-05 10:29:58 +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
Björn Rabenstein c8665eaee3
Merge pull request #6389 from prometheus/update-maint
Update and re-work maintainers file.
2019-12-04 16:27:27 +01:00
Krasimir Georgiev 549164f252
return err instead of panic for corrupted chunk (#6040)
* Fix tsdb panic when querying corrupted chunks.
check that the chunk segment has enough data to read all chunk pieces.
* refactor, simplify and add tests.
* simpfiy WriteChunks implementation

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
2019-12-04 09:37:49 +02:00
Chris Marchbanks 5000c05378
Merge pull request #6378 from prometheus/accurate-desired-shards-metric
Change desired shards metric to report raw calculated value
2019-12-03 15:26:21 -07:00
Callum Styan 5830e03691
Merge pull request #6337 from cstyan/rw-log-replay
Log the start and end of the WAL replay within the WAL watcher.
2019-12-03 13:24:26 -08: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
Frederic Branczyk 8ac15703b0
Merge pull request #6393 from simonpasquier/fix-kubernetes-client-metrics
discovery/kubernetes: fix client metrics
2019-12-03 14:46:10 +01:00
Brooks Swinnerton 0ea3a2218d Add time units to storage.tsdb.retention.size flag (#6365)
* Add time units to storage.tsdb.retention.size flag

In an effort to reduce confusion with the `m` option of the
`ParseDuration()` function, this commit adds the available time units to
the `storage.tsdb.retention.time` flag to help showcase that there is no
option for months (which could be assumed to be `m`).

If someone were looking to set the retention to six months, they may
mistakenly do so with `6m`, which would reduce their retention to six
minutes.

Signed-off-by: Brooks Swinnerton <bswinnerton@gmail.com>
2019-11-30 08:00:51 +00:00
Simon Pasquier 75470f86b4 discovery/kubernetes: fix client metrics
The Kubernetes client records workqueue duration and latency metrics as
seconds so there's no need to convert the values from microseconds to
seconds anymore.

The cache metrics (prometheus_sd_kubernetes_cache_*) are removed because
they aren't used anymore by the client though still exposed by its API.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-11-29 12:34:36 +01:00
Brian Brazil 6f9558e7d9 Update and re-work maintainers file.
For sanity I'm not going to try to distinguish the things I'm maintainer
for because I'm the right person (e.g. template) vs things I'm the
maintainer for because someone has to be (e.g. pkg). Also add a general
warning to handle that this is more nuanced than it's worth trying to
capture, and relatedly always going to be out of date.

I'm also not giving full names/emails as we do elsewhere, as that'd
make things only more difficult to read for this particular repository.

I didn't put Bartek down for remote read, as particular functions of
particular files seems a a bit fine grained.

Fixes #4714

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-11-28 19:01:35 +00:00
Bartlomiej Plotka eba5e02718 Volunteering for release shepharding (#6384)
(:

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
2019-11-27 11:45:23 -07: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
Tobias Guggenmos 408574a6e1 promql: Allow injecting fake tokens into the generated parser (#6381)
* promql: Allow injecting fake tokens into the generated parser

Yacc grammars do not support having multiple start symbols.

To work around that restriction, it is possible to inject fake tokens into the lexer stream,
as described here https://www.gnu.org/software/bison/manual/html_node/Multiple-start_002dsymbols.html .

This is part of the parser rewrite effort described in #6256.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-27 12:59:03 +00:00
Callum Styan 6a24eee340 Simplify duration check for watcher WAL replay.
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-11-26 16:53:11 -08: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
Tobias Guggenmos bbd92b85da promql: Use capitalized names for item types (#6371)
For yacc generated parsers there is the convention to capitalize the names of item types provided by the lexer, which makes it easy to distinct lexer tokens (capitalized) from nonterminal symbols (not capitalized) in language grammars.

This convention is also followed by the (non generated) go compiler (see https://golang.org/pkg/go/token/#Token).

Part of the parser rewrite described in #6256.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-26 13:29:42 +00:00
Tobias Guggenmos c229ed17e2 promql: Implement yyLexer interface (#6370)
This is the first step towards a generated lexer as described in #6256.

It adds methods to the parser struct, that make it implement the yyLexer interface required by a yacc generated parser, as described here: https://godoc.org/golang.org/x/tools/cmd/goyacc .

The yyLexer interface is implemented by the parser struct instead of the lexer struct for the following reasons:

* Both parsers have a lookahead that the lexer does not know about. This solution makes it possible to synchronize these lookaheads when switching parsers.
* The routines to handle parser errors are not accessible to the lexer.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-26 13:28:36 +00:00
Chris Marchbanks 6f34e35b3e
Record the exact value of desired shards in metric
It is possible that desired shards is always a bit higher than the
number of shards (less than 30%) and by exporting desired shards as the
raw number it will be easy to tell if a Prometheus is in that situation.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-11-26 06:26:03 -07:00
Chris Marchbanks 0e684ca205
Fix unknown type in sharding up log
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-11-26 06:22:56 -07:00
Björn Rabenstein bd1c66861a
Merge pull request #6350 from geobeau/fix-exported-relabel
Fix relabaling collision when using exported labels
2019-11-26 13:19:18 +01:00
Geoffrey Beausire 5cb7987314 Fix relabaling collision when using exported label
When using both a label and the suffix+label in the
relabel config. It's possible that Prometheus remove
the suffx+label for no obvious reason. It's due to a
collision when merging labels from target and from
the sample.

Signed-off-by: Geoffrey Beausire <g.beausire@criteo.com>
2019-11-26 11:03:11 +01:00
Bartosz Jakubski 80ba03c67d fix subquery with offset conversion to string (#6373)
Signed-off-by: Bartosz Jakubski <b.jakubski@gmail.com>
2019-11-26 06:45:51 +00:00
Callum Styan c2cb1e4103 Add a metric to track total bytes sent per remote write queue. (#6344)
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-11-25 13:25:18 -07:00
Julius Volz 4be90b201e
Remove Travis as a CI platform (#6369)
It's currently causing weird unknown problems in React tests that run
successfully everywhere else, and by now all the tests that run on
Travis also run on CircleCI, so Travis is not needed anymore.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-25 14:59:26 +01:00
Tobias Guggenmos c63259b83c promql: Clean up parser struct (#6360)
* promql: Clean up parser struct

The parser struct used two have two somewhat misused fields:

peekCount int
token     [3]item

By reading the code carefully one notices, that peekCount always has the value 0 or 1 and that only the first element of token is ever accessed.

To make this clearer, this commit replaces the token array with a single variable and the peekCount int with a boolean.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-25 12:29:14 +00:00
Julius Volz 9497764011
Update remote storage maintainers to Callum and Chris (#6366)
* Update remote storage maintainers to Callum and Chris

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

* Chat feedback

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-11-25 12:58:44 +01:00
Tobias Guggenmos d0cff29749 PromQL: Reduce Code duplication in AST traversion (#6362)
* promql: Add Children function for easier AST traversion

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2019-11-25 11:41:59 +00:00