Package io.opencensus.stats
Class Stats
java.lang.Object
io.opencensus.stats.Stats
Class for accessing the default
StatsComponent
.- Since:
- 0.8
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StatsCollectionState
getState()
Returns the currentStatsCollectionState
.static StatsRecorder
Returns the defaultStatsRecorder
.static ViewManager
Returns the defaultViewManager
.(package private) static StatsComponent
loadStatsComponent
(ClassLoader classLoader) static void
setState
(StatsCollectionState state) Deprecated.
-
Field Details
-
logger
-
statsComponent
-
-
Constructor Details
-
Stats
private Stats()
-
-
Method Details
-
getStatsRecorder
Returns the defaultStatsRecorder
.- Since:
- 0.8
-
getViewManager
Returns the defaultViewManager
.- Since:
- 0.8
-
getState
Returns the currentStatsCollectionState
.When no implementation is available,
getState
always 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 throwsIllegalStateException
aftergetState()
has been called, in order to limit changes to the result ofgetState()
.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.- Parameters:
state
- the newStatsCollectionState
.- Throws:
IllegalStateException
- ifgetState()
was previously called.- Since:
- 0.8
-
loadStatsComponent
-
getState()
, use a stale value, and behave incorrectly.