aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/BUILD.bazel155
-rw-r--r--examples/README.md113
-rw-r--r--examples/WORKSPACE53
-rw-r--r--examples/build.gradle154
-rw-r--r--examples/gradle/wrapper/gradle-wrapper.jarbin0 -> 54417 bytes
-rw-r--r--examples/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradlew172
-rw-r--r--examples/gradlew.bat84
-rw-r--r--examples/opencensus_workspace.bzl1680
-rw-r--r--examples/pom.xml169
-rw-r--r--examples/settings.gradle1
-rw-r--r--examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java151
-rw-r--r--examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldServer.java176
-rw-r--r--examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldUtils.java50
-rw-r--r--examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java111
-rw-r--r--examples/src/main/java/io/opencensus/examples/tags/TagContextExample.java77
-rw-r--r--examples/src/main/java/io/opencensus/examples/trace/MultiSpansContextTracing.java89
-rw-r--r--examples/src/main/java/io/opencensus/examples/trace/MultiSpansScopedTracing.java85
-rw-r--r--examples/src/main/java/io/opencensus/examples/trace/MultiSpansTracing.java72
-rw-r--r--examples/src/main/java/io/opencensus/examples/trace/Utils.java37
-rw-r--r--examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java108
-rw-r--r--examples/src/main/proto/helloworld.proto39
22 files changed, 3581 insertions, 0 deletions
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel
new file mode 100644
index 00000000..a93cefd0
--- /dev/null
+++ b/examples/BUILD.bazel
@@ -0,0 +1,155 @@
+load("//:opencensus_workspace.bzl", "opencensus_java_libraries")
+load("@grpc_java//:java_grpc_library.bzl", "java_grpc_library")
+
+opencensus_java_libraries()
+
+proto_library(
+ name = "helloworld_proto",
+ srcs = ["src/main/proto/helloworld.proto"],
+)
+
+java_proto_library(
+ name = "helloworld_java_proto",
+ deps = [":helloworld_proto"],
+)
+
+java_grpc_library(
+ name = "helloworld_java_grpc",
+ srcs = [":helloworld_proto"],
+ deps = [":helloworld_java_proto"],
+)
+
+java_library(
+ name = "opencensus_examples",
+ srcs = glob(
+ ["src/main/java/**/*.java"],
+ ),
+ deps = [
+ ":helloworld_java_grpc",
+ ":helloworld_java_proto",
+ "@com_google_guava_guava//jar",
+ "@com_google_code_findbugs_jsr305//jar",
+ "@io_opencensus_opencensus_api//jar",
+ "@io_opencensus_opencensus_contrib_grpc_metrics//jar",
+ "@io_opencensus_opencensus_contrib_zpages//jar",
+ "@io_opencensus_opencensus_exporter_stats_prometheus//jar",
+ "@io_opencensus_opencensus_exporter_stats_stackdriver//jar",
+ "@io_opencensus_opencensus_exporter_trace_logging//jar",
+ "@io_opencensus_opencensus_exporter_trace_stackdriver//jar",
+ "@io_grpc_grpc_core//jar",
+ "@io_grpc_grpc_netty//jar",
+ "@io_grpc_grpc_protobuf//jar",
+ "@io_grpc_grpc_stub//jar",
+ "@io_prometheus_simpleclient//jar",
+ "@io_prometheus_simpleclient_httpserver//jar",
+ ],
+ runtime_deps = [
+ "@com_google_api_api_common//jar",
+ "@com_google_api_gax//jar",
+ "@com_google_api_gax_grpc//jar",
+ "@com_google_api_grpc_proto_google_cloud_trace_v1//jar",
+ "@com_google_api_grpc_proto_google_cloud_trace_v2//jar",
+ "@com_google_api_grpc_proto_google_iam_v1//jar",
+ "@com_google_api_grpc_proto_google_cloud_monitoring_v3//jar",
+ "@com_google_api_grpc_proto_google_common_protos//jar",
+ "@com_google_auth_google_auth_library_credentials//jar",
+ "@com_google_auth_google_auth_library_oauth2_http//jar",
+ "@com_google_cloud_google_cloud_core//jar",
+ "@com_google_cloud_google_cloud_core_grpc//jar",
+ "@com_google_cloud_google_cloud_monitoring//jar",
+ "@com_google_cloud_google_cloud_trace//jar",
+ "@com_google_http_client_google_http_client//jar",
+ "@com_google_http_client_google_http_client_jackson2//jar",
+ "@com_google_instrumentation_instrumentation_api//jar",
+ "@com_google_protobuf_protobuf_java//jar",
+ "@com_google_protobuf_protobuf_java_util//jar",
+ "@commons_codec_commons_codec//jar",
+ "@commons_logging_commons_logging//jar",
+
+ "@com_lmax_disruptor//jar",
+ "@io_grpc_grpc_context//jar",
+ "@io_grpc_grpc_auth//jar",
+ "@io_grpc_grpc_protobuf_lite//jar",
+ "@io_netty_netty_buffer//jar",
+ "@io_netty_netty_common//jar",
+ "@io_netty_netty_codec//jar",
+ "@io_netty_netty_codec_socks//jar",
+ "@io_netty_netty_codec_http//jar",
+ "@io_netty_netty_codec_http2//jar",
+ "@io_netty_netty_handler//jar",
+ "@io_netty_netty_handler_proxy//jar",
+ "@io_netty_netty_resolver//jar",
+ "@io_netty_netty_tcnative_boringssl_static//jar",
+ "@io_netty_netty_transport//jar",
+ "@io_opencensus_opencensus_impl//jar",
+ "@io_opencensus_opencensus_impl_core//jar",
+ "@joda_time_joda_time//jar",
+ "@org_apache_httpcomponents_httpclient//jar",
+ "@org_apache_httpcomponents_httpcore//jar",
+ "@org_threeten_threetenbp//jar",
+ ],
+)
+
+java_binary(
+ name = "TagContextExample",
+ main_class = "io.opencensus.examples.tags.TagContextExample",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "MultiSpansTracing",
+ main_class = "io.opencensus.examples.trace.MultiSpansTracing",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "MultiSpansScopedTracing",
+ main_class = "io.opencensus.examples.trace.MultiSpansScopedTracing",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "MultiSpansContextTracing",
+ main_class = "io.opencensus.examples.trace.MultiSpansContextTracing",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "ZPagesTester",
+ main_class = "io.opencensus.examples.zpages.ZPagesTester",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "QuickStart",
+ main_class = "io.opencensus.examples.helloworld.QuickStart",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "HelloWorldClient",
+ main_class = "io.opencensus.examples.grpc.helloworld.HelloWorldClient",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
+
+java_binary(
+ name = "HelloWorldServer",
+ main_class = "io.opencensus.examples.grpc.helloworld.HelloWorldServer",
+ runtime_deps = [
+ ":opencensus_examples",
+ ],
+)
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 00000000..921691b7
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,113 @@
+# OpenCensus Examples
+
+## To build the examples use
+
+### Gradle
+```
+$ ./gradlew installDist
+```
+
+### Maven
+```
+$ mvn package appassembler:assemble
+```
+
+### Bazel
+```
+$ bazel build :all
+```
+
+## To run "TagContextExample" use
+
+### Gradle
+```
+$ ./build/install/opencensus-examples/bin/TagContextExample
+```
+
+### Maven
+```
+$ ./target/appassembler/bin/TagContextExample
+```
+
+### Bazel
+```
+$ ./bazel-bin/TagContextExample
+```
+
+## To run "ZPagesTester"
+
+### Gradle
+```
+$ ./build/install/opencensus-examples/bin/ZPagesTester
+```
+
+### Maven
+```
+$ ./target/appassembler/bin/ZPagesTester
+```
+
+### Bazel
+```
+$ ./bazel-bin/ZPagesTester
+```
+
+Available pages:
+* For tracing page go to [localhost:8080/tracez][ZPagesTraceZLink].
+* For tracing config page go to [localhost:8080/traceconfigz][ZPagesTraceConfigZLink].
+* For RPC stats page go to [localhost:8080/rpcz][ZPagesRpcZLink].
+* For stats and measures on all registered views go to [localhost:8080/statsz][ZPagesStatsZLink].
+
+[ZPagesTraceZLink]: http://localhost:8080/tracez
+[ZPagesTraceConfigZLink]: http://localhost:8080/traceconfigz
+[ZPagesRpcZLink]: http://localhost:8080/rpcz
+[ZPagesStatsZLink]: http://localhost:8080/statsz
+
+## To run "QuickStart" example use
+
+### Gradle
+```
+$ ./build/install/opencensus-examples/bin/QuickStart
+```
+
+### Maven
+```
+$ ./target/appassembler/bin/QuickStart
+```
+
+### Bazel
+```
+$ ./bazel-bin/QuickStart
+```
+
+## To run "gRPC Hello World" example use
+
+Please note all the arguments are optional. If you do not specify these arguments, default values
+will be used:
+
+* host and serverPort will be "localhost:50051"
+* user will be "world"
+* cloudProjectId will be null (which means no stats/spans will be exported to Stackdriver)
+* server zPagePort will be 3000
+* client zPagePort will be 3001
+* Prometheus port will be 9090
+
+
+However, if you want to specify any of these arguements, please make sure they are in order.
+
+### Gradle
+```
+$ ./build/install/opencensus-examples/bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort
+$ ./build/install/opencensus-examples/bin/HelloWorldClient user host serverPort cloudProjectId zPagePort
+```
+
+### Maven
+```
+$ ./target/appassembler/bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort
+$ ./target/appassembler/bin/HelloWorldClient user host serverPort cloudProjectId zPagePort
+```
+
+### Bazel
+```
+$ ./bazel-bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort
+$ ./bazel-bin/HelloWorldClient user host serverPort cloudProjectId zPagePort
+```
diff --git a/examples/WORKSPACE b/examples/WORKSPACE
new file mode 100644
index 00000000..a065f962
--- /dev/null
+++ b/examples/WORKSPACE
@@ -0,0 +1,53 @@
+workspace(name = "opencensus_examples")
+
+git_repository(
+ name = "grpc_java",
+ remote = "https://github.com/grpc/grpc-java.git",
+ tag = "v1.10.1",
+)
+
+load("//:opencensus_workspace.bzl", "opencensus_maven_jars")
+load("@grpc_java//:repositories.bzl", "grpc_java_repositories")
+
+opencensus_maven_jars()
+grpc_java_repositories(
+ # Omit to avoid conflicts.
+
+ omit_com_google_auth_google_auth_library_credentials=True,
+ omit_com_google_api_grpc_google_common_protos=True,
+ omit_com_google_code_findbugs_jsr305=True,
+ omit_com_google_code_gson=True,
+ omit_com_google_errorprone_error_prone_annotations=True,
+ omit_com_google_guava=True,
+ omit_com_google_protobuf=True,
+ omit_com_google_protobuf_nano_protobuf_javanano=True,
+ omit_com_google_truth_truth=True,
+ omit_com_squareup_okhttp=True,
+ omit_com_squareup_okio=True,
+
+ # These netty dependencies have already been included in opencensus_workspace.bzl
+ omit_io_netty_buffer=True,
+ omit_io_netty_common=True,
+ omit_io_netty_handler_proxy=True,
+ omit_io_netty_codec_http2=True,
+ omit_io_netty_transport=True,
+ omit_io_netty_codec=True,
+ omit_io_netty_codec_socks=True,
+ omit_io_netty_codec_http=True,
+ omit_io_netty_handler=True,
+ omit_io_netty_resolver=True,
+
+ omit_io_opencensus_api=True,
+ omit_io_opencensus_grpc_metrics=True,
+ omit_junit_junit=True
+)
+
+# proto_library, cc_proto_library, and java_proto_library rules implicitly
+# depend on @com_google_protobuf for protoc and proto runtimes.
+# This statement defines the @com_google_protobuf repo.
+http_archive(
+ name = "com_google_protobuf",
+ sha256 = "1f8b9b202e9a4e467ff0b0f25facb1642727cdf5e69092038f15b37c75b99e45",
+ strip_prefix = "protobuf-3.5.1",
+ urls = ["https://github.com/google/protobuf/archive/v3.5.1.zip"],
+)
diff --git a/examples/build.gradle b/examples/build.gradle
new file mode 100644
index 00000000..22889e10
--- /dev/null
+++ b/examples/build.gradle
@@ -0,0 +1,154 @@
+description = 'OpenCensus Examples'
+
+buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
+ }
+ dependencies {
+ classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
+ }
+}
+
+apply plugin: 'idea'
+apply plugin: 'java'
+apply plugin: 'com.google.protobuf'
+
+repositories {
+ mavenCentral()
+ mavenLocal()
+}
+
+group = "io.opencensus"
+version = "0.17.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION
+
+def opencensusVersion = "0.16.1" // LATEST_OPENCENSUS_RELEASE_VERSION
+def grpcVersion = "1.13.1" // CURRENT_GRPC_VERSION
+def prometheusVersion = "0.3.0"
+
+tasks.withType(JavaCompile) {
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
+}
+
+dependencies {
+ compile "com.google.api.grpc:proto-google-common-protos:1.11.0",
+ "io.opencensus:opencensus-api:${opencensusVersion}",
+ "io.opencensus:opencensus-contrib-zpages:${opencensusVersion}",
+ "io.opencensus:opencensus-contrib-grpc-metrics:${opencensusVersion}",
+ "io.opencensus:opencensus-exporter-stats-prometheus:${opencensusVersion}",
+ "io.opencensus:opencensus-exporter-stats-stackdriver:${opencensusVersion}",
+ "io.opencensus:opencensus-exporter-trace-stackdriver:${opencensusVersion}",
+ "io.opencensus:opencensus-exporter-trace-logging:${opencensusVersion}",
+ "io.grpc:grpc-protobuf:${grpcVersion}",
+ "io.grpc:grpc-stub:${grpcVersion}",
+ "io.grpc:grpc-netty:${grpcVersion}",
+ "io.prometheus:simpleclient_httpserver:${prometheusVersion}"
+
+ runtime "io.opencensus:opencensus-impl:${opencensusVersion}",
+ "io.netty:netty-tcnative-boringssl-static:2.0.8.Final"
+}
+
+protobuf {
+ protoc {
+ artifact = 'com.google.protobuf:protoc:3.5.1-1'
+ }
+ plugins {
+ grpc {
+ artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
+ }
+ }
+ generateProtoTasks {
+ all()*.plugins {
+ grpc {}
+ }
+ ofSourceSet('main')
+ }
+}
+
+// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
+sourceSets {
+ main {
+ java {
+ srcDir 'src'
+ srcDirs 'build/generated/source/proto/main/grpc'
+ srcDirs 'build/generated/source/proto/main/java'
+ }
+ }
+}
+
+// Provide convenience executables for trying out the examples.
+apply plugin: 'application'
+
+startScripts.enabled = false
+
+task tagContextExample(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.tags.TagContextExample'
+ applicationName = 'TagContextExample'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task multiSpansTracing(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.trace.MultiSpansTracing'
+ applicationName = 'MultiSpansTracing'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task multiSpansScopedTracing(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.trace.MultiSpansScopedTracing'
+ applicationName = 'MultiSpansScopedTracing'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task multiSpansContextTracing(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.trace.MultiSpansContextTracing'
+ applicationName = 'MultiSpansContextTracing'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task zPagesTester(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.zpages.ZPagesTester'
+ applicationName = 'ZPagesTester'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task quickStart(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.helloworld.QuickStart'
+ applicationName = 'QuickStart'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task helloWorldServer(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.grpc.helloworld.HelloWorldServer'
+ applicationName = 'HelloWorldServer'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+task helloWorldClient(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.grpc.helloworld.HelloWorldClient'
+ applicationName = 'HelloWorldClient'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
+applicationDistribution.into('bin') {
+ from(multiSpansTracing)
+ from(multiSpansScopedTracing)
+ from(multiSpansContextTracing)
+ from(tagContextExample)
+ from(zPagesTester)
+ from(quickStart)
+ from(helloWorldServer)
+ from(helloWorldClient)
+ fileMode = 0755
+}
diff --git a/examples/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..758de960
--- /dev/null
+++ b/examples/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/examples/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..a95009c3
--- /dev/null
+++ b/examples/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/examples/gradlew b/examples/gradlew
new file mode 100755
index 00000000..cccdd3d5
--- /dev/null
+++ b/examples/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/examples/gradlew.bat b/examples/gradlew.bat
new file mode 100644
index 00000000..e95643d6
--- /dev/null
+++ b/examples/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/examples/opencensus_workspace.bzl b/examples/opencensus_workspace.bzl
new file mode 100644
index 00000000..ce382cd2
--- /dev/null
+++ b/examples/opencensus_workspace.bzl
@@ -0,0 +1,1680 @@
+# The following dependencies were calculated from:
+#
+# generate_workspace --artifact=com.google.guava:guava-jdk5:23.0 --artifact=com.google.guava:guava:23.0 --artifact=io.grpc:grpc-all:1.9.0 --artifact=io.opencensus:opencensus-api:0.16.1 --artifact=io.opencensus:opencensus-contrib-grpc-metrics:0.16.1 --artifact=io.opencensus:opencensus-contrib-zpages:0.16.1 --artifact=io.opencensus:opencensus-exporter-stats-prometheus:0.16.1 --artifact=io.opencensus:opencensus-exporter-stats-stackdriver:0.16.1 --artifact=io.opencensus:opencensus-exporter-trace-logging:0.16.1 --artifact=io.opencensus:opencensus-exporter-trace-stackdriver:0.16.1 --artifact=io.opencensus:opencensus-impl:0.16.1 --artifact=io.prometheus:simpleclient_httpserver:0.3.0 --repositories=http://repo.maven.apache.org/maven2
+
+
+def opencensus_maven_jars():
+ # io.opencensus:opencensus-api:jar:0.10.0 wanted version 3.0.1
+ # io.grpc:grpc-core:jar:1.9.0 wanted version 3.0.0
+ # com.google.guava:guava:bundle:23.0
+ # com.google.instrumentation:instrumentation-api:jar:0.4.3 wanted version 3.0.0
+ # io.opencensus:opencensus-contrib-grpc-metrics:jar:0.10.0 wanted version 3.0.1
+ native.maven_jar(
+ name = "com_google_code_findbugs_jsr305",
+ artifact = "com.google.code.findbugs:jsr305:2.0.2",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "516c03b21d50a644d538de0f0369c620989cd8f0",
+ )
+
+
+ # io.grpc:grpc-protobuf:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_protobuf_lite",
+ artifact = "io.grpc:grpc-protobuf-lite:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9dc9c6531ae0b304581adff0e9b7cff21a4073ac",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_exporter_stats_prometheus",
+ artifact = "io.opencensus:opencensus-exporter-stats-prometheus:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "c1e9fc26da3060dde5a5948fd065c1b28cd10f39",
+ )
+
+
+ # com.google.api:gax-grpc:jar:1.30.0 got requested version
+ # com.google.api:gax:jar:1.30.0
+ native.maven_jar(
+ name = "com_google_auth_google_auth_library_oauth2_http",
+ artifact = "com.google.auth:google-auth-library-oauth2-http:0.10.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "c079a62086121973a23d90f54e2b8c13050fa39d",
+ )
+
+
+ # io.netty:netty-handler-proxy:jar:4.1.17.Final got requested version
+ # io.netty:netty-codec:jar:4.1.17.Final
+ # io.netty:netty-handler:jar:4.1.17.Final got requested version
+ native.maven_jar(
+ name = "io_netty_netty_transport",
+ artifact = "io.netty:netty-transport:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9585776b0a8153182412b5d5366061ff486914c1",
+ )
+
+
+ # io.grpc:grpc-netty:jar:1.9.0
+ native.maven_jar(
+ name = "io_netty_netty_handler_proxy",
+ artifact = "io.netty:netty-handler-proxy:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9330ee60c4e48ca60aac89b7bc5ec2567e84f28e",
+ )
+
+
+ # io.grpc:grpc-all:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_protobuf_nano",
+ artifact = "io.grpc:grpc-protobuf-nano:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "561b03d3fd5178117a51f9f7ef9d9e5442ed2348",
+ )
+
+
+ # io.opencensus:opencensus-exporter-trace-stackdriver:jar:0.16.1
+ native.maven_jar(
+ name = "com_google_cloud_google_cloud_trace",
+ artifact = "com.google.cloud:google-cloud-trace:0.58.0-beta",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ea715c51340a32106ffdf32375a5dad9dbdf160e",
+ )
+
+
+ # org.apache.httpcomponents:httpclient:jar:4.5.3
+ native.maven_jar(
+ name = "commons_codec_commons_codec",
+ artifact = "commons-codec:commons-codec:1.9",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9ce04e34240f674bc72680f8b843b1457383161a",
+ )
+
+
+ # io.opencensus:opencensus-impl:jar:0.16.1
+ native.maven_jar(
+ name = "io_opencensus_opencensus_impl_core",
+ artifact = "io.opencensus:opencensus-impl-core:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "a87fc041f66b8c923e2a1de6b7c1582b7990fde8",
+ )
+
+
+ # io.prometheus:simpleclient_httpserver:bundle:0.4.0
+ native.maven_jar(
+ name = "io_prometheus_simpleclient_common",
+ artifact = "io.prometheus:simpleclient_common:0.3.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "c9656d515d3a7647407f2c221d56be13177b82a0",
+ )
+
+
+ # com.google.api:gax-grpc:jar:1.30.0 got requested version
+ # com.google.api:gax:jar:1.30.0
+ native.maven_jar(
+ name = "org_threeten_threetenbp",
+ artifact = "org.threeten:threetenbp:1.3.3",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "3ea31c96676ff12ab56be0b1af6fff61d1a4f1f2",
+ )
+
+
+ # io.grpc:grpc-core:jar:1.9.0 wanted version 2.1.2
+ # io.opencensus:opencensus-contrib-grpc-metrics:jar:0.10.0 wanted version 2.1.2
+ # com.google.guava:guava:bundle:23.0
+ # io.opencensus:opencensus-api:jar:0.10.0 wanted version 2.1.2
+ native.maven_jar(
+ name = "com_google_errorprone_error_prone_annotations",
+ artifact = "com.google.errorprone:error_prone_annotations:2.0.18",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "5f65affce1684999e2f4024983835efc3504012e",
+ )
+
+
+ # io.netty:netty-transport:jar:4.1.17.Final
+ native.maven_jar(
+ name = "io_netty_netty_resolver",
+ artifact = "io.netty:netty-resolver:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "8f386c80821e200f542da282ae1d3cde5cad8368",
+ )
+
+
+ # com.squareup.okhttp:okhttp:jar:2.5.0
+ # io.grpc:grpc-okhttp:jar:1.9.0 wanted version 1.13.0
+ native.maven_jar(
+ name = "com_squareup_okio_okio",
+ artifact = "com.squareup.okio:okio:1.6.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "98476622f10715998eacf9240d6b479f12c66143",
+ )
+
+
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 3.6.0
+ # io.grpc:grpc-protobuf:jar:1.9.0
+ # com.google.cloud:google-cloud-core:jar:1.40.0 wanted version 3.6.0
+ native.maven_jar(
+ name = "com_google_protobuf_protobuf_java_util",
+ artifact = "com.google.protobuf:protobuf-java-util:3.5.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "6e40a6a3f52455bd633aa2a0dba1a416e62b4575",
+ )
+
+
+ # io.grpc:grpc-auth:jar:1.9.0
+ # io.opencensus:opencensus-exporter-stats-stackdriver:jar:0.16.1 wanted version 0.10.0
+ # com.google.api:gax-grpc:jar:1.30.0 wanted version 0.10.0
+ # io.opencensus:opencensus-exporter-trace-stackdriver:jar:0.16.1 wanted version 0.10.0
+ # com.google.auth:google-auth-library-oauth2-http:jar:0.9.0 got requested version
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 0.10.0
+ native.maven_jar(
+ name = "com_google_auth_google_auth_library_credentials",
+ artifact = "com.google.auth:google-auth-library-credentials:0.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "8e2b181feff6005c9cbc6f5c1c1e2d3ec9138d46",
+ )
+
+
+ # com.google.api.grpc:proto-google-cloud-trace-v2:jar:0.23.0 got requested version
+ # com.google.api:gax:jar:1.30.0 got requested version
+ # com.google.api.grpc:proto-google-cloud-trace-v1:jar:0.23.0 got requested version
+ # com.google.api.grpc:proto-google-iam-v1:jar:0.12.0 wanted version 1.5.0
+ # com.google.api.grpc:proto-google-cloud-monitoring-v3:jar:1.22.0 got requested version
+ # com.google.cloud:google-cloud-core:jar:1.40.0
+ # com.google.api:gax-grpc:jar:1.30.0 got requested version
+ native.maven_jar(
+ name = "com_google_api_api_common",
+ artifact = "com.google.api:api-common:1.7.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ea59fb8b2450999345035dec8a6f472543391766",
+ )
+
+
+ # io.opencensus:opencensus-contrib-zpages:jar:0.16.1 got requested version
+ native.maven_jar(
+ name = "io_opencensus_opencensus_contrib_grpc_metrics",
+ artifact = "io.opencensus:opencensus-contrib-grpc-metrics:0.16.1",
+ sha1 = "f56b444e2766eaf597ee11c7501f0d6b9992395c",
+ )
+
+
+ # org.mockito:mockito-core:jar:1.9.5
+ native.maven_jar(
+ name = "org_objenesis_objenesis",
+ artifact = "org.objenesis:objenesis:1.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9b473564e792c2bdf1449da1f0b1b5bff9805704",
+ )
+
+
+ # io.netty:netty-buffer:jar:4.1.17.Final
+ # io.netty:netty-resolver:jar:4.1.17.Final got requested version
+ native.maven_jar(
+ name = "io_netty_netty_common",
+ artifact = "io.netty:netty-common:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "581c8ee239e4dc0976c2405d155f475538325098",
+ )
+
+
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta
+ native.maven_jar(
+ name = "com_google_api_grpc_proto_google_cloud_trace_v2",
+ artifact = "com.google.api.grpc:proto-google-cloud-trace-v2:0.23.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "4aa1bc7212d34791a02962092deafc43a7f4245e",
+ )
+
+
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta got requested version
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0 got requested version
+ native.maven_jar(
+ name = "io_grpc_grpc_netty_shaded",
+ artifact = "io.grpc:grpc-netty-shaded:1.13.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ccdc4f2c2791d93164c574fbfb90d614aa0849ae",
+ )
+
+
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta
+ native.maven_jar(
+ name = "com_google_api_grpc_proto_google_cloud_trace_v1",
+ artifact = "com.google.api.grpc:proto-google-cloud-trace-v1:0.23.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "848bb2c3b9d683dccc2a26d077015cdc71b7e343",
+ )
+
+
+ # io.grpc:grpc-all:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_okhttp",
+ artifact = "io.grpc:grpc-okhttp:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "4e7fbb9d3cd65848f42494de165b1c5839f69a8a",
+ )
+
+
+ # junit:junit:jar:4.12
+ native.maven_jar(
+ name = "org_hamcrest_hamcrest_core",
+ artifact = "org.hamcrest:hamcrest-core:1.3",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
+ )
+
+
+ # io.netty:netty-codec-http2:jar:4.1.17.Final
+ native.maven_jar(
+ name = "io_netty_netty_handler",
+ artifact = "io.netty:netty-handler:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "18c40ffb61a1d1979eca024087070762fdc4664a",
+ )
+
+
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_api_grpc_proto_google_cloud_monitoring_v3",
+ artifact = "com.google.api.grpc:proto-google-cloud-monitoring-v3:1.22.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "5b8746703e9d8f2937d4925a70b030cfc5bf00f6",
+ )
+
+
+ # com.google.auth:google-auth-library-oauth2-http:jar:0.9.0 wanted version 1.19.0
+ # com.google.cloud:google-cloud-core:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_http_client_google_http_client",
+ artifact = "com.google.http-client:google-http-client:1.24.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "396eac8d3fb1332675f82b208f48a469d64f3b4a",
+ )
+
+
+ native.maven_jar(
+ name = "io_prometheus_simpleclient_httpserver",
+ artifact = "io.prometheus:simpleclient_httpserver:0.3.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "a2c1aeecac28f5bfa9a92a67b071d246ac00bbec",
+ )
+
+
+ # io.grpc:grpc-core:jar:1.9.0
+ native.maven_jar(
+ name = "com_google_instrumentation_instrumentation_api",
+ artifact = "com.google.instrumentation:instrumentation-api:0.4.3",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "41614af3429573dc02645d541638929d877945a2",
+ )
+
+
+ # com.google.auth:google-auth-library-oauth2-http:jar:0.9.0
+ native.maven_jar(
+ name = "com_google_http_client_google_http_client_jackson2",
+ artifact = "com.google.http-client:google-http-client-jackson2:1.19.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "81dbf9795d387d5e80e55346582d5f2fb81a42eb",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_exporter_trace_logging",
+ artifact = "io.opencensus:opencensus-exporter-trace-logging:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "a3ca83ff7075c58e564aa029c35ccd8224616879",
+ )
+
+
+ # com.google.api:gax-grpc:jar:1.30.0 wanted version 1.13.1
+ # io.grpc:grpc-all:jar:1.9.0
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 1.13.1
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0 wanted version 1.13.1
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta wanted version 1.13.1
+ native.maven_jar(
+ name = "io_grpc_grpc_auth",
+ artifact = "io.grpc:grpc-auth:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "d2eadc6d28ebee8ec0cef74f882255e4069972ad",
+ )
+
+
+ # com.google.cloud:google-cloud-core:jar:1.40.0
+ # com.google.api:gax-grpc:jar:1.30.0 got requested version
+ native.maven_jar(
+ name = "com_google_api_gax",
+ artifact = "com.google.api:gax:1.30.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "58fa2feb11b092be0a6ebe705a28736f12374230",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_exporter_trace_stackdriver",
+ artifact = "io.opencensus:opencensus-exporter-trace-stackdriver:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "6ea1a99a5cc580f472fbddf34152b3dcd6929e88",
+ )
+
+
+ # com.google.guava:guava:bundle:23.0
+ native.maven_jar(
+ name = "com_google_j2objc_j2objc_annotations",
+ artifact = "com.google.j2objc:j2objc-annotations:1.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ed28ded51a8b1c6b112568def5f4b455e6809019",
+ )
+
+
+ # io.grpc:grpc-auth:jar:1.9.0
+ # io.grpc:grpc-protobuf:jar:1.9.0 got requested version
+ # io.grpc:grpc-okhttp:jar:1.9.0 got requested version
+ # io.grpc:grpc-stub:jar:1.9.0 got requested version
+ # io.grpc:grpc-protobuf-lite:jar:1.9.0 got requested version
+ # io.grpc:grpc-all:jar:1.9.0 got requested version
+ # io.grpc:grpc-protobuf-nano:jar:1.9.0 got requested version
+ # io.grpc:grpc-testing:jar:1.9.0 got requested version
+ # io.grpc:grpc-netty:jar:1.9.0 got requested version
+ # io.grpc:grpc-netty-shaded:jar:1.13.1 wanted version 1.13.1
+ native.maven_jar(
+ name = "io_grpc_grpc_core",
+ artifact = "io.grpc:grpc-core:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "cf76ab13d35e8bd5d0ffad6d82bb1ef1770f050c",
+ )
+
+
+ # io.opencensus:opencensus-exporter-stats-stackdriver:jar:0.16.1
+ # io.opencensus:opencensus-exporter-trace-stackdriver:jar:0.16.1 got requested version
+ native.maven_jar(
+ name = "io_opencensus_opencensus_contrib_monitored_resource_util",
+ artifact = "io.opencensus:opencensus-contrib-monitored-resource-util:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "9edb4161978ac89f99a69544bfdc71b018a2509d",
+ )
+
+
+ # com.google.cloud:google-cloud-core:jar:1.40.0
+ native.maven_jar(
+ name = "joda_time_joda_time",
+ artifact = "joda-time:joda-time:2.9.2",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "36d6e77a419cb455e6fd5909f6f96b168e21e9d0",
+ )
+
+
+ # io.grpc:grpc-testing:jar:1.9.0
+ native.maven_jar(
+ name = "org_mockito_mockito_core",
+ artifact = "org.mockito:mockito-core:1.9.5",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "c3264abeea62c4d2f367e21484fbb40c7e256393",
+ )
+
+
+ # org.apache.httpcomponents:httpclient:jar:4.5.3
+ native.maven_jar(
+ name = "org_apache_httpcomponents_httpcore",
+ artifact = "org.apache.httpcomponents:httpcore:4.4.6",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "e3fd8ced1f52c7574af952e2e6da0df8df08eb82",
+ )
+
+
+ # io.opencensus:opencensus-impl:jar:0.16.1
+ native.maven_jar(
+ name = "com_lmax_disruptor",
+ artifact = "com.lmax:disruptor:3.4.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "72fabfe8a183f53bf61e0303921b7a89d2e8daed",
+ )
+
+
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 3.6.0
+ # com.google.api.grpc:proto-google-cloud-trace-v1:jar:0.23.0 wanted version 3.6.0
+ # com.google.api.grpc:proto-google-cloud-monitoring-v3:jar:1.22.0 wanted version 3.6.0
+ # io.grpc:grpc-protobuf:jar:1.9.0
+ # com.google.api.grpc:proto-google-iam-v1:jar:0.12.0 got requested version
+ # com.google.protobuf:protobuf-java-util:bundle:3.5.1 got requested version
+ # com.google.api.grpc:proto-google-cloud-trace-v2:jar:0.23.0 wanted version 3.6.0
+ native.maven_jar(
+ name = "com_google_protobuf_protobuf_java",
+ artifact = "com.google.protobuf:protobuf-java:3.5.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "8c3492f7662fa1cbf8ca76a0f5eb1146f7725acd",
+ )
+
+
+ # io.grpc:grpc-okhttp:jar:1.9.0
+ native.maven_jar(
+ name = "com_squareup_okhttp_okhttp",
+ artifact = "com.squareup.okhttp:okhttp:2.5.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "4de2b4ed3445c37ec1720a7d214712e845a24636",
+ )
+
+
+ # io.grpc:grpc-testing:jar:1.9.0 got requested version
+ # com.google.api:gax-grpc:jar:1.30.0 wanted version 1.13.1
+ # io.grpc:grpc-all:jar:1.9.0
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 1.13.1
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0 wanted version 1.13.1
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta wanted version 1.13.1
+ native.maven_jar(
+ name = "io_grpc_grpc_stub",
+ artifact = "io.grpc:grpc-stub:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "20e310f888860a27dfa509a69eebb236417ee93f",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_impl",
+ artifact = "io.opencensus:opencensus-impl:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "f9b06bf8422ba3700346173524087d005725432e",
+ )
+
+
+ # com.google.api:gax-grpc:jar:1.30.0 wanted version 1.13.1
+ # io.grpc:grpc-all:jar:1.9.0
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 1.13.1
+ native.maven_jar(
+ name = "io_grpc_grpc_protobuf",
+ artifact = "io.grpc:grpc-protobuf:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "94ca247577e4cf1a38d5ac9d536ac1d426a1ccc5",
+ )
+
+
+ # io.netty:netty-handler-proxy:jar:4.1.17.Final
+ native.maven_jar(
+ name = "io_netty_netty_codec_socks",
+ artifact = "io.netty:netty-codec-socks:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "a159bf1f3d5019e0d561c92fbbec8400967471fa",
+ )
+
+
+ # io.netty:netty-codec-http:jar:4.1.17.Final
+ # io.netty:netty-codec-socks:jar:4.1.17.Final got requested version
+ # io.netty:netty-handler:jar:4.1.17.Final got requested version
+ native.maven_jar(
+ name = "io_netty_netty_codec",
+ artifact = "io.netty:netty-codec:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "1d00f56dc9e55203a4bde5aae3d0828fdeb818e7",
+ )
+
+
+ # io.netty:netty-transport:jar:4.1.17.Final
+ # io.netty:netty-handler:jar:4.1.17.Final got requested version
+ native.maven_jar(
+ name = "io_netty_netty_buffer",
+ artifact = "io.netty:netty-buffer:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "fdd68fb3defd7059a7392b9395ee941ef9bacc25",
+ )
+
+
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta got requested version
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_cloud_google_cloud_core_grpc",
+ artifact = "com.google.cloud:google-cloud-core-grpc:1.40.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "f1f7a81915728eb53b9d3832f3ccec53ea181664",
+ )
+
+
+ # io.grpc:grpc-all:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_netty",
+ artifact = "io.grpc:grpc-netty:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "8157384d87497dc18604a5ba3760763fe643f16e",
+ )
+
+
+ # io.grpc:grpc-all:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_testing",
+ artifact = "io.grpc:grpc-testing:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "3d20675f0e64825f565a7d21456e7dbdd5886c6b",
+ )
+
+
+ # io.opencensus:opencensus-impl:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-exporter-trace-stackdriver:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-exporter-trace-logging:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-contrib-grpc-metrics:jar:0.10.0 wanted version 0.10.0
+ # io.opencensus:opencensus-exporter-stats-prometheus:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-contrib-zpages:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-exporter-stats-stackdriver:jar:0.16.1 got requested version
+ # io.opencensus:opencensus-impl-core:jar:0.16.1 got requested version
+ native.maven_jar(
+ name = "io_opencensus_opencensus_api",
+ artifact = "io.opencensus:opencensus-api:0.16.1",
+ sha1 = "ec5d81a80d9c010c50368ad9045d512828d0d62d",
+ )
+
+
+ # io.grpc:grpc-testing:jar:1.9.0
+ native.maven_jar(
+ name = "junit_junit",
+ artifact = "junit:junit:4.12",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "2973d150c0dc1fefe998f834810d68f278ea58ec",
+ )
+
+
+ # io.prometheus:simpleclient_httpserver:bundle:0.4.0 wanted version 0.3.0
+ # io.prometheus:simpleclient_common:bundle:0.4.0 wanted version 0.3.0
+ # io.opencensus:opencensus-exporter-stats-prometheus:jar:0.16.1
+ native.maven_jar(
+ name = "io_prometheus_simpleclient",
+ artifact = "io.prometheus:simpleclient:0.4.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "99c293bbf9461587b2179273b6fdc349582a1021",
+ )
+
+
+ # com.google.guava:guava:bundle:23.0
+ native.maven_jar(
+ name = "org_codehaus_mojo_animal_sniffer_annotations",
+ artifact = "org.codehaus.mojo:animal-sniffer-annotations:1.14",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "775b7e22fb10026eed3f86e8dc556dfafe35f2d5",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_exporter_stats_stackdriver",
+ artifact = "io.opencensus:opencensus-exporter-stats-stackdriver:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "e4e7152e53c7683e92a1ddae15a2e13eeaa7714e",
+ )
+
+
+ # io.netty:netty-handler-proxy:jar:4.1.17.Final got requested version
+ # io.netty:netty-codec-http2:jar:4.1.17.Final
+ native.maven_jar(
+ name = "io_netty_netty_codec_http",
+ artifact = "io.netty:netty-codec-http:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "251d7edcb897122b9b23f24ff793cd0739056b9e",
+ )
+
+
+ # org.apache.httpcomponents:httpclient:jar:4.5.3
+ native.maven_jar(
+ name = "commons_logging_commons_logging",
+ artifact = "commons-logging:commons-logging:1.2",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "4bfc12adfe4842bf07b657f0369c4cb522955686",
+ )
+
+
+ # io.grpc:grpc-netty:jar:1.9.0
+ native.maven_jar(
+ name = "io_netty_netty_codec_http2",
+ artifact = "io.netty:netty-codec-http2:4.1.17.Final",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "f9844005869c6d9049f4b677228a89fee4c6eab3",
+ )
+
+
+ # com.google.protobuf:protobuf-java-util:bundle:3.5.1
+ native.maven_jar(
+ name = "com_google_code_gson_gson",
+ artifact = "com.google.code.gson:gson:2.7",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "751f548c85fa49f330cecbb1875893f971b33c4e",
+ )
+
+
+ # io.grpc:grpc-protobuf-nano:jar:1.9.0
+ native.maven_jar(
+ name = "com_google_protobuf_nano_protobuf_javanano",
+ artifact = "com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "357e60f95cebb87c72151e49ba1f570d899734f8",
+ )
+
+
+ # com.google.http-client:google-http-client:jar:1.24.1
+ native.maven_jar(
+ name = "org_apache_httpcomponents_httpclient",
+ artifact = "org.apache.httpcomponents:httpclient:4.5.3",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "d1577ae15f01ef5438c5afc62162457c00a34713",
+ )
+
+
+ # com.google.cloud:google-cloud-core:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_api_grpc_proto_google_iam_v1",
+ artifact = "com.google.api.grpc:proto-google-iam-v1:0.12.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ea312c0250a5d0a7cdd1b20bc2c3259938b79855",
+ )
+
+
+ # io.opencensus:opencensus-api:jar:0.10.0 wanted version 1.8.0
+ # io.grpc:grpc-all:jar:1.9.0 got requested version
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 wanted version 1.13.1
+ # io.grpc:grpc-core:jar:1.9.0
+ native.maven_jar(
+ name = "io_grpc_grpc_context",
+ artifact = "io.grpc:grpc-context:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "28b0836f48c9705abf73829bbc536dba29a1329a",
+ )
+
+
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_api_gax_grpc",
+ artifact = "com.google.api:gax-grpc:1.30.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "ada82a4a0c020807e1c1a674b18658374264e401",
+ )
+
+
+ # com.google.api.grpc:proto-google-cloud-monitoring-v3:jar:1.22.0 wanted version 1.12.0
+ # com.google.api.grpc:proto-google-iam-v1:jar:0.12.0 wanted version 1.11.0
+ # com.google.api:gax-grpc:jar:1.30.0 wanted version 1.12.0
+ # com.google.api.grpc:proto-google-cloud-trace-v1:jar:0.23.0 wanted version 1.12.0
+ # io.grpc:grpc-protobuf:jar:1.9.0
+ # com.google.api.grpc:proto-google-cloud-trace-v2:jar:0.23.0 wanted version 1.12.0
+ # com.google.cloud:google-cloud-core:jar:1.40.0 wanted version 1.12.0
+ native.maven_jar(
+ name = "com_google_api_grpc_proto_google_common_protos",
+ artifact = "com.google.api.grpc:proto-google-common-protos:1.0.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "86f070507e28b930e50d218ee5b6788ef0dd05e6",
+ )
+
+
+ native.maven_jar(
+ name = "io_opencensus_opencensus_contrib_zpages",
+ artifact = "io.opencensus:opencensus-contrib-zpages:0.16.1",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "5fe09e41a9435281eb4547bc57ae34b9fd6bbf21",
+ )
+
+
+ # io.opencensus:opencensus-exporter-trace-stackdriver:jar:0.16.1 wanted version 20.0
+ # io.opencensus:opencensus-exporter-stats-prometheus:jar:0.16.1 wanted version 20.0
+ # io.opencensus:opencensus-exporter-stats-stackdriver:jar:0.16.1 wanted version 20.0
+ # io.grpc:grpc-protobuf-lite:jar:1.9.0 wanted version 19.0
+ # com.google.instrumentation:instrumentation-api:jar:0.4.3 wanted version 19.0
+ # io.grpc:grpc-protobuf:jar:1.9.0 wanted version 19.0
+ # io.opencensus:opencensus-contrib-zpages:jar:0.16.1 wanted version 20.0
+ # io.opencensus:opencensus-impl-core:jar:0.16.1 wanted version 20.0
+ # io.opencensus:opencensus-exporter-trace-logging:jar:0.16.1 wanted version 20.0
+ # io.grpc:grpc-protobuf-nano:jar:1.9.0 wanted version 19.0
+ # io.grpc:grpc-core:jar:1.9.0 wanted version 19.0
+ # com.google.protobuf:protobuf-java-util:bundle:3.5.1 wanted version 19.0
+ # io.opencensus:opencensus-api:jar:0.10.0 wanted version 19.0
+ native.maven_jar(
+ name = "com_google_guava_guava",
+ artifact = "com.google.guava:guava:23.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "c947004bb13d18182be60077ade044099e4f26f1",
+ )
+
+
+ native.maven_jar(
+ name = "io_grpc_grpc_all",
+ artifact = "io.grpc:grpc-all:1.9.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "442dfac27fd072e15b7134ab02c2b38136036090",
+ )
+
+
+ # com.google.cloud:google-cloud-core-grpc:jar:1.40.0 got requested version
+ # com.google.cloud:google-cloud-trace:jar:0.58.0-beta got requested version
+ # com.google.cloud:google-cloud-monitoring:jar:1.40.0
+ native.maven_jar(
+ name = "com_google_cloud_google_cloud_core",
+ artifact = "com.google.cloud:google-cloud-core:1.40.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "4985701f989030e262cf8f4e38cc954115f5b082",
+ )
+
+
+ # io.opencensus:opencensus-exporter-stats-stackdriver:jar:0.16.1
+ native.maven_jar(
+ name = "com_google_cloud_google_cloud_monitoring",
+ artifact = "com.google.cloud:google-cloud-monitoring:1.40.0",
+ repository = "http://repo.maven.apache.org/maven2/",
+ sha1 = "f03d20d67a5f3b0cd0685225a6ea5339d208aa53",
+ )
+
+
+
+
+def opencensus_java_libraries():
+ native.java_library(
+ name = "com_google_code_findbugs_jsr305",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_code_findbugs_jsr305//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_protobuf_lite",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_protobuf_lite//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":io_grpc_grpc_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_exporter_stats_prometheus",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_exporter_stats_prometheus//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":io_opencensus_opencensus_api",
+ ":io_prometheus_simpleclient",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_auth_google_auth_library_oauth2_http",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_auth_google_auth_library_oauth2_http//jar"],
+ runtime_deps = [
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_http_client_google_http_client",
+ ":com_google_http_client_google_http_client_jackson2",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_transport",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_transport//jar"],
+ runtime_deps = [
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_common",
+ ":io_netty_netty_resolver",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_handler_proxy",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_handler_proxy//jar"],
+ runtime_deps = [
+ ":io_netty_netty_codec",
+ ":io_netty_netty_codec_http",
+ ":io_netty_netty_codec_socks",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_protobuf_nano",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_protobuf_nano//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":com_google_protobuf_nano_protobuf_javanano",
+ ":io_grpc_grpc_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_cloud_google_cloud_trace",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_cloud_google_cloud_trace//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_cloud_trace_v1",
+ ":com_google_api_grpc_proto_google_cloud_trace_v2",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_cloud_google_cloud_core",
+ ":com_google_cloud_google_cloud_core_grpc",
+ ":com_google_protobuf_protobuf_java",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_netty_shaded",
+ ":io_grpc_grpc_stub",
+ ],
+ )
+
+
+ native.java_library(
+ name = "commons_codec_commons_codec",
+ visibility = ["//visibility:public"],
+ exports = ["@commons_codec_commons_codec//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_impl_core",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_impl_core//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":io_opencensus_opencensus_api",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_prometheus_simpleclient_common",
+ visibility = ["//visibility:public"],
+ exports = ["@io_prometheus_simpleclient_common//jar"],
+ runtime_deps = [
+ ":io_prometheus_simpleclient",
+ ],
+ )
+
+
+ native.java_library(
+ name = "org_threeten_threetenbp",
+ visibility = ["//visibility:public"],
+ exports = ["@org_threeten_threetenbp//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_errorprone_error_prone_annotations",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_errorprone_error_prone_annotations//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_resolver",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_resolver//jar"],
+ runtime_deps = [
+ ":io_netty_netty_common",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_squareup_okio_okio",
+ visibility = ["//visibility:public"],
+ exports = ["@com_squareup_okio_okio//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_protobuf_protobuf_java_util",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_protobuf_protobuf_java_util//jar"],
+ runtime_deps = [
+ ":com_google_code_gson_gson",
+ ":com_google_guava_guava",
+ ":com_google_protobuf_protobuf_java",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_auth_google_auth_library_credentials",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_auth_google_auth_library_credentials//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_api_common",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_api_common//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_contrib_grpc_metrics",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_contrib_grpc_metrics//jar"],
+ runtime_deps = [
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_errorprone_error_prone_annotations",
+ ":io_opencensus_opencensus_api",
+ ],
+ )
+
+
+ native.java_library(
+ name = "org_objenesis_objenesis",
+ visibility = ["//visibility:public"],
+ exports = ["@org_objenesis_objenesis//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_common",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_common//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_grpc_proto_google_cloud_trace_v2",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_grpc_proto_google_cloud_trace_v2//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_protobuf_protobuf_java",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_netty_shaded",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_netty_shaded//jar"],
+ runtime_deps = [
+ ":io_grpc_grpc_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_grpc_proto_google_cloud_trace_v1",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_grpc_proto_google_cloud_trace_v1//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_protobuf_protobuf_java",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_okhttp",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_okhttp//jar"],
+ runtime_deps = [
+ ":com_squareup_okhttp_okhttp",
+ ":com_squareup_okio_okio",
+ ":io_grpc_grpc_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "org_hamcrest_hamcrest_core",
+ visibility = ["//visibility:public"],
+ exports = ["@org_hamcrest_hamcrest_core//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_handler",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_handler//jar"],
+ runtime_deps = [
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_codec",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_grpc_proto_google_cloud_monitoring_v3",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_grpc_proto_google_cloud_monitoring_v3//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_protobuf_protobuf_java",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_http_client_google_http_client",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_http_client_google_http_client//jar"],
+ runtime_deps = [
+ ":commons_codec_commons_codec",
+ ":commons_logging_commons_logging",
+ ":org_apache_httpcomponents_httpclient",
+ ":org_apache_httpcomponents_httpcore",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_prometheus_simpleclient_httpserver",
+ visibility = ["//visibility:public"],
+ exports = ["@io_prometheus_simpleclient_httpserver//jar"],
+ runtime_deps = [
+ ":io_prometheus_simpleclient",
+ ":io_prometheus_simpleclient_common",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_instrumentation_instrumentation_api",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_instrumentation_instrumentation_api//jar"],
+ runtime_deps = [
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_guava_guava",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_http_client_google_http_client_jackson2",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_http_client_google_http_client_jackson2//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_exporter_trace_logging",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_exporter_trace_logging//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":io_opencensus_opencensus_api",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_auth",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_auth//jar"],
+ runtime_deps = [
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_errorprone_error_prone_annotations",
+ ":com_google_guava_guava",
+ ":com_google_instrumentation_instrumentation_api",
+ ":io_grpc_grpc_context",
+ ":io_grpc_grpc_core",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_grpc_metrics",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_gax",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_gax//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":com_google_http_client_google_http_client",
+ ":com_google_http_client_google_http_client_jackson2",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_exporter_trace_stackdriver",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_exporter_trace_stackdriver//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_cloud_trace_v1",
+ ":com_google_api_grpc_proto_google_cloud_trace_v2",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_cloud_google_cloud_core",
+ ":com_google_cloud_google_cloud_core_grpc",
+ ":com_google_cloud_google_cloud_trace",
+ ":com_google_guava_guava",
+ ":com_google_protobuf_protobuf_java",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_netty_shaded",
+ ":io_grpc_grpc_stub",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_monitored_resource_util",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_j2objc_j2objc_annotations",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_j2objc_j2objc_annotations//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_core",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_core//jar"],
+ runtime_deps = [
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_errorprone_error_prone_annotations",
+ ":com_google_guava_guava",
+ ":com_google_instrumentation_instrumentation_api",
+ ":io_grpc_grpc_context",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_grpc_metrics",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_contrib_monitored_resource_util",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_contrib_monitored_resource_util//jar"],
+ )
+
+
+ native.java_library(
+ name = "joda_time_joda_time",
+ visibility = ["//visibility:public"],
+ exports = ["@joda_time_joda_time//jar"],
+ )
+
+
+ native.java_library(
+ name = "org_mockito_mockito_core",
+ visibility = ["//visibility:public"],
+ exports = ["@org_mockito_mockito_core//jar"],
+ runtime_deps = [
+ ":org_objenesis_objenesis",
+ ],
+ )
+
+
+ native.java_library(
+ name = "org_apache_httpcomponents_httpcore",
+ visibility = ["//visibility:public"],
+ exports = ["@org_apache_httpcomponents_httpcore//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_lmax_disruptor",
+ visibility = ["//visibility:public"],
+ exports = ["@com_lmax_disruptor//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_protobuf_protobuf_java",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_protobuf_protobuf_java//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_squareup_okhttp_okhttp",
+ visibility = ["//visibility:public"],
+ exports = ["@com_squareup_okhttp_okhttp//jar"],
+ runtime_deps = [
+ ":com_squareup_okio_okio",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_stub",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_stub//jar"],
+ runtime_deps = [
+ ":io_grpc_grpc_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_impl",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_impl//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":com_lmax_disruptor",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_impl_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_protobuf",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_protobuf//jar"],
+ runtime_deps = [
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_code_gson_gson",
+ ":com_google_guava_guava",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_protobuf_lite",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_codec_socks",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_codec_socks//jar"],
+ runtime_deps = [
+ ":io_netty_netty_codec",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_codec",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_codec//jar"],
+ runtime_deps = [
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_common",
+ ":io_netty_netty_resolver",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_buffer",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_buffer//jar"],
+ runtime_deps = [
+ ":io_netty_netty_common",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_cloud_google_cloud_core_grpc",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_cloud_google_cloud_core_grpc//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_gax",
+ ":com_google_api_gax_grpc",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":com_google_cloud_google_cloud_core",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_context",
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_netty_shaded",
+ ":io_grpc_grpc_protobuf",
+ ":io_grpc_grpc_stub",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_netty",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_netty//jar"],
+ runtime_deps = [
+ ":io_grpc_grpc_core",
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_codec",
+ ":io_netty_netty_codec_http",
+ ":io_netty_netty_codec_http2",
+ ":io_netty_netty_codec_socks",
+ ":io_netty_netty_common",
+ ":io_netty_netty_handler",
+ ":io_netty_netty_handler_proxy",
+ ":io_netty_netty_resolver",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_testing",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_testing//jar"],
+ runtime_deps = [
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_stub",
+ ":junit_junit",
+ ":org_hamcrest_hamcrest_core",
+ ":org_mockito_mockito_core",
+ ":org_objenesis_objenesis",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_api",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_api//jar"],
+ runtime_deps = [
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_errorprone_error_prone_annotations",
+ ":com_google_guava_guava",
+ ":io_grpc_grpc_context",
+ ],
+ )
+
+
+ native.java_library(
+ name = "junit_junit",
+ visibility = ["//visibility:public"],
+ exports = ["@junit_junit//jar"],
+ runtime_deps = [
+ ":org_hamcrest_hamcrest_core",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_prometheus_simpleclient",
+ visibility = ["//visibility:public"],
+ exports = ["@io_prometheus_simpleclient//jar"],
+ )
+
+
+ native.java_library(
+ name = "org_codehaus_mojo_animal_sniffer_annotations",
+ visibility = ["//visibility:public"],
+ exports = ["@org_codehaus_mojo_animal_sniffer_annotations//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_exporter_stats_stackdriver",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_exporter_stats_stackdriver//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_gax",
+ ":com_google_api_gax_grpc",
+ ":com_google_api_grpc_proto_google_cloud_monitoring_v3",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_api_grpc_proto_google_iam_v1",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":com_google_cloud_google_cloud_core",
+ ":com_google_cloud_google_cloud_core_grpc",
+ ":com_google_cloud_google_cloud_monitoring",
+ ":com_google_guava_guava",
+ ":com_google_http_client_google_http_client",
+ ":com_google_http_client_google_http_client_jackson2",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":commons_codec_commons_codec",
+ ":commons_logging_commons_logging",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_context",
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_netty_shaded",
+ ":io_grpc_grpc_protobuf",
+ ":io_grpc_grpc_stub",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_monitored_resource_util",
+ ":joda_time_joda_time",
+ ":org_apache_httpcomponents_httpclient",
+ ":org_apache_httpcomponents_httpcore",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_codec_http",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_codec_http//jar"],
+ runtime_deps = [
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_codec",
+ ":io_netty_netty_common",
+ ":io_netty_netty_resolver",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "commons_logging_commons_logging",
+ visibility = ["//visibility:public"],
+ exports = ["@commons_logging_commons_logging//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_netty_netty_codec_http2",
+ visibility = ["//visibility:public"],
+ exports = ["@io_netty_netty_codec_http2//jar"],
+ runtime_deps = [
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_codec",
+ ":io_netty_netty_codec_http",
+ ":io_netty_netty_common",
+ ":io_netty_netty_handler",
+ ":io_netty_netty_resolver",
+ ":io_netty_netty_transport",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_code_gson_gson",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_code_gson_gson//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_protobuf_nano_protobuf_javanano",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_protobuf_nano_protobuf_javanano//jar"],
+ )
+
+
+ native.java_library(
+ name = "org_apache_httpcomponents_httpclient",
+ visibility = ["//visibility:public"],
+ exports = ["@org_apache_httpcomponents_httpclient//jar"],
+ runtime_deps = [
+ ":commons_codec_commons_codec",
+ ":commons_logging_commons_logging",
+ ":org_apache_httpcomponents_httpcore",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_grpc_proto_google_iam_v1",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_grpc_proto_google_iam_v1//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_protobuf_protobuf_java",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_context",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_context//jar"],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_gax_grpc",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_gax_grpc//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_gax",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_protobuf",
+ ":io_grpc_grpc_stub",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_api_grpc_proto_google_common_protos",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_api_grpc_proto_google_common_protos//jar"],
+ )
+
+
+ native.java_library(
+ name = "io_opencensus_opencensus_contrib_zpages",
+ visibility = ["//visibility:public"],
+ exports = ["@io_opencensus_opencensus_contrib_zpages//jar"],
+ runtime_deps = [
+ ":com_google_guava_guava",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_grpc_metrics",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_guava_guava",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_guava_guava//jar"],
+ runtime_deps = [
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_errorprone_error_prone_annotations",
+ ":com_google_j2objc_j2objc_annotations",
+ ":org_codehaus_mojo_animal_sniffer_annotations",
+ ],
+ )
+
+
+ native.java_library(
+ name = "io_grpc_grpc_all",
+ visibility = ["//visibility:public"],
+ exports = ["@io_grpc_grpc_all//jar"],
+ runtime_deps = [
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_code_findbugs_jsr305",
+ ":com_google_code_gson_gson",
+ ":com_google_errorprone_error_prone_annotations",
+ ":com_google_guava_guava",
+ ":com_google_instrumentation_instrumentation_api",
+ ":com_google_protobuf_nano_protobuf_javanano",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":com_squareup_okhttp_okhttp",
+ ":com_squareup_okio_okio",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_context",
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_netty",
+ ":io_grpc_grpc_okhttp",
+ ":io_grpc_grpc_protobuf",
+ ":io_grpc_grpc_protobuf_lite",
+ ":io_grpc_grpc_protobuf_nano",
+ ":io_grpc_grpc_stub",
+ ":io_grpc_grpc_testing",
+ ":io_netty_netty_buffer",
+ ":io_netty_netty_codec",
+ ":io_netty_netty_codec_http",
+ ":io_netty_netty_codec_http2",
+ ":io_netty_netty_codec_socks",
+ ":io_netty_netty_common",
+ ":io_netty_netty_handler",
+ ":io_netty_netty_handler_proxy",
+ ":io_netty_netty_resolver",
+ ":io_netty_netty_transport",
+ ":io_opencensus_opencensus_api",
+ ":io_opencensus_opencensus_contrib_grpc_metrics",
+ ":junit_junit",
+ ":org_hamcrest_hamcrest_core",
+ ":org_mockito_mockito_core",
+ ":org_objenesis_objenesis",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_cloud_google_cloud_core",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_cloud_google_cloud_core//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_gax",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_api_grpc_proto_google_iam_v1",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":com_google_http_client_google_http_client",
+ ":com_google_http_client_google_http_client_jackson2",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":commons_codec_commons_codec",
+ ":commons_logging_commons_logging",
+ ":joda_time_joda_time",
+ ":org_apache_httpcomponents_httpclient",
+ ":org_apache_httpcomponents_httpcore",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
+ native.java_library(
+ name = "com_google_cloud_google_cloud_monitoring",
+ visibility = ["//visibility:public"],
+ exports = ["@com_google_cloud_google_cloud_monitoring//jar"],
+ runtime_deps = [
+ ":com_google_api_api_common",
+ ":com_google_api_gax",
+ ":com_google_api_gax_grpc",
+ ":com_google_api_grpc_proto_google_cloud_monitoring_v3",
+ ":com_google_api_grpc_proto_google_common_protos",
+ ":com_google_api_grpc_proto_google_iam_v1",
+ ":com_google_auth_google_auth_library_credentials",
+ ":com_google_auth_google_auth_library_oauth2_http",
+ ":com_google_cloud_google_cloud_core",
+ ":com_google_cloud_google_cloud_core_grpc",
+ ":com_google_http_client_google_http_client",
+ ":com_google_http_client_google_http_client_jackson2",
+ ":com_google_protobuf_protobuf_java",
+ ":com_google_protobuf_protobuf_java_util",
+ ":commons_codec_commons_codec",
+ ":commons_logging_commons_logging",
+ ":io_grpc_grpc_auth",
+ ":io_grpc_grpc_context",
+ ":io_grpc_grpc_core",
+ ":io_grpc_grpc_netty_shaded",
+ ":io_grpc_grpc_protobuf",
+ ":io_grpc_grpc_stub",
+ ":joda_time_joda_time",
+ ":org_apache_httpcomponents_httpclient",
+ ":org_apache_httpcomponents_httpcore",
+ ":org_threeten_threetenbp",
+ ],
+ )
+
+
diff --git a/examples/pom.xml b/examples/pom.xml
new file mode 100644
index 00000000..5f083126
--- /dev/null
+++ b/examples/pom.xml
@@ -0,0 +1,169 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-examples</artifactId>
+ <packaging>jar</packaging>
+ <version>0.17.0-SNAPSHOT</version><!-- CURRENT_OPENCENSUS_VERSION -->
+ <name>opencensus-examples</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!-- change to the version you want to use. -->
+ <opencensus.version>0.16.1</opencensus.version><!-- LATEST_OPENCENSUS_RELEASE_VERSION -->
+ <grpc.version>1.13.1</grpc.version><!-- CURRENT_GRPC_VERSION -->
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-api</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-contrib-grpc-metrics</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-contrib-zpages</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-exporter-stats-prometheus</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-exporter-trace-stackdriver</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-exporter-trace-logging</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-protobuf</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-stub</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_httpserver</artifactId>
+ <version>0.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-impl</artifactId>
+ <version>${opencensus.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-tcnative-boringssl-static</artifactId>
+ <version>2.0.8.Final</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.5.0.Final</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.7.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>appassembler-maven-plugin</artifactId>
+ <version>1.10</version>
+ <configuration>
+ <programs>
+ <program>
+ <id>TagContextExample</id>
+ <mainClass>io.opencensus.examples.tags.TagContextExample</mainClass>
+ </program>
+ <program>
+ <id>MultiSpansTracing</id>
+ <mainClass>io.opencensus.examples.trace.MultiSpansTracing</mainClass>
+ </program>
+ <program>
+ <id>MultiSpansScopedTracing</id>
+ <mainClass>io.opencensus.examples.trace.MultiSpansScopedTracing</mainClass>
+ </program>
+ <program>
+ <id>MultiSpansContextTracing</id>
+ <mainClass>io.opencensus.examples.trace.MultiSpansContextTracing</mainClass>
+ </program>
+ <program>
+ <id>ZPagesTester</id>
+ <mainClass>io.opencensus.examples.zpages.ZPagesTester</mainClass>
+ </program>
+ <program>
+ <id>QuickStart</id>
+ <mainClass>io.opencensus.examples.helloworld.QuickStart</mainClass>
+ </program>
+ <program>
+ <id>HelloWorldClient</id>
+ <mainClass>io.opencensus.examples.grpc.helloworld.HelloWorldClient</mainClass>
+ </program>
+ <program>
+ <id>HelloWorldServer</id>
+ <mainClass>io.opencensus.examples.grpc.helloworld.HelloWorldServer</mainClass>
+ </program>
+ </programs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.5.0</version>
+ <configuration>
+ <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
+ <pluginId>grpc-java</pluginId>
+ <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>compile-custom</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
diff --git a/examples/settings.gradle b/examples/settings.gradle
new file mode 100644
index 00000000..310e652f
--- /dev/null
+++ b/examples/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'opencensus-examples'
diff --git a/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java
new file mode 100644
index 00000000..30e41633
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldClient.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.grpc.helloworld;
+
+import static io.opencensus.examples.grpc.helloworld.HelloWorldUtils.getPortOrDefaultFromArgs;
+import static io.opencensus.examples.grpc.helloworld.HelloWorldUtils.getStringOrDefaultFromArgs;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.grpc.StatusRuntimeException;
+import io.opencensus.common.Duration;
+import io.opencensus.common.Scope;
+import io.opencensus.contrib.grpc.metrics.RpcViews;
+import io.opencensus.contrib.zpages.ZPageHandlers;
+import io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector;
+import io.opencensus.exporter.stats.stackdriver.StackdriverStatsConfiguration;
+import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.exporter.trace.stackdriver.StackdriverTraceConfiguration;
+import io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter;
+import io.opencensus.trace.SpanBuilder;
+import io.opencensus.trace.Status.CanonicalCode;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.samplers.Samplers;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/** A simple client that requests a greeting from the {@link HelloWorldServer}. */
+public class HelloWorldClient {
+ private static final Logger logger = Logger.getLogger(HelloWorldClient.class.getName());
+
+ private static final Tracer tracer = Tracing.getTracer();
+
+ private final ManagedChannel channel;
+ private final GreeterGrpc.GreeterBlockingStub blockingStub;
+
+ /** Construct client connecting to HelloWorld server at {@code host:port}. */
+ public HelloWorldClient(String host, int port) {
+ this(
+ ManagedChannelBuilder.forAddress(host, port)
+ // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid
+ // needing certificates.
+ .usePlaintext(true)
+ .build());
+ }
+
+ /** Construct client for accessing RouteGuide server using the existing channel. */
+ HelloWorldClient(ManagedChannel channel) {
+ this.channel = channel;
+ blockingStub = GreeterGrpc.newBlockingStub(channel);
+ }
+
+ public void shutdown() throws InterruptedException {
+ channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
+ }
+
+ /** Say hello to server. */
+ public void greet(String name) {
+ logger.info("Will try to greet " + name + " ...");
+ HelloRequest request = HelloRequest.newBuilder().setName(name).build();
+ HelloReply response;
+
+ SpanBuilder spanBuilder =
+ tracer.spanBuilder("client").setRecordEvents(true).setSampler(Samplers.alwaysSample());
+ try (Scope scope = spanBuilder.startScopedSpan()) {
+ tracer.getCurrentSpan().addAnnotation("Saying Hello to Server.");
+ response = blockingStub.sayHello(request);
+ tracer.getCurrentSpan().addAnnotation("Received response from Server.");
+ } catch (StatusRuntimeException e) {
+ tracer
+ .getCurrentSpan()
+ .setStatus(
+ CanonicalCode.valueOf(e.getStatus().getCode().name())
+ .toStatus()
+ .withDescription(e.getMessage()));
+ logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
+ return;
+ }
+ logger.info("Greeting: " + response.getMessage());
+ }
+
+ /**
+ * Greet server. If provided, the first element of {@code args} is the name to use in the
+ * greeting.
+ */
+ public static void main(String[] args) throws IOException, InterruptedException {
+ // Add final keyword to pass checkStyle.
+ final String user = getStringOrDefaultFromArgs(args, 0, "world");
+ final String host = getStringOrDefaultFromArgs(args, 1, "localhost");
+ final int serverPort = getPortOrDefaultFromArgs(args, 2, 50051);
+ final String cloudProjectId = getStringOrDefaultFromArgs(args, 3, null);
+ final int zPagePort = getPortOrDefaultFromArgs(args, 4, 3001);
+
+ // Registers all RPC views.
+ RpcViews.registerAllViews();
+
+ // Starts a HTTP server and registers all Zpages to it.
+ ZPageHandlers.startHttpServerAndRegisterAll(zPagePort);
+ logger.info("ZPages server starts at localhost:" + zPagePort);
+
+ // Registers logging trace exporter.
+ LoggingTraceExporter.register();
+
+ // Registers Stackdriver exporters.
+ if (cloudProjectId != null) {
+ StackdriverTraceExporter.createAndRegister(
+ StackdriverTraceConfiguration.builder().setProjectId(cloudProjectId).build());
+ StackdriverStatsExporter.createAndRegister(
+ StackdriverStatsConfiguration.builder()
+ .setProjectId(cloudProjectId)
+ .setExportInterval(Duration.create(15, 0))
+ .build());
+ }
+
+ // Register Prometheus exporters and export metrics to a Prometheus HTTPServer.
+ PrometheusStatsCollector.createAndRegister();
+
+ HelloWorldClient client = new HelloWorldClient(host, serverPort);
+ try {
+ client.greet(user);
+ } finally {
+ client.shutdown();
+ }
+
+ logger.info("Client sleeping, ^C to exit. Meanwhile you can view stats and spans on zpages.");
+ while (true) {
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ logger.info("Exiting HelloWorldClient...");
+ }
+ }
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldServer.java b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldServer.java
new file mode 100644
index 00000000..15a0a896
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldServer.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.grpc.helloworld;
+
+import static io.opencensus.examples.grpc.helloworld.HelloWorldUtils.getPortOrDefaultFromArgs;
+import static io.opencensus.examples.grpc.helloworld.HelloWorldUtils.getStringOrDefaultFromArgs;
+
+import com.google.common.collect.ImmutableMap;
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.grpc.stub.StreamObserver;
+import io.opencensus.common.Duration;
+import io.opencensus.common.Scope;
+import io.opencensus.contrib.grpc.metrics.RpcViews;
+import io.opencensus.contrib.zpages.ZPageHandlers;
+import io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector;
+import io.opencensus.exporter.stats.stackdriver.StackdriverStatsConfiguration;
+import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.exporter.trace.stackdriver.StackdriverTraceConfiguration;
+import io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter;
+import io.opencensus.trace.AttributeValue;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.SpanBuilder;
+import io.opencensus.trace.Status;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.samplers.Samplers;
+import io.prometheus.client.exporter.HTTPServer;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+/** Server that manages startup/shutdown of a {@code Greeter} server. */
+public class HelloWorldServer {
+ private static final Logger logger = Logger.getLogger(HelloWorldServer.class.getName());
+
+ private static final Tracer tracer = Tracing.getTracer();
+
+ private final int serverPort;
+ private Server server;
+
+ private HelloWorldServer(int serverPort) {
+ this.serverPort = serverPort;
+ }
+
+ // A helper function that performs some work in its own Span.
+ private static void performWork(Span parent) {
+ SpanBuilder spanBuilder =
+ tracer
+ .spanBuilderWithExplicitParent("internal_work", parent)
+ .setRecordEvents(true)
+ .setSampler(Samplers.alwaysSample());
+ try (Scope scope = spanBuilder.startScopedSpan()) {
+ Span span = tracer.getCurrentSpan();
+ span.putAttribute("my_attribute", AttributeValue.stringAttributeValue("blue"));
+ span.addAnnotation("Performing work.");
+ sleepFor(20); // Working hard here.
+ span.addAnnotation("Done work.");
+ }
+ }
+
+ private static void sleepFor(int milliseconds) {
+ try {
+ Thread.sleep(milliseconds);
+ } catch (InterruptedException e) {
+ Span span = tracer.getCurrentSpan();
+ span.addAnnotation("Exception thrown when performing work " + e.getMessage());
+ span.setStatus(Status.UNKNOWN);
+ }
+ }
+
+ private void start() throws IOException {
+ server = ServerBuilder.forPort(serverPort).addService(new GreeterImpl()).build().start();
+ logger.info("Server started, listening on " + serverPort);
+ Runtime.getRuntime()
+ .addShutdownHook(
+ new Thread() {
+ @Override
+ public void run() {
+ // Use stderr here since the logger may have been reset by its JVM shutdown hook.
+ System.err.println("*** shutting down gRPC server since JVM is shutting down");
+ HelloWorldServer.this.stop();
+ System.err.println("*** server shut down");
+ }
+ });
+ }
+
+ private void stop() {
+ if (server != null) {
+ server.shutdown();
+ }
+ }
+
+ /** Await termination on the main thread since the grpc library uses daemon threads. */
+ private void blockUntilShutdown() throws InterruptedException {
+ if (server != null) {
+ server.awaitTermination();
+ }
+ }
+
+ /** Main launches the server from the command line. */
+ public static void main(String[] args) throws IOException, InterruptedException {
+ // Add final keyword to pass checkStyle.
+ final int serverPort = getPortOrDefaultFromArgs(args, 0, 50051);
+ final String cloudProjectId = getStringOrDefaultFromArgs(args, 1, null);
+ final int zPagePort = getPortOrDefaultFromArgs(args, 2, 3000);
+ final int prometheusPort = getPortOrDefaultFromArgs(args, 3, 9090);
+
+ // Registers all RPC views.
+ RpcViews.registerAllViews();
+
+ // Registers logging trace exporter.
+ LoggingTraceExporter.register();
+
+ // Starts a HTTP server and registers all Zpages to it.
+ ZPageHandlers.startHttpServerAndRegisterAll(zPagePort);
+ logger.info("ZPages server starts at localhost:" + zPagePort);
+
+ // Registers Stackdriver exporters.
+ if (cloudProjectId != null) {
+ StackdriverTraceExporter.createAndRegister(
+ StackdriverTraceConfiguration.builder().setProjectId(cloudProjectId).build());
+ StackdriverStatsExporter.createAndRegister(
+ StackdriverStatsConfiguration.builder()
+ .setProjectId(cloudProjectId)
+ .setExportInterval(Duration.create(15, 0))
+ .build());
+ }
+
+ // Register Prometheus exporters and export metrics to a Prometheus HTTPServer.
+ PrometheusStatsCollector.createAndRegister();
+ HTTPServer prometheusServer = new HTTPServer(prometheusPort, true);
+
+ // Start the RPC server. You shouldn't see any output from gRPC before this.
+ logger.info("gRPC starting.");
+ final HelloWorldServer server = new HelloWorldServer(serverPort);
+ server.start();
+ server.blockUntilShutdown();
+ }
+
+ static class GreeterImpl extends GreeterGrpc.GreeterImplBase {
+
+ @Override
+ public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
+ Span span = tracer.getCurrentSpan();
+ span.putAttribute("my_attribute", AttributeValue.stringAttributeValue("red"));
+ span.addAnnotation(
+ "Constructing greeting.",
+ ImmutableMap.of(
+ "name", AttributeValue.stringAttributeValue(req.getName()),
+ "name length", AttributeValue.longAttributeValue(req.getName().length())));
+ sleepFor(10);
+ performWork(span);
+ span.addAnnotation("Sleeping.");
+ sleepFor(30);
+ HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
+ responseObserver.onNext(reply);
+ responseObserver.onCompleted();
+ logger.info("SayHello RPC handled.");
+ }
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldUtils.java b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldUtils.java
new file mode 100644
index 00000000..55d6c225
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/grpc/helloworld/HelloWorldUtils.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.grpc.helloworld;
+
+import java.util.logging.Logger;
+import javax.annotation.Nullable;
+
+/** Util methods. */
+final class HelloWorldUtils {
+
+ private static final Logger logger = Logger.getLogger(HelloWorldUtils.class.getName());
+
+ static int getPortOrDefaultFromArgs(String[] args, int index, int defaultPort) {
+ int portNumber = defaultPort;
+ if (index < args.length) {
+ try {
+ portNumber = Integer.parseInt(args[index]);
+ } catch (NumberFormatException e) {
+ logger.warning(
+ String.format("Port %s is invalid, use default port %d.", args[index], defaultPort));
+ }
+ }
+ return portNumber;
+ }
+
+ static String getStringOrDefaultFromArgs(
+ String[] args, int index, @Nullable String defaultString) {
+ String s = defaultString;
+ if (index < args.length) {
+ s = args[index];
+ }
+ return s;
+ }
+
+ private HelloWorldUtils() {}
+}
diff --git a/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java b/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java
new file mode 100644
index 00000000..c71e0f3e
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.helloworld;
+
+import io.opencensus.common.Scope;
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.stats.Aggregation;
+import io.opencensus.stats.BucketBoundaries;
+import io.opencensus.stats.Measure.MeasureLong;
+import io.opencensus.stats.Stats;
+import io.opencensus.stats.StatsRecorder;
+import io.opencensus.stats.View;
+import io.opencensus.stats.ViewData;
+import io.opencensus.stats.ViewManager;
+import io.opencensus.tags.TagContextBuilder;
+import io.opencensus.tags.TagKey;
+import io.opencensus.tags.TagValue;
+import io.opencensus.tags.Tagger;
+import io.opencensus.tags.Tags;
+import io.opencensus.trace.SpanBuilder;
+import io.opencensus.trace.Status;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.samplers.Samplers;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Random;
+import java.util.logging.Logger;
+
+/** Simple program that collects data for video size. */
+public final class QuickStart {
+
+ private static final Logger logger = Logger.getLogger(QuickStart.class.getName());
+
+ private static final Tagger tagger = Tags.getTagger();
+ private static final ViewManager viewManager = Stats.getViewManager();
+ private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();
+ private static final Tracer tracer = Tracing.getTracer();
+
+ // frontendKey allows us to break down the recorded data.
+ private static final TagKey FRONTEND_KEY = TagKey.create("my.org/keys/frontend");
+
+ // videoSize will measure the size of processed videos.
+ private static final MeasureLong VIDEO_SIZE =
+ MeasureLong.create("my.org/measure/video_size", "size of processed videos", "By");
+
+ private static final long MiB = 1 << 20;
+
+ // Create view to see the processed video size distribution broken down by frontend.
+ // The view has bucket boundaries (0, 16 * MiB, 65536 * MiB) that will group measure
+ // values into histogram buckets.
+ private static final View.Name VIDEO_SIZE_VIEW_NAME = View.Name.create("my.org/views/video_size");
+ private static final View VIDEO_SIZE_VIEW =
+ View.create(
+ VIDEO_SIZE_VIEW_NAME,
+ "processed video size over time",
+ VIDEO_SIZE,
+ Aggregation.Distribution.create(
+ BucketBoundaries.create(Arrays.asList(0.0, 16.0 * MiB, 256.0 * MiB))),
+ Collections.singletonList(FRONTEND_KEY));
+
+ /** Main launcher for the QuickStart example. */
+ public static void main(String[] args) throws InterruptedException {
+ TagContextBuilder tagContextBuilder =
+ tagger.currentBuilder().put(FRONTEND_KEY, TagValue.create("mobile-ios9.3.5"));
+ SpanBuilder spanBuilder =
+ tracer
+ .spanBuilder("my.org/ProcessVideo")
+ .setRecordEvents(true)
+ .setSampler(Samplers.alwaysSample());
+ viewManager.registerView(VIDEO_SIZE_VIEW);
+ LoggingTraceExporter.register();
+
+ // Process video.
+ // Record the processed video size.
+ try (Scope scopedTags = tagContextBuilder.buildScoped();
+ Scope scopedSpan = spanBuilder.startScopedSpan()) {
+ tracer.getCurrentSpan().addAnnotation("Start processing video.");
+ // Sleep for [0,10] milliseconds to fake work.
+ Thread.sleep(new Random().nextInt(10) + 1);
+ statsRecorder.newMeasureMap().put(VIDEO_SIZE, 25 * MiB).record();
+ tracer.getCurrentSpan().addAnnotation("Finished processing video.");
+ } catch (Exception e) {
+ tracer.getCurrentSpan().addAnnotation("Exception thrown when processing video.");
+ tracer.getCurrentSpan().setStatus(Status.UNKNOWN);
+ logger.severe(e.getMessage());
+ }
+
+ logger.info("Wait longer than the reporting duration...");
+ // Wait for a duration longer than reporting duration (5s) to ensure spans are exported.
+ // TODO(songya): remove the gap once we add a shutdown hook for exporting unflushed spans.
+ Thread.sleep(5100);
+ ViewData viewData = viewManager.getView(VIDEO_SIZE_VIEW_NAME);
+ logger.info(
+ String.format("Recorded stats for %s:\n %s", VIDEO_SIZE_VIEW_NAME.asString(), viewData));
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/tags/TagContextExample.java b/examples/src/main/java/io/opencensus/examples/tags/TagContextExample.java
new file mode 100644
index 00000000..727c5fbb
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/tags/TagContextExample.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-17, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.tags;
+
+import io.opencensus.common.Scope;
+import io.opencensus.stats.Measure.MeasureDouble;
+import io.opencensus.stats.Stats;
+import io.opencensus.stats.StatsRecorder;
+import io.opencensus.tags.TagContext;
+import io.opencensus.tags.TagKey;
+import io.opencensus.tags.TagValue;
+import io.opencensus.tags.Tagger;
+import io.opencensus.tags.Tags;
+
+/** Simple program that uses {@link TagContext}. */
+public class TagContextExample {
+
+ private static final TagKey K1 = TagKey.create("k1");
+ private static final TagKey K2 = TagKey.create("k2");
+ private static final TagKey K3 = TagKey.create("k3");
+ private static final TagKey K4 = TagKey.create("k4");
+
+ private static final TagValue V1 = TagValue.create("v1");
+ private static final TagValue V2 = TagValue.create("v2");
+ private static final TagValue V3 = TagValue.create("v3");
+ private static final TagValue V4 = TagValue.create("v4");
+
+ private static final String UNIT = "1";
+ private static final MeasureDouble M1 = MeasureDouble.create("m1", "1st test metric", UNIT);
+ private static final MeasureDouble M2 = MeasureDouble.create("m2", "2nd test metric", UNIT);
+
+ private static final Tagger tagger = Tags.getTagger();
+ private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();
+
+ private TagContextExample() {}
+
+ /**
+ * Main method.
+ *
+ * @param args the main arguments.
+ */
+ public static void main(String[] args) {
+ System.out.println("Hello Stats World");
+ System.out.println("Default Tags: " + tagger.empty());
+ System.out.println("Current Tags: " + tagger.getCurrentTagContext());
+ TagContext tags1 = tagger.emptyBuilder().put(K1, V1).put(K2, V2).build();
+ try (Scope scopedTagCtx1 = tagger.withTagContext(tags1)) {
+ System.out.println(" Current Tags: " + tagger.getCurrentTagContext());
+ System.out.println(
+ " Current == Default + tags1: " + tagger.getCurrentTagContext().equals(tags1));
+ TagContext tags2 = tagger.toBuilder(tags1).put(K3, V3).put(K4, V4).build();
+ try (Scope scopedTagCtx2 = tagger.withTagContext(tags2)) {
+ System.out.println(" Current Tags: " + tagger.getCurrentTagContext());
+ System.out.println(
+ " Current == Default + tags1 + tags2: "
+ + tagger.getCurrentTagContext().equals(tags2));
+ statsRecorder.newMeasureMap().put(M1, 0.2).put(M2, 0.4).record();
+ }
+ }
+ System.out.println(
+ "Current == Default: " + tagger.getCurrentTagContext().equals(tagger.empty()));
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/trace/MultiSpansContextTracing.java b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansContextTracing.java
new file mode 100644
index 00000000..c8df144f
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansContextTracing.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.trace;
+
+import static io.opencensus.examples.trace.Utils.sleep;
+
+import io.opencensus.common.Scope;
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.samplers.Samplers;
+
+/**
+ * Example showing how to create a child {@link Span}, install it to the current context and add
+ * annotations.
+ */
+public final class MultiSpansContextTracing {
+ // Per class Tracer.
+ private static final Tracer tracer = Tracing.getTracer();
+
+ private MultiSpansContextTracing() {}
+
+ private static void doSomeOtherWork() {
+ tracer.getCurrentSpan().addAnnotation("Annotation to the child Span");
+ }
+
+ private static void doSomeMoreWork() {
+ // Create a child Span of the current Span.
+ Span span = tracer.spanBuilder("MyChildSpan").startSpan();
+ try (Scope ws = tracer.withSpan(span)) {
+ doSomeOtherWork();
+ }
+ span.end();
+ }
+
+ private static void doWork() {
+ tracer.getCurrentSpan().addAnnotation("Annotation to the root Span before child is created.");
+ doSomeMoreWork();
+ tracer.getCurrentSpan().addAnnotation("Annotation to the root Span after child is ended.");
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args the main arguments.
+ */
+ public static void main(String[] args) {
+
+ // WARNING: Be careful before you set sampler value to always sample, especially in
+ // production environment. Trace data is often very large in size and is expensive to
+ // collect. This is why rather than collecting traces for every request(i.e. alwaysSample),
+ // downsampling is prefered.
+ //
+ // By default, OpenCensus provides a probabilistic sampler that will trace once in every
+ // 10,000 requests, that's why if default probabilistic sampler is used
+ // you might not see trace data printed or exported and this is expected behavior.
+
+ TraceConfig traceConfig = Tracing.getTraceConfig();
+ traceConfig.updateActiveTraceParams(
+ traceConfig.getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build());
+
+ LoggingTraceExporter.register();
+ Span span = tracer.spanBuilderWithExplicitParent("MyRootSpan", null).startSpan();
+ try (Scope ws = tracer.withSpan(span)) {
+ doWork();
+ }
+ span.end();
+
+ // Wait for a duration longer than reporting duration (5s) to ensure spans are exported.
+ // Spans are exported every 5 seconds
+ sleep(5100);
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/trace/MultiSpansScopedTracing.java b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansScopedTracing.java
new file mode 100644
index 00000000..5cfc9dfc
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansScopedTracing.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.trace;
+
+import static io.opencensus.examples.trace.Utils.sleep;
+
+import io.opencensus.common.Scope;
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.samplers.Samplers;
+
+/**
+ * Example showing how to create a child {@link Span} using scoped Spans, install it in the current
+ * context, and add annotations.
+ */
+public final class MultiSpansScopedTracing {
+ // Per class Tracer.
+ private static final Tracer tracer = Tracing.getTracer();
+
+ private MultiSpansScopedTracing() {}
+
+ private static void doSomeOtherWork() {
+ tracer.getCurrentSpan().addAnnotation("Annotation to the child Span");
+ }
+
+ private static void doSomeMoreWork() {
+ // Create a child Span of the current Span.
+ try (Scope ss = tracer.spanBuilder("MyChildSpan").startScopedSpan()) {
+ doSomeOtherWork();
+ }
+ }
+
+ private static void doWork() {
+ tracer.getCurrentSpan().addAnnotation("Annotation to the root Span before child is created.");
+ doSomeMoreWork();
+ tracer.getCurrentSpan().addAnnotation("Annotation to the root Span after child is ended.");
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args the main arguments.
+ */
+ public static void main(String[] args) {
+
+ // WARNING: Be careful before you set sampler value to always sample, especially in
+ // production environment. Trace data is often very large in size and is expensive to
+ // collect. This is why rather than collecting traces for every request(i.e. alwaysSample),
+ // downsampling is prefered.
+ //
+ // By default, OpenCensus provides a probabilistic sampler that will trace once in every
+ // 10,000 requests, that's why if default probabilistic sampler is used
+ // you might not see trace data printed or exported and this is expected behavior.
+
+ TraceConfig traceConfig = Tracing.getTraceConfig();
+ traceConfig.updateActiveTraceParams(
+ traceConfig.getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build());
+
+ LoggingTraceExporter.register();
+ try (Scope ss = tracer.spanBuilderWithExplicitParent("MyRootSpan", null).startScopedSpan()) {
+ doWork();
+ }
+
+ // Wait for a duration longer than reporting duration (5s) to ensure spans are exported.
+ // Spans are exported every 5 seconds
+ sleep(5100);
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/trace/MultiSpansTracing.java b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansTracing.java
new file mode 100644
index 00000000..fae4e3ff
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/trace/MultiSpansTracing.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.trace;
+
+import static io.opencensus.examples.trace.Utils.sleep;
+
+import io.opencensus.exporter.trace.logging.LoggingTraceExporter;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.samplers.Samplers;
+
+/** Example showing how to directly create a child {@link Span} and add annotations. */
+public final class MultiSpansTracing {
+ // Per class Tracer.
+ private static final Tracer tracer = Tracing.getTracer();
+
+ private MultiSpansTracing() {}
+
+ private static void doWork() {
+ Span rootSpan = tracer.spanBuilderWithExplicitParent("MyRootSpan", null).startSpan();
+ rootSpan.addAnnotation("Annotation to the root Span before child is created.");
+ Span childSpan = tracer.spanBuilderWithExplicitParent("MyChildSpan", rootSpan).startSpan();
+ childSpan.addAnnotation("Annotation to the child Span");
+ childSpan.end();
+ rootSpan.addAnnotation("Annotation to the root Span after child is ended.");
+ rootSpan.end();
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args the main arguments.
+ */
+ public static void main(String[] args) {
+
+ // WARNING: Be careful before you set sampler value to always sample, especially in
+ // production environment. Trace data is often very large in size and is expensive to
+ // collect. This is why rather than collecting traces for every request(i.e. alwaysSample),
+ // downsampling is prefered.
+ //
+ // By default, OpenCensus provides a probabilistic sampler that will trace once in every
+ // 10,000 requests, that's why if default probabilistic sampler is used
+ // you might not see trace data printed or exported and this is expected behavior.
+
+ TraceConfig traceConfig = Tracing.getTraceConfig();
+ traceConfig.updateActiveTraceParams(
+ traceConfig.getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build());
+
+ LoggingTraceExporter.register();
+ doWork();
+
+ // Wait for a duration longer than reporting duration (5s) to ensure spans are exported.
+ // Spans are exported every 5 seconds
+ sleep(5100);
+ }
+}
diff --git a/examples/src/main/java/io/opencensus/examples/trace/Utils.java b/examples/src/main/java/io/opencensus/examples/trace/Utils.java
new file mode 100644
index 00000000..9f0338af
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/trace/Utils.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.trace;
+
+import java.util.logging.Logger;
+
+/** Util methods. */
+final class Utils {
+
+ private static final Logger logger = Logger.getLogger(Utils.class.getName());
+
+ static void sleep(int ms) {
+ // A helper to avoid try-catch when invoking Thread.sleep so that
+ // sleeps can be succinct and not permeated by exception handling.
+ try {
+ Thread.sleep(ms);
+ } catch (Exception e) {
+ logger.warning((String.format("Failed to sleep for %dms. Exception: %s", ms, e)));
+ }
+ }
+
+ private Utils() {}
+}
diff --git a/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java b/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java
new file mode 100644
index 00000000..282b40ec
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2017, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.zpages;
+
+import io.opencensus.common.Scope;
+import io.opencensus.contrib.grpc.metrics.RpcMeasureConstants;
+import io.opencensus.contrib.grpc.metrics.RpcViews;
+import io.opencensus.contrib.zpages.ZPageHandlers;
+import io.opencensus.stats.MeasureMap;
+import io.opencensus.stats.Stats;
+import io.opencensus.stats.StatsRecorder;
+import io.opencensus.tags.TagValue;
+import io.opencensus.tags.Tagger;
+import io.opencensus.tags.Tags;
+import io.opencensus.trace.SpanBuilder;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.samplers.Samplers;
+import java.util.Collections;
+
+/** Testing only class for the UI. */
+public class ZPagesTester {
+
+ private ZPagesTester() {}
+
+ private static final Tagger tagger = Tags.getTagger();
+ private static final Tracer tracer = Tracing.getTracer();
+ private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();
+
+ private static final String SPAN_NAME = "ExampleSpan";
+ private static final TagValue METHOD = TagValue.create("ExampleMethod");
+
+ private static void recordExampleData() throws InterruptedException {
+ Tracing.getExportComponent()
+ .getSampledSpanStore()
+ .registerSpanNamesForCollection(Collections.singletonList(SPAN_NAME));
+ RpcViews.registerAllViews(); // Use old RPC constants to get interval stats.
+ SpanBuilder spanBuilder =
+ tracer.spanBuilder(SPAN_NAME).setRecordEvents(true).setSampler(Samplers.alwaysSample());
+
+ try (Scope scope = spanBuilder.startScopedSpan()) {
+ tracer.getCurrentSpan().addAnnotation("Starts recording.");
+ MeasureMap measureMap =
+ statsRecorder
+ .newMeasureMap()
+ // Client measurements.
+ .put(RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY, 1.0)
+ .put(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES, 1e5)
+ // Server measurements.
+ .put(RpcMeasureConstants.RPC_SERVER_STARTED_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY, 1.0)
+ .put(RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES, 1e5)
+ .put(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES, 1e5);
+ measureMap.record(
+ tagger
+ .currentBuilder()
+ .put(RpcMeasureConstants.RPC_STATUS, TagValue.create("OK"))
+ .put(RpcMeasureConstants.RPC_METHOD, METHOD)
+ .build());
+ MeasureMap measureMapErrors =
+ statsRecorder
+ .newMeasureMap()
+ .put(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT, 1)
+ .put(RpcMeasureConstants.RPC_SERVER_ERROR_COUNT, 1);
+ measureMapErrors.record(
+ tagger
+ .currentBuilder()
+ .put(RpcMeasureConstants.RPC_STATUS, TagValue.create("UNKNOWN"))
+ .put(RpcMeasureConstants.RPC_METHOD, METHOD)
+ .build());
+
+ Thread.sleep(200); // sleep for fake work.
+ tracer.getCurrentSpan().addAnnotation("Finish recording.");
+ }
+ }
+
+ /** Main method. */
+ public static void main(String[] args) throws Exception {
+ ZPageHandlers.startHttpServerAndRegisterAll(8080);
+ recordExampleData();
+ }
+}
diff --git a/examples/src/main/proto/helloworld.proto b/examples/src/main/proto/helloworld.proto
new file mode 100644
index 00000000..1bd79300
--- /dev/null
+++ b/examples/src/main/proto/helloworld.proto
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018, OpenCensus Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "io.opencensus.examples.grpc.helloworld";
+option java_outer_classname = "HelloWorldProto";
+
+package helloworld;
+
+// The greeting service definition.
+service Greeter {
+ // Sends a greeting
+ rpc SayHello (HelloRequest) returns (HelloReply) {}
+}
+
+// The request message containing the user's name.
+message HelloRequest {
+ string name = 1;
+}
+
+// The response message containing the greetings
+message HelloReply {
+ string message = 1;
+}