support metric files with uppercase extension
This commit is contained in:
parent
8afaf2e92d
commit
e8296a644d
@ -256,7 +256,7 @@ To enable textfile metrics:
|
|||||||
Metrics collected from these files will be exposed directly alongside the other metrics without any additional processing.
|
Metrics collected from these files will be exposed directly alongside the other metrics without any additional processing.
|
||||||
This means that it is the responsibility of the file creator to ensure the format is correct.
|
This means that it is the responsibility of the file creator to ensure the format is correct.
|
||||||
|
|
||||||
By exporting textfile metrics, an extra metric is also exported with an error count for each file:
|
By exporting textfile metrics an extra metric is also exported with an error count for each file:
|
||||||
|
|
||||||
```
|
```
|
||||||
# HELP textfile_error Checks for errors while reading text files
|
# HELP textfile_error Checks for errors while reading text files
|
||||||
@ -264,4 +264,4 @@ By exporting textfile metrics, an extra metric is also exported with an error co
|
|||||||
textfile_error{path="file.prom"} 0
|
textfile_error{path="file.prom"} 0
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** Only files ending with `.prom` will be considered.
|
**NOTE:** Any file not ending with `.prom` will be ignored.
|
||||||
|
@ -27,7 +27,7 @@ func (c *Collector) collectFileContents() {
|
|||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
fileName := file.Name()
|
fileName := file.Name()
|
||||||
if !strings.HasSuffix(fileName, ".prom") {
|
if !strings.HasSuffix(strings.ToLower(fileName), ".prom") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
c.fileMap[fileName] = &fileData{
|
c.fileMap[fileName] = &fileData{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user