-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite label names to be Prometheus compliant
I am running into issues where my OpenTSDB tags with periods in their names are failing to be scraped by Prometheus. It seems like the most logical place to fix that is in this exporter. This approach takes any tag name that would fail validation in Prometheus and rewrites it to pass.
- Loading branch information
1 parent
021b8da
commit dde951f
Showing
6 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.3.3 | ||
0.4.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package models | ||
|
||
import org.scalatestplus.play.PlaySpec | ||
|
||
class OpenTsdbQueryResultSpec extends PlaySpec { | ||
|
||
"OpenTsdbQueryResult" should { | ||
"Santize tag names" in { | ||
val inputs = Map("abCD" -> "1", "123abc" -> "2", "@email" -> "3", "Unic\u00F6de" -> "4", "teach.me" -> "5") | ||
val expected = Map("abCD" -> "1", ":23abc" -> "2", ":email" -> "3", "Unic\u00F6de" -> "4", "teach_me" -> "5") | ||
TsdbQueryResult.sanitizeTags(inputs) must contain theSameElementsAs expected | ||
} | ||
} | ||
|
||
} |