Package io.opencensus.implcore.tags
Class TagMapBuilderImpl
- java.lang.Object
-
- io.opencensus.tags.TagContextBuilder
-
- io.opencensus.implcore.tags.TagMapBuilderImpl
-
final class TagMapBuilderImpl extends TagContextBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private static TagMetadata
METADATA_UNLIMITED_PROPAGATION
private java.util.Map<TagKey,TagValueWithMetadata>
tags
-
Constructor Summary
Constructors Constructor Description TagMapBuilderImpl()
TagMapBuilderImpl(java.util.Map<TagKey,TagValueWithMetadata> tags)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagMapImpl
build()
Creates aTagContext
from this builder.Scope
buildScoped()
Enters the scope of code where theTagContext
created from this builder is in the current context and returns an object that represents that scope.TagMapBuilderImpl
put(TagKey key, TagValue value)
Adds the key/value pair regardless of whether the key is present.TagContextBuilder
put(TagKey key, TagValue value, TagMetadata tagMetadata)
Adds the key/value pair and metadata regardless of whether the key is present.TagMapBuilderImpl
remove(TagKey key)
Removes the key if it exists.-
Methods inherited from class io.opencensus.tags.TagContextBuilder
putLocal, putPropagating
-
-
-
-
Field Detail
-
METADATA_UNLIMITED_PROPAGATION
private static final TagMetadata METADATA_UNLIMITED_PROPAGATION
-
tags
private final java.util.Map<TagKey,TagValueWithMetadata> tags
-
-
Constructor Detail
-
TagMapBuilderImpl
TagMapBuilderImpl(java.util.Map<TagKey,TagValueWithMetadata> tags)
-
TagMapBuilderImpl
TagMapBuilderImpl()
-
-
Method Detail
-
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
Tag
s.Equivalent to calling
put(key, value, TagMetadata.create(TagTtl.UNLIMITED_PROPAGATION))
.- Specified by:
put
in classTagContextBuilder
- Parameters:
key
- theTagKey
which will be set.value
- theTagValue
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 classTagContextBuilder
- Parameters:
key
- theTagKey
which will be set.value
- theTagValue
to set for the given key.tagMetadata
- theTagMetadata
associated with thisTag
.- Returns:
- this
-
remove
public TagMapBuilderImpl remove(TagKey key)
Description copied from class:TagContextBuilder
Removes the key if it exists.- Specified by:
remove
in classTagContextBuilder
- Parameters:
key
- theTagKey
which will be removed.- Returns:
- this
-
build
public TagMapImpl build()
Description copied from class:TagContextBuilder
Creates aTagContext
from this builder.- Specified by:
build
in classTagContextBuilder
- 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 theTagContext
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 classTagContextBuilder
- Returns:
- an object that defines a scope where the
TagContext
created from this builder is set to the current context.
-
-