Commit graph

475 commits

Author SHA1 Message Date
Dimitar Dimitrov f05e435f6a
Remove copying of locked structs in test 2022-01-21 15:12:45 +01:00
Dimitar Dimitrov eae4ac40ba
Add tests for rules.Group.Equals 2022-01-21 15:07:20 +01:00
Dimitar Dimitrov 16faee8b78
Account for repeating tenants when comparing rules 2022-01-21 14:21:50 +01:00
György Krajcsovits b55a51a118 Add test of Manager using the supplied context function.
Tests the the query being executed uses a context modified by the function.

Also modify reloadRules utility function to take time interval for the
Manager so the test runs faster. We'll work on synthetic clock later.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2021-11-29 18:30:43 +01:00
Dimitar Dimitrov a16235f5f4
Test loading rule groups with source tenants 2021-11-29 13:53:23 +01:00
Dimitar Dimitrov f17d3a71aa
Improve godoc of Group.SourceTenants() 2021-11-26 14:08:21 +01:00
Dimitar Dimitrov a97576fc00
Ignore order when comparing the source tenants of two rule groups 2021-11-26 14:07:20 +01:00
Dimitar Dimitrov 75d3c11278
Repurpose FederatedContextFunc into GroupEvaluationContextFunc 2021-11-26 14:07:19 +01:00
Dimitar Dimitrov 42a7f1e210
Add some godocs to ManagerOptions 2021-11-25 13:47:32 +01:00
Dimitar Dimitrov 6ffb81244f
Add source_tenants fields to RuleGroup 2021-11-25 13:44:29 +01:00
Björn Rabenstein 4c56a193c5
Merge pull request #9478 from prometheus/beorn7/pkg-deprecation
Move packages out of deprecated pkg directory
2021-11-09 11:09:16 +01:00
beorn7 c954cd9d1d Move packages out of deprecated pkg directory
This creates a new `model` directory and moves all data-model related
packages over there:
  exemplar labels relabel rulefmt textparse timestamp value

All the others are more or less utilities and have been moved to `util`:
  gate logging modetimevfs pool runtime

Signed-off-by: beorn7 <beorn@grafana.com>
2021-11-09 08:03:10 +01:00
Bryan Boreham 26d8ae0e41 Rules: simplify map key for stale series detection
The rules manager keeps a note of which series were generated by the
last run, so it can write a stale marker to those that disappeared.
Since the keys are not for human eyes, we can use a simpler format
and save the effort of quoting label values.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-11-08 22:18:48 +01:00
Yijie Qin 6fce45838a
Add access function for restoration state of alerting rule (#9665) 2021-11-05 18:26:29 -04:00
Mateusz Gozdek 1a6c2283a3 Format Go source files using 'gofumpt -w -s -extra'
Part of #9557

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-02 19:52:34 +01:00
Levi Harrison d81bbe154d
Rule alerts/series limit updates (#9541)
* Add docs and do not limit inactive alerts.

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-10-21 23:14:17 +02:00
Levi Harrison dc2f1993d8
Limit number of alerts or series produced by a rule (#9260)
* Add limit to rules

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 09:48:26 +02:00
George Robinson 049b4f4f13
Support customization of template options in TemplateExpander (#9290)
Signed-off-by: George Robinson <george.robinson@grafana.com>
2021-09-13 17:19:08 +05:30
Levi Harrison 8c29046ab2
Remove unneeded state modifications
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-20 16:42:31 -04:00
Michal Wasilewski 3f686cad8b
fixes yamllint errors
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
2021-06-12 12:47:47 +02:00
Levi Harrison b5f6f8fb36 Switched to go-kit/log
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-11 12:28:36 -04:00
Levi Harrison 26274527df
Updated/added tests
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-05-30 23:35:41 -04:00
Levi Harrison 17ea8d006a
Added external URL access
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-05-30 23:35:26 -04:00
Owen Diehl 23999df27c expose rule metrics fields
Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
2021-04-30 13:36:44 -04:00
Goutham Veeramachaneni 2efdf660b1
Increase evaluation failures on Commit() (#8770)
I think we should increment the metric here, we're setting the rule
health anyways. This means even if the "evaluation" suceeded, none of
the samples made it to storage.

This is a simplified solution to: https://github.com/prometheus/prometheus/pull/8410/

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2021-04-29 14:28:48 +02:00
Björn Rabenstein 9549a15c6f
Merge pull request #7675 from JessicaGreben/jg/11-retroactive-rule-eval
Add rule importer to backfill
2021-03-29 19:09:21 +02:00
Goutham Veeramachaneni 4b5ab80ca6
[rule] Update rule health for append/commit fails (#8619)
* [rule] Update rule health for append/commit fails

Similar to https://github.com/prometheus/prometheus/pull/8410 will
provide more context.

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

* Add test for updating health on append fails

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2021-03-18 15:44:33 +01:00
jessicagreben 78e84aed89 resolve merge conflict
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
2021-02-24 09:47:29 -08:00
Tom Wilkie 7369561305
Combine Appender.Add and AddFast into a single Append method. (#8489)
This moves the label lookup into TSDB, whilst still keeping the cached-ref optimisation for repeated Appends.

This makes the API easier to consume and implement.  In particular this change is motivated by the scrape-time-aggregation work, which I don't think is possible to implement without it as it needs access to label values.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2021-02-18 17:37:00 +05:30
jessicagreben ac06d0a657 merge master/resolve conflict
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
2020-11-26 08:43:07 -08:00
jessicagreben 75654715d3 fix panics
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
2020-11-01 07:54:04 -08:00
jessicagreben 6980bcf671 unexport backfiller
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
2020-10-31 06:40:56 -07:00
Julien Pivotto 6c56a1faaa
Testify: move to require (#8122)
* Testify: move to require

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

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

* More moves

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

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

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-27 11:06:53 +01:00
Julien Pivotto 4e5b1722b3
Move away from testutil, refactor imports (#8087)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-22 11:00:08 +02:00
jessicagreben 36ac0b68f1 merge master, fix conflicts 2020-10-17 08:20:21 -07:00
Łukasz Mierzwa 19c190b406
Add a rule_group_samples metric (#7977)
This new metric allows tracking how many samples did each rule group generate.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2020-09-25 16:48:38 +01:00
李国忠 4a52faf2ae
Unnecessary go routine spawn. (#7951)
Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
2020-09-21 11:29:03 +01:00
jessicagreben dfa510086b add alignment, mv rule importer to promtool dir, add queryRange
Signed-off-by: jessicagreben <jessicagrebens@gmail.com>
2020-09-13 08:07:59 -07:00
Anonymous 8219b442c8
rules: Remove redundant RLock to avoid double RLock (#7183)
Signed-off-by: BurtonQin <bobbqqin@gmail.com>
2020-09-07 18:58:21 +01:00
johncming 2f2a51a43a
web/api/v1: make names consistent. (#7841)
Signed-off-by: johncming <johncming@yahoo.com>
2020-08-25 11:38:06 +01:00
Goutham Veeramachaneni cb830b0a9c
Label rule_group_iterations metric with group name (#7823)
* Label rule_group_iterations metric with group name

evalTotal and evalFailures having the label but iterations not having it
is an odd mismatch.

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

* Remove the metrics when a group is deleted.

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

* Initialise the metrics

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2020-08-19 15:29:13 +02:00
johncming 362080ba28
rules: add evaluationTimestamp when copy state. (#7775)
Signed-off-by: johncming <johncming@yahoo.com>
2020-08-14 09:42:13 +01:00
Callum Styan c7a17f6491
Add additional tag/log to rules Manager Eval trace span. (#7708)
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2020-08-06 08:42:20 -07:00
Annanay 9bba8a6eae Merge branch 'master' into appender-context
Signed-off-by: Annanay <annanayagarwal@gmail.com>
2020-07-30 16:43:18 +05:30
Julien Pivotto e76c436e9c
Goleak in discoveries, scrape, rules (#7662)
* Add go leak tests for discoveries with goroutines

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

* Add go leak tests in rules

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

* Add go leak tests in scrape tests

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-27 09:38:08 +01:00
Annanay 7f98a744e5 Add context to Appender interface
Signed-off-by: Annanay <annanayagarwal@gmail.com>
2020-07-24 19:40:51 +05:30
Owen Diehl 9ccedc0407
Arbitrary rule & group loading (#7569)
* allows loading rule groups via an interface

Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
2020-07-22 15:19:34 +01:00
Julien Pivotto b83cbacbdd
Rule manager: remove blocking channel in mail (#7631)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-22 00:13:24 +02:00
johncming a69a8b931f
rules: fix bug for unknown alert state. (#7599)
Signed-off-by: johncming <johncming@yahoo.com>
2020-07-17 08:39:15 +01:00