core: use new OpenCensus stats/tagging API. (#3647)
This commit updates gRPC core to use io.opencensus:opencensus-api and
io.opencensus:opencensus-contrib-grpc-metrics instead of
com.google.instrumentation:instrumentation-api for stats and tagging. The gRPC
Monitoring Service continues to use instrumentation-api.
The main changes affecting gRPC:
- The StatsContextFactory is replaced by three objects, StatsRecorder, Tagger,
and TagContextBinarySerializer.
- The StatsRecorder, Tagger, and TagContextBinarySerializer are never null,
but the objects are no-ops when the OpenCensus implementation is not
available.
This commit includes changes written by @songy23 and @sebright.
diff --git a/core/build.gradle b/core/build.gradle
index b6cd5f5..74a31f3 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -19,6 +19,12 @@
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
+ compile (libraries.opencensus_contrib_grpc_metrics) {
+ // prefer 3.0.0 from libraries instead of 3.0.1
+ exclude group: 'com.google.code.findbugs', module: 'jsr305'
+ // we'll always be more up-to-date
+ exclude group: 'io.grpc', module: 'grpc-context'
+ }
testCompile project(':grpc-testing')