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.Object
Object for creating newTagContext
s andTagContext
s based on the current context.This class returns
builders
that can be used to create the implementation-dependentTagContext
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 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 TagContextBuilder
currentBuilder()
Returns a new builder created from the currentTagContext
.abstract TagContext
empty()
Returns an emptyTagContext
.abstract TagContextBuilder
emptyBuilder()
Returns a new emptyBuilder
.abstract TagContext
getCurrentTagContext()
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.
-
-
-
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 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
-
-