Provide a way to determine whether tags, stats, or trace classes are no-op implementations.
The no-op implementations can often be used to avoid unnecessary if statements, but it is important to be able to check whether they are no-op when necessary.
See https://github.com/census-instrumentation/opencensus-java/issues/215#issuecomment-296304442
This probably should apply to all.
This probably should apply to all.
I'm not sure I understand. Do you mean all of stats, tags, and tracing, or all classes?
#659 adds a getState method to Tags and TagsComponent.
Even if we have getState and setState methods, users may want to be able to check whether setState(ENABLED) will be ignored. See the discussions in #659 and #673.
@bogdandrutu Do you have any examples of use cases where users would want to distinguish between the no-op implementation and functionality turned off programmatically?
One use case for checking whether the implementation is available is performance optimizations that rely on stats, tagging, and tracing never being turned on at runtime. For example, @zhangkun83 mentioned that gRPC could skip initializing the CensusStatsModule if there was no implementation.
Another use case is allowing libraries that depend on OpenCensus functionality to report a more specific error when an implementation isn't available.