Fix mtime reporting in textfile collector, add tests.

This commit is contained in:
Julius Volz 2015-09-03 16:59:56 +02:00
commit e13f910427
9 changed files with 186 additions and 11 deletions

View file

@ -0,0 +1,8 @@
name: "node_textfile_scrape_error"
help: "1 if there was an error opening or reading a file, 0 otherwise"
type: GAUGE
metric: <
gauge: <
value: 0
>
>

View file

@ -0,0 +1 @@
This file should be ignored.

View file

@ -0,0 +1,8 @@
name: "node_textfile_scrape_error"
help: "1 if there was an error opening or reading a file, 0 otherwise"
type: GAUGE
metric: <
gauge: <
value: 1
>
>

View file

@ -0,0 +1,79 @@
name: "node_textfile_mtime"
help: "Unixtime mtime of textfiles successfully read."
type: GAUGE
metric: <
label: <
name: "file"
value: "metrics1.prom"
>
gauge: <
value: 1
>
>
metric: <
label: <
name: "file"
value: "metrics2.prom"
>
gauge: <
value: 2
>
>
name: "node_textfile_scrape_error"
help: "1 if there was an error opening or reading a file, 0 otherwise"
type: GAUGE
metric: <
gauge: <
value: 0
>
>
name: "testmetric1_1"
help: "Metric read from fixtures/textfile/two_metric_files/metrics1.prom"
type: UNTYPED
metric: <
label: <
name: "foo"
value: "bar"
>
untyped: <
value: 10
>
>
name: "testmetric1_2"
help: "Metric read from fixtures/textfile/two_metric_files/metrics1.prom"
type: UNTYPED
metric: <
label: <
name: "foo"
value: "baz"
>
untyped: <
value: 20
>
>
name: "testmetric2_1"
help: "Metric read from fixtures/textfile/two_metric_files/metrics2.prom"
type: UNTYPED
metric: <
label: <
name: "foo"
value: "bar"
>
untyped: <
value: 30
>
timestamp_ms: 1441205977284
>
name: "testmetric2_2"
help: "Metric read from fixtures/textfile/two_metric_files/metrics2.prom"
type: UNTYPED
metric: <
label: <
name: "foo"
value: "baz"
>
untyped: <
value: 40
>
timestamp_ms: 1441205977284
>

View file

@ -0,0 +1,2 @@
testmetric1_1{foo="bar"} 10
testmetric1_2{foo="baz"} 20

View file

@ -0,0 +1,2 @@
testmetric2_1{foo="bar"} 30 1441205977284
testmetric2_2{foo="baz"} 40 1441205977284

View file

@ -0,0 +1 @@
This file should be ignored.