Class Tagger
java.lang.Object
io.opencensus.tags.Tagger
- Direct Known Subclasses:
NoopTags.NoopTagger, TaggerImpl
Object for creating new
TagContexts and TagContexts based on the current context.
This class returns builders that can be used to create the
implementation-dependent TagContexts.
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 TagContextBuilderReturns a new builder created from the currentTagContext.abstract TagContextempty()Returns an emptyTagContext.abstract TagContextBuilderReturns a new emptyBuilder.abstract TagContextReturns the currentTagContext.abstract TagContextBuildertoBuilder(TagContext tags) Returns a builder based on thisTagContext.abstract ScopewithTagContext(TagContext tags) Enters the scope of code where the givenTagContextis 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 givenTagContextis 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- theTagContextto be set to the current context.- Returns:
- an object that defines a scope where the given
TagContextis set to the current context. - Since:
- 0.8
-