Package io.opencensus.tags
Class NoopTags.NoopTagContextBuilder
- java.lang.Object
-
- io.opencensus.tags.TagContextBuilder
-
- io.opencensus.tags.NoopTags.NoopTagContextBuilder
-
- Enclosing class:
- NoopTags
@Immutable private static final class NoopTags.NoopTagContextBuilder extends TagContextBuilder
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static TagContextBuilderINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateNoopTagContextBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagContextbuild()Creates aTagContextfrom this builder.ScopebuildScoped()Enters the scope of code where theTagContextcreated from this builder is in the current context and returns an object that represents that scope.TagContextBuilderput(TagKey key, TagValue value)Adds the key/value pair regardless of whether the key is present.TagContextBuilderput(TagKey key, TagValue value, TagMetadata tagMetadata)Adds the key/value pair and metadata regardless of whether the key is present.TagContextBuilderremove(TagKey key)Removes the key if it exists.-
Methods inherited from class io.opencensus.tags.TagContextBuilder
putLocal, putPropagating
-
-
-
-
Field Detail
-
INSTANCE
static final TagContextBuilder INSTANCE
-
-
Method Detail
-
put
public TagContextBuilder put(TagKey key, TagValue value)
Description copied from class:TagContextBuilderAdds 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:
putin classTagContextBuilder- Parameters:
key- theTagKeywhich will be set.value- theTagValueto set for the given key.- Returns:
- this
-
put
public TagContextBuilder put(TagKey key, TagValue value, TagMetadata tagMetadata)
Description copied from class:TagContextBuilderAdds the key/value pair and metadata regardless of whether the key is present.- Overrides:
putin classTagContextBuilder- Parameters:
key- theTagKeywhich will be set.value- theTagValueto set for the given key.tagMetadata- theTagMetadataassociated with thisTag.- Returns:
- this
-
remove
public TagContextBuilder remove(TagKey key)
Description copied from class:TagContextBuilderRemoves the key if it exists.- Specified by:
removein classTagContextBuilder- Parameters:
key- theTagKeywhich will be removed.- Returns:
- this
-
build
public TagContext build()
Description copied from class:TagContextBuilderCreates aTagContextfrom this builder.- Specified by:
buildin classTagContextBuilder- Returns:
- a
TagContextwith the same tags as this builder.
-
buildScoped
public Scope buildScoped()
Description copied from class:TagContextBuilderEnters the scope of code where theTagContextcreated 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:
buildScopedin classTagContextBuilder- Returns:
- an object that defines a scope where the
TagContextcreated from this builder is set to the current context.
-
-