Package io.prometheus.client
Class SampleNameFilter
- java.lang.Object
-
- io.prometheus.client.SampleNameFilter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SampleNameFilter.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Predicate<String>
and(Predicate<? super String> other)
Replacement for Java 8'sPredicate.and()
for compatibility with Java versions < 8.static Predicate<String>
restrictToNamesEqualTo(Predicate<String> filter, Collection<String> allowedNames)
Helper method to compose a filter such that Sample names must match the existing filter and be in the list of allowedNames This should be used to implement thenames[]
query parameter in HTTP exporters.static List<String>
stringToList(String s)
Helper method to deserialize adelimiter
-separated list of Strings into aList<String>
.boolean
test(String sampleName)
-
-
-
Method Detail
-
and
public Predicate<String> and(Predicate<? super String> other)
Replacement for Java 8'sPredicate.and()
for compatibility with Java versions < 8.
-
stringToList
public static List<String> stringToList(String s)
Helper method to deserialize adelimiter
-separated list of Strings into aList<String>
.delimiter
is one of, ; \t \n
.This is implemented here so that exporters can provide a consistent configuration format for lists of allowed names.
-
restrictToNamesEqualTo
public static Predicate<String> restrictToNamesEqualTo(Predicate<String> filter, Collection<String> allowedNames)
Helper method to compose a filter such that Sample names must- match the existing filter
- and be in the list of allowedNames
names[]
query parameter in HTTP exporters.- Parameters:
filter
- may be null, indicating that the resulting filter should just filter byallowedNames
.allowedNames
- may be null or empty, indicating thatfilter
is returned unmodified.- Returns:
- a filter combining the exising
filter
and theallowedNames
, ornull
if both parameters werenull
.
-
-