-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
_created
time series suppression (#791)
* Support PROMETHEUS_DISABLE_CREATED_SERIES env var to suppress `_created` time series Signed-off-by: Gabi Davar <[email protected]> * switched to use a static variable. test tweaks. Signed-off-by: Gabi Davar <[email protected]> * docs Signed-off-by: Gabi Davar <[email protected]> * let's be truer. Signed-off-by: Gabi Davar <[email protected]> * Revert GetNames() redundant change. Signed-off-by: Gabi Davar <[email protected]> * make final, drop test for now Signed-off-by: Gabi Davar <[email protected]> * remove the extra deps too. Signed-off-by: Gabi Davar <[email protected]> * Add a brand new and shiny class Signed-off-by: Gabi Davar <[email protected]>
- Loading branch information
Showing
7 changed files
with
42 additions
and
7 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
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
23 changes: 23 additions & 0 deletions
23
simpleclient/src/main/java/io/prometheus/client/Environment.java
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,23 @@ | ||
package io.prometheus.client; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
class Environment { | ||
|
||
private static final String DISABLE_CREATED_SERIES = "PROMETHEUS_DISABLE_CREATED_SERIES"; | ||
private static final List<String> DISABLE_CREATED_SERIES_TRUE = Arrays.asList("true", "1", "t"); | ||
private static final boolean includeCreatedSeries = !isTrue(DISABLE_CREATED_SERIES); | ||
|
||
static boolean includeCreatedSeries() { | ||
return includeCreatedSeries; | ||
} | ||
|
||
private static boolean isTrue(String envVarName) { | ||
String stringValue = System.getenv(envVarName); | ||
if (stringValue != null) { | ||
return DISABLE_CREATED_SERIES_TRUE.contains(stringValue.toLowerCase()); | ||
} | ||
return false; | ||
} | ||
} |
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