Class TagMapBuilderImpl

java.lang.Object
io.opencensus.tags.TagContextBuilder
io.opencensus.implcore.tags.TagMapBuilderImpl

final class TagMapBuilderImpl extends TagContextBuilder
  • Field Details

  • Constructor Details

  • Method Details

    • put

      public TagMapBuilderImpl put(TagKey key, TagValue value)
      Description copied from class: TagContextBuilder
      Adds the key/value pair regardless of whether the key is present.

      For backwards-compatibility this method still produces propagating Tags.

      Equivalent to calling put(key, value, TagMetadata.create(TagTtl.UNLIMITED_PROPAGATION)).

      Specified by:
      put in class TagContextBuilder
      Parameters:
      key - the TagKey which will be set.
      value - the TagValue to set for the given key.
      Returns:
      this
    • put

      public TagContextBuilder put(TagKey key, TagValue value, TagMetadata tagMetadata)
      Description copied from class: TagContextBuilder
      Adds the key/value pair and metadata regardless of whether the key is present.
      Overrides:
      put in class TagContextBuilder
      Parameters:
      key - the TagKey which will be set.
      value - the TagValue to set for the given key.
      tagMetadata - the TagMetadata associated with this Tag.
      Returns:
      this
    • remove

      public TagMapBuilderImpl remove(TagKey key)
      Description copied from class: TagContextBuilder
      Removes the key if it exists.
      Specified by:
      remove in class TagContextBuilder
      Parameters:
      key - the TagKey which will be removed.
      Returns:
      this
    • build

      public TagMapImpl build()
      Description copied from class: TagContextBuilder
      Creates a TagContext from this builder.
      Specified by:
      build in class TagContextBuilder
      Returns:
      a TagContext with the same tags as this builder.
    • buildScoped

      public Scope buildScoped()
      Description copied from class: TagContextBuilder
      Enters the scope of code where the TagContext created from this builder is in the current context and returns an object that represents that scope. The scope is exited when the returned object is closed.
      Specified by:
      buildScoped in class TagContextBuilder
      Returns:
      an object that defines a scope where the TagContext created from this builder is set to the current context.