Class StatsComponent
java.lang.Object
io.opencensus.stats.StatsComponent
- Direct Known Subclasses:
NoopStats.NoopStatsComponent, StatsComponentImplBase
Class that holds the implementations for
ViewManager and StatsRecorder.
All objects returned by methods on StatsComponent are cacheable.
- Since:
- 0.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StatsCollectionStategetState()Returns the currentStatsCollectionState.abstract StatsRecorderReturns the defaultStatsRecorder.abstract ViewManagerReturns the defaultViewManager.abstract voidsetState(StatsCollectionState state) Deprecated.
-
Constructor Details
-
StatsComponent
public StatsComponent()
-
-
Method Details
-
getViewManager
-
getStatsRecorder
-
getState
Returns the currentStatsCollectionState.When no implementation is available,
getStatealways returnsStatsCollectionState.DISABLED.Once
getState()is called, subsequent calls tosetState(StatsCollectionState)will throw anIllegalStateException.- Returns:
- the current
StatsCollectionState. - Since:
- 0.8
-
setState
Deprecated.This method is deprecated because other libraries could cache the result ofgetState(), use a stale value, and behave incorrectly. It is only safe to call early in initialization. This method throwsIllegalStateExceptionaftergetState()has been called, in order to limit changes to the result ofgetState().Sets 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.- Parameters:
state- the newStatsCollectionState.- Throws:
IllegalStateException- ifgetState()was previously called.- Since:
- 0.8
-
getState(), use a stale value, and behave incorrectly.