Returns a immutable sequence of tags created from the contained tags internal representation.
Returns a immutable sequence of tags created from the contained tags internal representation. Calling this method will cause the creation of a new data structure. Unless you really need to have all the tags as immutable instances it is recommended to use the .iterator() function instead.
The returned sequence contains immutable values and is safe to share across threads.
Executes a tag lookup.
Executes a tag lookup. The return type of this function will depend on the provided Lookup. Take a look at the built-in lookups on the Lookups companion object for more information.
Returns whether this TagSet instance does not contain any tags.
Returns an iterator of tags.
Returns an iterator of tags. The underlying iterator reuses the Tag instances to avoid unnecessary intermediate allocations and thus, it is not safe to share across threads. The most common case for tags iterators is on reporters which will need to iterate through all existent tags only to copy their values into a separate data structure that will be sent to the external systems.
Returns a pairs iterator from this TagSet.
Returns a pairs iterator from this TagSet. All values are transformed using the provided valueTransform before being returned by the iterator.
Returns a pairs iterator from this TagSet.
Returns a pairs iterator from this TagSet. All values are transformed using the provided valueTransform before being returned by the iterator.
Returns whether this TagSet instance contains any tags.
Creates a new TagSet instance that includes the provided key/value pair.
Creates a new TagSet instance that includes the provided key/value pair. If the provided key was already associated with another value then the previous value will be discarded and overwritten with the provided one.
Creates a new TagSet instance that includes the provided key/value pair.
Creates a new TagSet instance that includes the provided key/value pair. If the provided key was already associated with another value then the previous value will be discarded and overwritten with the provided one.
Creates a new TagSet instance that includes the provided key/value pair.
Creates a new TagSet instance that includes the provided key/value pair. If the provided key was already associated with another value then the previous value will be discarded and overwritten with the provided one.
Creates a new TagSet instance that includes all the tags from the provided Tags instance.
Creates a new TagSet instance that includes all the tags from the provided Tags instance. If any of the tags in this instance are associated to a key present on the provided instance then the previous value will be discarded and overwritten with the provided one.
Creates a new TagSet instance without the provided key, if it was present.
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.