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 CurrentStatecurrentStateprivate static CurrentState.StateDEFAULT_STATEprivate StatsRecorderImplstatsRecorderprivate ViewManagerImplviewManager
-
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 StatsCollectionStategetState()Returns the currentStatsCollectionState.StatsRecorderImplgetStatsRecorder()Returns the defaultStatsRecorder.ViewManagerImplgetViewManager()Returns the defaultViewManager.voidsetState(StatsCollectionState newState)Sets the currentStatsCollectionState.private static StatsCollectionStatestateToStatsState(CurrentState.State state)private static CurrentState.StatestatsStateToState(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:StatsComponentReturns the defaultViewManager.- Specified by:
getViewManagerin classStatsComponent
-
getStatsRecorder
public StatsRecorderImpl getStatsRecorder()
Description copied from class:StatsComponentReturns the defaultStatsRecorder.- Specified by:
getStatsRecorderin classStatsComponent
-
getState
public StatsCollectionState getState()
Description copied from class:StatsComponentReturns the currentStatsCollectionState.When no implementation is available,
getStatealways returnsStatsCollectionState.DISABLED.Once
StatsComponent.getState()is called, subsequent calls toStatsComponent.setState(StatsCollectionState)will throw anIllegalStateException.- Specified by:
getStatein classStatsComponent- Returns:
- the current
StatsCollectionState.
-
setState
public void setState(StatsCollectionState newState)
Description copied from class:StatsComponentSets the currentStatsCollectionState.When no implementation is available,
setStatedoes not change the state.If state is set to
StatsCollectionState.DISABLED, all stats that are previously recorded will be cleared.- Specified by:
setStatein classStatsComponent- Parameters:
newState- the newStatsCollectionState.
-
statsStateToState
private static CurrentState.State statsStateToState(StatsCollectionState statsCollectionState)
-
stateToStatsState
private static StatsCollectionState stateToStatsState(CurrentState.State state)
-
-