forked from percona/node_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge metrics descriptions in textfile collector (prometheus#2475)
The textfile collector will now provide a unified metric description (that will look like "Metric read from file/a.prom, file/b.prom") for metrics collected accross several text-files that don't already have a description. Also change the error handling in the textfile collector tests to ContinueOnError to better mirror the real-life use-case. Signed-off-by: Guillaume Espanel <guillaume.espanel.ext@ovhcloud.com> Signed-off-by: Guillaume Espanel <guillaume.espanel.ext@ovhcloud.com>
- Loading branch information
Showing
14 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
collector/fixtures/textfile/metrics_merge_different_help.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# HELP events_total A nice help message. | ||
# TYPE events_total counter | ||
events_total{file="a",foo="bar"} 10 | ||
events_total{file="a",foo="baz"} 20 | ||
# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. | ||
# TYPE node_textfile_mtime_seconds gauge | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_different_help/a.prom"} 1 | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_different_help/b.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 |
5 changes: 5 additions & 0 deletions
5
collector/fixtures/textfile/metrics_merge_different_help/a.prom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total A nice help message. | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="a"} 10 | ||
events_total{foo="baz",file="a"} 20 | ||
|
5 changes: 5 additions & 0 deletions
5
collector/fixtures/textfile/metrics_merge_different_help/b.prom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total A different help message. | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="b"} 30 | ||
events_total{foo="baz",file="b"} 40 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# HELP events_total Metric read from fixtures/textfile/metrics_merge_empty_help/a.prom, fixtures/textfile/metrics_merge_empty_help/b.prom | ||
# TYPE events_total counter | ||
events_total{file="a",foo="bar"} 10 | ||
events_total{file="a",foo="baz"} 20 | ||
events_total{file="b",foo="bar"} 30 | ||
events_total{file="b",foo="baz"} 40 | ||
# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. | ||
# TYPE node_textfile_mtime_seconds gauge | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_empty_help/a.prom"} 1 | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_empty_help/b.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="a"} 10 | ||
events_total{foo="baz",file="a"} 20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="b"} 30 | ||
events_total{foo="baz",file="b"} 40 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# HELP events_total Metric read from fixtures/textfile/metrics_merge_no_help/a.prom, fixtures/textfile/metrics_merge_no_help/b.prom | ||
# TYPE events_total counter | ||
events_total{file="a",foo="bar"} 10 | ||
events_total{file="a",foo="baz"} 20 | ||
events_total{file="b",foo="bar"} 30 | ||
events_total{file="b",foo="baz"} 40 | ||
# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. | ||
# TYPE node_textfile_mtime_seconds gauge | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_no_help/a.prom"} 1 | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_no_help/b.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="a"} 10 | ||
events_total{foo="baz",file="a"} 20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="b"} 30 | ||
events_total{foo="baz",file="b"} 40 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# HELP events_total The same help. | ||
# TYPE events_total counter | ||
events_total{file="a",foo="bar"} 10 | ||
events_total{file="a",foo="baz"} 20 | ||
events_total{file="b",foo="bar"} 30 | ||
events_total{file="b",foo="baz"} 40 | ||
# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. | ||
# TYPE node_textfile_mtime_seconds gauge | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_same_help/a.prom"} 1 | ||
node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_same_help/b.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total The same help. | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="a"} 10 | ||
events_total{foo="baz",file="a"} 20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# HELP events_total The same help. | ||
# TYPE events_total counter | ||
events_total{foo="bar",file="b"} 30 | ||
events_total{foo="baz",file="b"} 40 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters