Package io.opencensus.stats
Class Stats
- java.lang.Object
-
- io.opencensus.stats.Stats
-
public final class Stats extends java.lang.ObjectClass for accessing the defaultStatsComponent.- Since:
- 0.8
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Loggerloggerprivate static StatsComponentstatsComponent
-
Constructor Summary
Constructors Modifier Constructor Description privateStats()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StatsCollectionStategetState()Returns the currentStatsCollectionState.static StatsRecordergetStatsRecorder()Returns the defaultStatsRecorder.static ViewManagergetViewManager()Returns the defaultViewManager.(package private) static StatsComponentloadStatsComponent(java.lang.ClassLoader classLoader)static voidsetState(StatsCollectionState state)Deprecated.This method is deprecated because other libraries could cache the result ofgetState(), use a stale value, and behave incorrectly.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
statsComponent
private static final StatsComponent statsComponent
-
-
Method Detail
-
getStatsRecorder
public static StatsRecorder getStatsRecorder()
Returns the defaultStatsRecorder.- Since:
- 0.8
-
getViewManager
public static ViewManager getViewManager()
Returns the defaultViewManager.- Since:
- 0.8
-
getState
public static 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 static 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
-
loadStatsComponent
static StatsComponent loadStatsComponent(@Nullable java.lang.ClassLoader classLoader)
-
-