Class/Object

kamon.tag

TagSet

Related Docs: object TagSet | package tag

Permalink

class TagSet extends AnyRef

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:

  1. Using the lookup DSL. You can use the Lookup DSL when you know exactly that you are trying to get out of the tags instance. The lookup DSL is biased towards String keys since they are by far the most common case. For example, to get a given tag as an Option[String] and another as an Option[Boolean] the following code should suffice:

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TagSet
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def all(): Seq[Tag]

    Permalink

    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.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    TagSet → AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def get[T](lookup: Lookup[T]): T

    Permalink

    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.

  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    TagSet → AnyRef → Any
  13. def isEmpty(): Boolean

    Permalink

    Returns whether this TagSet instance does not contain any tags.

  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. def iterator(): Iterator[Tag]

    Permalink

    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.

  16. def iterator[T](valueTransform: (Any) ⇒ T): Iterator[Pair[T]]

    Permalink

    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.

  17. def iterator[T](valueTransform: Function[Any, T]): Iterator[Pair[T]]

    Permalink

    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.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. def nonEmpty(): Boolean

    Permalink

    Returns whether this TagSet instance contains any tags.

  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    TagSet → AnyRef → Any
  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def withTag(key: String, value: Long): TagSet

    Permalink

    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.

  28. def withTag(key: String, value: Boolean): TagSet

    Permalink

    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.

  29. def withTag(key: String, value: String): TagSet

    Permalink

    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.

  30. def withTags(other: TagSet): TagSet

    Permalink

    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.

  31. def without(key: String): TagSet

    Permalink

    Creates a new TagSet instance without the provided key, if it was present.

Inherited from AnyRef

Inherited from Any

Ungrouped