Package io.opencensus.tags
Class Tagger
java.lang.Object
io.opencensus.tags.Tagger
- Direct Known Subclasses:
NoopTags.NoopTagger
,TaggerImpl
Object for creating new
TagContext
s and TagContext
s based on the current context.
This class returns builders
that can be used to create the
implementation-dependent TagContext
s.
Implementations may have different constraints and are free to convert tag contexts to their
own subtypes. This means callers cannot assume the current
context
is the same instance as the one placed into scope
.
- Since:
- 0.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TagContextBuilder
Returns a new builder created from the currentTagContext
.abstract TagContext
empty()
Returns an emptyTagContext
.abstract TagContextBuilder
Returns a new emptyBuilder
.abstract TagContext
Returns the currentTagContext
.abstract TagContextBuilder
toBuilder
(TagContext tags) Returns a builder based on thisTagContext
.abstract Scope
withTagContext
(TagContext tags) Enters the scope of code where the givenTagContext
is in the current context (replacing the previousTagContext
) and returns an object that represents that scope.
-
Constructor Details
-
Tagger
public Tagger()
-
-
Method Details
-
empty
Returns an emptyTagContext
.- Returns:
- an empty
TagContext
. - Since:
- 0.8
-
getCurrentTagContext
Returns the currentTagContext
.- Returns:
- the current
TagContext
. - Since:
- 0.8
-
emptyBuilder
Returns a new emptyBuilder
.- Returns:
- a new empty
Builder
. - Since:
- 0.8
-
toBuilder
Returns a builder based on thisTagContext
.- Returns:
- a builder based on this
TagContext
. - Since:
- 0.8
-
currentBuilder
Returns a new builder created from the currentTagContext
.- Returns:
- a new builder created from the current
TagContext
. - Since:
- 0.8
-
withTagContext
Enters the scope of code where the givenTagContext
is in the current context (replacing the previousTagContext
) and returns an object that represents that scope. The scope is exited when the returned object is closed.- Parameters:
tags
- theTagContext
to be set to the current context.- Returns:
- an object that defines a scope where the given
TagContext
is set to the current context. - Since:
- 0.8
-