Package io.opencensus.stats
Class StatsComponent
- java.lang.Object
-
- io.opencensus.stats.StatsComponent
-
- Direct Known Subclasses:
NoopStats.NoopStatsComponent,StatsComponentImplBase
public abstract class StatsComponent extends java.lang.ObjectClass that holds the implementations forViewManagerandStatsRecorder.All objects returned by methods on
StatsComponentare cacheable.- Since:
- 0.8
-
-
Constructor Summary
Constructors Constructor Description StatsComponent()
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description abstract StatsCollectionStategetState()Returns the currentStatsCollectionState.abstract StatsRecordergetStatsRecorder()Returns the defaultStatsRecorder.abstract ViewManagergetViewManager()Returns the defaultViewManager.abstract voidsetState(StatsCollectionState state)Deprecated.This method is deprecated because other libraries could cache the result ofgetState(), use a stale value, and behave incorrectly.
-
-
-
Method Detail
-
getViewManager
public abstract ViewManager getViewManager()
Returns the defaultViewManager.- Since:
- 0.8
-
getStatsRecorder
public abstract StatsRecorder getStatsRecorder()
Returns the defaultStatsRecorder.- Since:
- 0.8
-
getState
public abstract StatsCollectionState 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 public abstract void setState(StatsCollectionState state)
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:
java.lang.IllegalStateException- ifgetState()was previously called.- Since:
- 0.8
-
-