Marker trait for allowed Tag implementations.
A immutable collection of key/value pairs with specialized support for storing String keys pointing to String, Long and/or Boolean values.
A immutable collection of key/value pairs with specialized support for storing String keys pointing to String, Long and/or Boolean values.
Instances of Tags store all pairs in the same data structure, but preserving type information for the stored pairs and providing a simple DSL for accessing those values and expressing type expectations. It is also possible to lookup pairs without prescribing a mechanism for handling missing values. I.e. users of this class can decide whether to receive a null, java.util.Optional, scala.Option or any other value when looking up a pair.
TagSet instances can only be created from the builder functions on the TagSet companion object. There are two different options to read the contained pairs from a Tags instance:
import kamon.tag.Tags.Lookup._ val tags = Tags.from(tagMap) val name = tags.get(option("name")) val isSignedIn = tags.get(booleanOption("isSignedIn"))
2. Using the .all() and .iterator variants. This option requires you to test the returned instances to verify whether they are a Tag.String, Tag.Long or Tag.Boolean instance and act accordingly. Fortunately this cumbersome operation is rarely necessary on user-facing code.
Marker trait for allowed Tag implementations. Users are not meant to create implementations of this trait outside of Kamon. Furthermore, users of TagSet might never need to interact with these classes but rather perform lookups using the lookup DSL.