Package io.opencensus.implcore.stats
Class StatsComponentImplBase
java.lang.Object
io.opencensus.stats.StatsComponent
io.opencensus.implcore.stats.StatsComponentImplBase
- Direct Known Subclasses:
StatsComponentImpl
,StatsComponentImplLite
Base implementation of
StatsComponent
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CurrentState
private static final CurrentState.State
private final StatsRecorderImpl
private final ViewManagerImpl
-
Constructor Summary
ConstructorsConstructorDescriptionStatsComponentImplBase
(EventQueue queue, Clock clock) Creates a newStatsComponentImplBase
. -
Method Summary
Modifier and TypeMethodDescriptiongetState()
Returns the currentStatsCollectionState
.Returns the defaultStatsRecorder
.Returns the defaultViewManager
.void
setState
(StatsCollectionState newState) Sets the currentStatsCollectionState
.private static StatsCollectionState
private static CurrentState.State
statsStateToState
(StatsCollectionState statsCollectionState)
-
Field Details
-
DEFAULT_STATE
-
currentState
-
viewManager
-
statsRecorder
-
-
Constructor Details
-
StatsComponentImplBase
Creates a newStatsComponentImplBase
.- Parameters:
queue
- the queue implementation.clock
- the clock to use when recording stats.
-
-
Method Details
-
getViewManager
Description copied from class:StatsComponent
Returns the defaultViewManager
.- Specified by:
getViewManager
in classStatsComponent
-
getStatsRecorder
Description copied from class:StatsComponent
Returns the defaultStatsRecorder
.- Specified by:
getStatsRecorder
in classStatsComponent
-
getState
Description copied from class:StatsComponent
Returns the currentStatsCollectionState
.When no implementation is available,
getState
always returnsStatsCollectionState.DISABLED
.Once
StatsComponent.getState()
is called, subsequent calls toStatsComponent.setState(StatsCollectionState)
will throw anIllegalStateException
.- Specified by:
getState
in classStatsComponent
- Returns:
- the current
StatsCollectionState
.
-
setState
Description copied from class:StatsComponent
Sets the currentStatsCollectionState
.When no implementation is available,
setState
does not change the state.If state is set to
StatsCollectionState.DISABLED
, all stats that are previously recorded will be cleared.- Specified by:
setState
in classStatsComponent
- Parameters:
newState
- the newStatsCollectionState
.
-
statsStateToState
-
stateToStatsState
-