Modifier and Type | Method and Description |
---|---|
static Id |
create(String name)
Create an immutable Id with the provided name.
|
default Id |
filter(BiPredicate<String,String> predicate)
Return a new tag list with only tags that match the predicate.
|
default Id |
filterByKey(Predicate<String> predicate)
Return a new tag list with only tags with keys that match the predicate.
|
default String |
getKey(int i)
Return the key at the specified index.
|
default String |
getValue(int i)
Return the value at the specified index.
|
String |
name()
Description of the measurement that is being collected.
|
default int |
size()
Return the size, number of tags, for the id including the name.
|
Iterable<Tag> |
tags()
Other dimensions that can be used to classify the measurement.
|
static Id |
unsafeCreate(String name,
String[] tags,
int length)
Warning: This method can be used to get better performance for some critical
use-cases, but also has increased risk.
|
default Id |
withTag(String k,
boolean v)
Return a new id with an additional tag value using
Boolean.toString(boolean) to
convert the boolean value to a string representation. |
default <E extends Enum<E>> |
withTag(String k,
Enum<E> v)
Return a new id with an additional tag value using
Enum.name() to
convert the Enum to a string representation. |
Id |
withTag(String k,
String v)
Return a new id with an additional tag value.
|
Id |
withTag(Tag t)
Return a new id with an additional tag value.
|
default Id |
withTags(Iterable<Tag> tags)
Return a new id with additional tag values.
|
default Id |
withTags(Map<String,String> tags)
Return a new id with additional tag values.
|
default Id |
withTags(String... tags)
Return a new id with additional tag values.
|
default Id |
withTags(String k1,
String v1)
Return a new id with additional tag values.
|
default Id |
withTags(String k1,
String v1,
String k2,
String v2)
Return a new id with additional tag values.
|
default Id |
withTags(String k1,
String v1,
String k2,
String v2,
String k3,
String v3)
Return a new id with additional tag values.
|
default Id |
withTags(Tag... tags)
Return a new id with additional tag values.
|
String name()
default Id withTag(String k, boolean v)
Boolean.toString(boolean)
to
convert the boolean value to a string representation. This is merely a convenience function
for:
id.withTag("key", Boolean.toString(value))
default <E extends Enum<E>> Id withTag(String k, Enum<E> v)
Enum.name()
to
convert the Enum to a string representation. This is merely a convenience function
for:
id.withTag("key", myEnum.name())
default Id withTags(String k1, String v1)
withTags(String...)
.default Id withTags(String k1, String v1, String k2, String v2)
withTags(String...)
.default Id withTags(String k1, String v1, String k2, String v2, String k3, String v3)
withTags(String...)
.default Id withTags(Map<String,String> tags)
ConcurrentMap
, note that the map should
not be concurrently modified during this call. It is up to the user to ensure
that it contains the correct set of tags that should be added to the id before and for the
entire duration of the call until the new id is returned.default String getKey(int i)
default String getValue(int i)
default int size()
default Id filter(BiPredicate<String,String> predicate)
default Id filterByKey(Predicate<String> predicate)
filterByKey
in interface TagList
static Id create(String name)
Registry.createId(String)
instead so that the overhead for instrumentation can
be mostly removed when choosing to use a NoopRegistry. Using this method directly the Id
will always be created.static Id unsafeCreate(String name, String[] tags, int length)
create(String)
instead.
Create a new id using the name tag set. The provided array will be used directly so it should not be modified after. Caller must ensure that: