Package io.opencensus.tags
Class Tagger
- java.lang.Object
-
- io.opencensus.tags.Tagger
-
- Direct Known Subclasses:
NoopTags.NoopTagger,TaggerImpl
public abstract class Tagger extends java.lang.ObjectObject for creating newTagContexts andTagContexts based on the current context.This class returns
buildersthat can be used to create the implementation-dependentTagContexts.Implementations may have different constraints and are free to convert tag contexts to their own subtypes. This means callers cannot assume the
current contextis the same instance as the oneplaced into scope.- Since:
- 0.8
-
-
Constructor Summary
Constructors Constructor Description Tagger()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract TagContextBuildercurrentBuilder()Returns a new builder created from the currentTagContext.abstract TagContextempty()Returns an emptyTagContext.abstract TagContextBuilderemptyBuilder()Returns a new emptyBuilder.abstract TagContextgetCurrentTagContext()Returns 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.
-
-
-
Method Detail
-
empty
public abstract TagContext empty()
Returns an emptyTagContext.- Returns:
- an empty
TagContext. - Since:
- 0.8
-
getCurrentTagContext
public abstract TagContext getCurrentTagContext()
Returns the currentTagContext.- Returns:
- the current
TagContext. - Since:
- 0.8
-
emptyBuilder
public abstract TagContextBuilder emptyBuilder()
Returns a new emptyBuilder.- Returns:
- a new empty
Builder. - Since:
- 0.8
-
toBuilder
public abstract TagContextBuilder toBuilder(TagContext tags)
Returns a builder based on thisTagContext.- Returns:
- a builder based on this
TagContext. - Since:
- 0.8
-
currentBuilder
public abstract TagContextBuilder currentBuilder()
Returns a new builder created from the currentTagContext.- Returns:
- a new builder created from the current
TagContext. - Since:
- 0.8
-
withTagContext
public abstract Scope withTagContext(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. 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
-
-