Package io.opencensus.implcore.stats
Class StatsComponentImplBase
- java.lang.Object
-
- io.opencensus.stats.StatsComponent
-
- io.opencensus.implcore.stats.StatsComponentImplBase
-
- Direct Known Subclasses:
StatsComponentImpl
,StatsComponentImplLite
public class StatsComponentImplBase extends StatsComponent
Base implementation ofStatsComponent
.
-
-
Field Summary
Fields Modifier and Type Field Description private CurrentState
currentState
private static CurrentState.State
DEFAULT_STATE
private StatsRecorderImpl
statsRecorder
private ViewManagerImpl
viewManager
-
Constructor Summary
Constructors Constructor Description StatsComponentImplBase(EventQueue queue, Clock clock)
Creates a newStatsComponentImplBase
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StatsCollectionState
getState()
Returns the currentStatsCollectionState
.StatsRecorderImpl
getStatsRecorder()
Returns the defaultStatsRecorder
.ViewManagerImpl
getViewManager()
Returns the defaultViewManager
.void
setState(StatsCollectionState newState)
Sets the currentStatsCollectionState
.private static StatsCollectionState
stateToStatsState(CurrentState.State state)
private static CurrentState.State
statsStateToState(StatsCollectionState statsCollectionState)
-
-
-
Field Detail
-
DEFAULT_STATE
private static final CurrentState.State DEFAULT_STATE
-
currentState
private final CurrentState currentState
-
viewManager
private final ViewManagerImpl viewManager
-
statsRecorder
private final StatsRecorderImpl statsRecorder
-
-
Constructor Detail
-
StatsComponentImplBase
public StatsComponentImplBase(EventQueue queue, Clock clock)
Creates a newStatsComponentImplBase
.- Parameters:
queue
- the queue implementation.clock
- the clock to use when recording stats.
-
-
Method Detail
-
getViewManager
public ViewManagerImpl getViewManager()
Description copied from class:StatsComponent
Returns the defaultViewManager
.- Specified by:
getViewManager
in classStatsComponent
-
getStatsRecorder
public StatsRecorderImpl getStatsRecorder()
Description copied from class:StatsComponent
Returns the defaultStatsRecorder
.- Specified by:
getStatsRecorder
in classStatsComponent
-
getState
public StatsCollectionState 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
public void setState(StatsCollectionState newState)
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
private static CurrentState.State statsStateToState(StatsCollectionState statsCollectionState)
-
stateToStatsState
private static StatsCollectionState stateToStatsState(CurrentState.State state)
-
-