Filter out testfile metrics correctly when using collect[] filters (#763)
* remove injection hook for textfile metrics, convert them to prometheus format * add support for summaries * add support for histograms * add logic for handling inconsistent labels within a metric family for counter, gauge, untyped * change logic for parsing the metrics textfile * fix logic to adding missing labels * Export time and error metrics for textfiles * Add tests for new textfile collector, fix found bugs * refactor Update() to split into smaller functions * remove parseTextFiles(), fix import issue * add mtime metric directly to channel, fix handling of mtime during testing * rename variables related to labels * refactor: add default case, remove if guard for metrics, remove extra loop and slice * refactor: remove extra loop iterating over metric families * test: add test case for different metric type, fix found bug * test: add test for metrics with inconsistent labels * test: add test for histogram * test: add test for histogram with extra dimension * test: add test for summary * test: add test for summary with extra dimension * remove unnecessary creation of protobuf * nit: remove extra blank line
This commit is contained in:
parent
cd2a17176a
commit
1f2458f42c
17 changed files with 513 additions and 175 deletions
20
collector/fixtures/textfile/summary_extra_dimension.out
Normal file
20
collector/fixtures/textfile/summary_extra_dimension.out
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# HELP node_textfile_mtime Unixtime mtime of textfiles successfully read.
|
||||
# TYPE node_textfile_mtime gauge
|
||||
node_textfile_mtime{file="metrics.prom"} 1
|
||||
# HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise
|
||||
# TYPE node_textfile_scrape_error gauge
|
||||
node_textfile_scrape_error 0
|
||||
# HELP prometheus_rule_evaluation_duration_seconds The duration for a rule to execute.
|
||||
# TYPE prometheus_rule_evaluation_duration_seconds summary
|
||||
prometheus_rule_evaluation_duration_seconds{handler="",rule_type="alerting",quantile="0.9"} 0.001765451
|
||||
prometheus_rule_evaluation_duration_seconds{handler="",rule_type="alerting",quantile="0.99"} 0.018672076
|
||||
prometheus_rule_evaluation_duration_seconds_sum{handler="",rule_type="alerting"} 214.85081044700146
|
||||
prometheus_rule_evaluation_duration_seconds_count{handler="",rule_type="alerting"} 185209
|
||||
prometheus_rule_evaluation_duration_seconds{handler="",rule_type="recording",quantile="0.5"} 4.3132e-05
|
||||
prometheus_rule_evaluation_duration_seconds{handler="",rule_type="recording",quantile="0.9"} 8.9295e-05
|
||||
prometheus_rule_evaluation_duration_seconds{handler="",rule_type="recording",quantile="0.99"} 0.000193657
|
||||
prometheus_rule_evaluation_duration_seconds_sum{handler="",rule_type="recording"} 185091.01317759082
|
||||
prometheus_rule_evaluation_duration_seconds_count{handler="",rule_type="recording"} 1.0020195e+08
|
||||
prometheus_rule_evaluation_duration_seconds{handler="foo",rule_type="alerting",quantile="0.5"} 0.000571464
|
||||
prometheus_rule_evaluation_duration_seconds_sum{handler="foo",rule_type="alerting"} 0
|
||||
prometheus_rule_evaluation_duration_seconds_count{handler="foo",rule_type="alerting"} 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue