public abstract class TagContextBuilder extends Object
TagContext class.| Constructor and Description |
|---|
TagContextBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract TagContext |
build()
Creates a
TagContext from this builder. |
abstract Scope |
buildScoped()
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. |
abstract TagContextBuilder |
put(TagKey key,
TagValue value)
Deprecated.
in favor of
put(TagKey, TagValue, TagMetadata), or putLocal(TagKey, TagValue) if you only want in-process tags. |
TagContextBuilder |
put(TagKey key,
TagValue value,
TagMetadata tagMetadata)
Adds the key/value pair and metadata regardless of whether the key is present.
|
TagContextBuilder |
putLocal(TagKey key,
TagValue value)
Adds a non-propagating tag to this
TagContextBuilder. |
TagContextBuilder |
putPropagating(TagKey key,
TagValue value)
Adds an unlimited propagating tag to this
TagContextBuilder. |
abstract TagContextBuilder |
remove(TagKey key)
Removes the key if it exists.
|
@Deprecated public abstract TagContextBuilder put(TagKey key, TagValue value)
put(TagKey, TagValue, TagMetadata), or putLocal(TagKey, TagValue) if you only want in-process tags.For backwards-compatibility this method still produces propagating Tags.
Equivalent to calling put(key, value,
TagMetadata.create(TagTtl.UNLIMITED_PROPAGATION)).
key - the TagKey which will be set.value - the TagValue to set for the given key.public TagContextBuilder put(TagKey key, TagValue value, TagMetadata tagMetadata)
key - the TagKey which will be set.value - the TagValue to set for the given key.tagMetadata - the TagMetadata associated with this Tag.public final TagContextBuilder putLocal(TagKey key, TagValue value)
TagContextBuilder.
This is equivalent to calling put(key, value,
TagMetadata.create(TagTtl.NO_PROPAGATION)).
key - the TagKey which will be set.value - the TagValue to set for the given key.public final TagContextBuilder putPropagating(TagKey key, TagValue value)
TagContextBuilder.
This is equivalent to calling put(key, value,
TagMetadata.create(TagTtl.METADATA_UNLIMITED_PROPAGATION)).
Only call this method if you want propagating tags. If you want tags for breaking down
metrics, or there are sensitive messages in your tags, use putLocal(TagKey, TagValue)
instead.
key - the TagKey which will be set.value - the TagValue to set for the given key.public abstract TagContextBuilder remove(TagKey key)
key - the TagKey which will be removed.public abstract TagContext build()
TagContext from this builder.TagContext with the same tags as this builder.public abstract Scope buildScoped()
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.TagContext created from this builder
is set to the current context.