aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Drutu <bdrutu@google.com>2018-05-30 16:32:34 -0700
committerGitHub <noreply@github.com>2018-05-30 16:32:34 -0700
commit709d97aa321d5729988fd63b960bbece04cfba10 (patch)
tree76813530fd470288ed572563ce0157f680a216f0
parenta2674ef541d6e8a373d0d33c673be3da3ee039e0 (diff)
downloadopencensus-java-709d97aa321d5729988fd63b960bbece04cfba10.tar.gz
Add util contrib package for AppEngine standard. (#1214)
-rw-r--r--.gitignore3
-rw-r--r--CHANGELOG.md2
-rw-r--r--all/build.gradle2
-rw-r--r--build.gradle12
-rw-r--r--buildscripts/import-control.xml4
-rw-r--r--contrib/appengine_standard_util/README.md35
-rw-r--r--contrib/appengine_standard_util/build.gradle52
-rw-r--r--contrib/appengine_standard_util/src/main/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtils.java95
-rw-r--r--contrib/appengine_standard_util/src/main/proto/trace_id.proto10
-rw-r--r--contrib/appengine_standard_util/src/test/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtilsTest.java161
-rw-r--r--findbugs-exclude.xml44
-rw-r--r--settings.gradle3
12 files changed, 403 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index 685c85a3..a6064114 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,9 @@ gradle.properties
local.properties
out/
+# Protobuf
+gen_gradle
+
# Bazel
bazel-*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9bccb10f..9b4f4c52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@
- Remove namespace and help message prefix for Prometheus exporter. This could be
a breaking change if you have Prometheus metrics from OpenCensus Prometheus exporter
of previous versions, please point to the new metrics with no namespace instead.
+- Add an util artifact `opencensus-contrib-appengine-standard-util` to interact with the AppEngine
+ CloudTraceContext.
## 0.13.2 - 2018-05-08
- Map http attributes to Stackdriver format (fix [#1153](https://github.com/census-instrumentation/opencensus-java/issues/1153)).
diff --git a/all/build.gradle b/all/build.gradle
index 044dc13f..f4255f39 100644
--- a/all/build.gradle
+++ b/all/build.gradle
@@ -13,6 +13,7 @@ def subprojects = [
project(':opencensus-impl-lite'),
project(':opencensus-testing'),
project(':opencensus-contrib-agent'),
+ project(':opencensus-contrib-appengine-standard-util'),
project(':opencensus-contrib-grpc-util'),
project(':opencensus-contrib-grpc-metrics'),
project(':opencensus-contrib-http-util'),
@@ -32,6 +33,7 @@ def subprojects_javadoc = [
project(':opencensus-api'),
project(':opencensus-testing'),
project(':opencensus-contrib-agent'),
+ project(':opencensus-contrib-appengine-standard-util'),
project(':opencensus-contrib-grpc-util'),
project(':opencensus-contrib-grpc-metrics'),
project(':opencensus-contrib-http-util'),
diff --git a/build.gradle b/build.gradle
index 28900f0a..3927cdda 100644
--- a/build.gradle
+++ b/build.gradle
@@ -74,6 +74,8 @@ subprojects {
if (useErrorProne) {
if (JavaVersion.current().isJava8Compatible()) {
it.options.compilerArgs += ["-XepDisableWarningsInGeneratedCode"]
+ // Exclude generated protobuf from error-prone checks.
+ it.options.compilerArgs += ["-XepExcludedPaths:.*/gen_gradle/.*"]
// TODO(bdrutu): Read files directly instead of reading from properties.
if (rootProject.hasProperty("errorProneWarnings")) {
it.options.compilerArgs += rootProject.properties["errorProneWarnings"].split(',').collect {
@@ -105,6 +107,9 @@ subprojects {
]
}
it.options.encoding = "UTF-8"
+ // Protobuf-generated code produces some warnings.
+ // https://github.com/google/protobuf/issues/2718
+ it.options.compilerArgs += ["-Xlint:-cast"]
if (!JavaVersion.current().isJava9()) {
// TODO(sebright): Enable -Werror for Java 9 once we upgrade AutoValue (issue #1017).
it.options.compilerArgs += ["-Werror"]
@@ -151,6 +156,7 @@ subprojects {
}
ext {
+ appengineVersion = '1.9.63'
autoValueVersion = '1.4'
findBugsVersion = '3.0.1'
errorProneVersion = '2.2.0'
@@ -160,10 +166,12 @@ subprojects {
googleCloudVersion = '0.47.0-beta'
signalfxVersion = '0.0.39'
prometheusVersion = '0.4.0'
+ protobufVersion = '3.5.1'
zipkinReporterVersion = '2.3.2'
jaegerReporterVersion = '0.24.0'
libraries = [
+ appengine_api: "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}",
auto_value: "com.google.auto.value:auto-value:${autoValueVersion}",
auto_service: 'com.google.auto.service:auto-service:1.0-rc3',
byte_buddy: 'net.bytebuddy:byte-buddy:1.7.11',
@@ -183,6 +191,7 @@ subprojects {
jsr305: "com.google.code.findbugs:jsr305:${findBugsVersion}",
signalfx_java: "com.signalfx.public:signalfx-java:${signalfxVersion}",
prometheus_simpleclient: "io.prometheus:simpleclient:${prometheusVersion}",
+ protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
// Test dependencies.
guava_testlib: "com.google.guava:guava-testlib:${guavaVersion}",
@@ -359,6 +368,7 @@ subprojects {
uploadArchives.onlyIf {
name in ['opencensus-api',
'opencensus-contrib-agent',
+ 'opencensus-contrib-appengine-standard-util',
'opencensus-contrib-grpc-metrics',
'opencensus-contrib-grpc-util',
'opencensus-contrib-http-util',
@@ -397,7 +407,7 @@ subprojects {
compile.options.compilerArgs += [
'-Xmaxerrs', '10000',
"-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}",
- "-AskipDefs=\\.AutoValue_",
+ "-AskipDefs=[\\.AutoValue_|\\.TraceIdProto]",
"-AinvariantArrays"
]
options.fork = true
diff --git a/buildscripts/import-control.xml b/buildscripts/import-control.xml
index 38cd747d..845bcc87 100644
--- a/buildscripts/import-control.xml
+++ b/buildscripts/import-control.xml
@@ -73,6 +73,10 @@ General guidelines on imports:
<allow pkg="io.opencensus.trace"/>
<allow pkg="net.bytebuddy"/>
</subpackage>
+ <subpackage name="appengine.standard.util">
+ <allow pkg="com.google.apphosting"/>
+ <allow pkg="io.opencensus.trace"/>
+ </subpackage>
<subpackage name="grpc.metrics">
<allow pkg="io.opencensus.contrib.grpc.metrics"/>
<allow pkg="io.opencensus.stats"/>
diff --git a/contrib/appengine_standard_util/README.md b/contrib/appengine_standard_util/README.md
new file mode 100644
index 00000000..ba1a4871
--- /dev/null
+++ b/contrib/appengine_standard_util/README.md
@@ -0,0 +1,35 @@
+# OpenCensus AppEngine Standard Util
+[![Build Status][travis-image]][travis-url]
+[![Windows Build Status][appveyor-image]][appveyor-url]
+[![Maven Central][maven-image]][maven-url]
+
+The *OpenCensus AppEngine Standard Util for Java* is a collection of utilities for trace
+instrumentation when working with [AppEngine][appengine-url].
+
+## Quickstart
+
+### Add the dependencies to your project
+
+For Maven add to your `pom.xml`:
+```xml
+<dependencies>
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-appengine-standard-util</artifactId>
+ <version>0.14.0</version>
+ </dependency>
+</dependencies>
+```
+
+For Gradle add to your dependencies:
+```gradle
+compile 'io.opencensus:opencensus-contrib-appengine-standard-util:0.14.0'
+```
+
+[travis-image]: https://travis-ci.org/census-instrumentation/opencensus-java.svg?branch=master
+[travis-url]: https://travis-ci.org/census-instrumentation/opencensus-java
+[appveyor-image]: https://ci.appveyor.com/api/projects/status/hxthmpkxar4jq4be/branch/master?svg=true
+[appveyor-url]: https://ci.appveyor.com/project/opencensusjavateam/opencensus-java/branch/master
+[maven-image]: https://maven-badges.herokuapp.com/maven-central/io.opencensus/opencensus-contrib-appengine-standard-util/badge.svg
+[maven-url]: https://maven-badges.herokuapp.com/maven-central/io.opencensus/opencensus-contrib-appengine-standard-util
+[appengine-url]: https://appengine.google.com/
diff --git a/contrib/appengine_standard_util/build.gradle b/contrib/appengine_standard_util/build.gradle
new file mode 100644
index 00000000..a5c122a6
--- /dev/null
+++ b/contrib/appengine_standard_util/build.gradle
@@ -0,0 +1,52 @@
+description = 'OpenCensus AppEngine Standard Util'
+
+apply plugin: 'java'
+apply plugin: 'com.google.protobuf'
+
+def protocVersion = '3.5.1-1'
+
+buildscript {
+ repositories {
+ maven { url "https://plugins.gradle.org/m2/" }
+ }
+ dependencies {
+ classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.5"
+ }
+}
+
+[compileJava, compileTestJava].each() {
+ it.sourceCompatibility = 1.7
+ it.targetCompatibility = 1.7
+}
+
+dependencies {
+ compile project(':opencensus-api'),
+ libraries.appengine_api,
+ libraries.guava,
+ libraries.protobuf
+
+ signature "org.codehaus.mojo.signature:java18:+@signature"
+}
+
+protobuf {
+ protoc {
+ // The artifact spec for the Protobuf Compiler
+ artifact = "com.google.protobuf:protoc:${protocVersion}"
+ }
+
+ generatedFilesBaseDir = "$projectDir/gen_gradle/src"
+
+ generateProtoTasks {
+ all().each { task ->
+ task.builtins {
+ java {
+ option 'annotate_code'
+ }
+ }
+ }
+ }
+}
+
+clean {
+ delete protobuf.generatedFilesBaseDir
+}
diff --git a/contrib/appengine_standard_util/src/main/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtils.java b/contrib/appengine_standard_util/src/main/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtils.java
new file mode 100644
index 00000000..aff2ee3e
--- /dev/null
+++ b/contrib/appengine_standard_util/src/main/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtils.java
@@ -0,0 +1,95 @@
+/*
+ * 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.contrib.appengine.standard.util;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.apphosting.api.CloudTraceContext;
+import com.google.common.annotations.VisibleForTesting;
+import io.opencensus.trace.SpanContext;
+import io.opencensus.trace.SpanId;
+import io.opencensus.trace.TraceId;
+import io.opencensus.trace.TraceOptions;
+import java.nio.ByteBuffer;
+
+/**
+ * Utility class to convert between {@link io.opencensus.trace.SpanContext} and {@link
+ * CloudTraceContext}.
+ *
+ * @since 0.14
+ */
+public final class AppEngineCloudTraceContextUtils {
+ private static final byte[] INVALID_TRACE_ID =
+ TraceIdProto.newBuilder().setHi(0).setLo(0).build().toByteArray();
+ private static final long INVALID_SPAN_ID = 0L;
+ private static final long INVALID_TRACE_MASK = 0L;
+
+ @VisibleForTesting
+ static final CloudTraceContext INVALID_CLOUD_TRACE_CONTEXT =
+ new CloudTraceContext(INVALID_TRACE_ID, INVALID_SPAN_ID, INVALID_TRACE_MASK);
+
+ /**
+ * Converts AppEngine {@code CloudTraceContext} to {@code SpanContext}.
+ *
+ * @param cloudTraceContext the AppEngine {@code CloudTraceContext}.
+ * @return the converted {@code SpanContext}.
+ * @since 0.14
+ */
+ public static SpanContext fromCloudTraceContext(CloudTraceContext cloudTraceContext) {
+ checkNotNull(cloudTraceContext, "cloudTraceContext");
+
+ try {
+ // Extract the trace ID from the binary protobuf CloudTraceContext#traceId.
+ TraceIdProto traceIdProto = TraceIdProto.parseFrom(cloudTraceContext.getTraceId());
+ ByteBuffer traceIdBuf = ByteBuffer.allocate(TraceId.SIZE);
+ traceIdBuf.putLong(traceIdProto.getHi());
+ traceIdBuf.putLong(traceIdProto.getLo());
+ ByteBuffer spanIdBuf = ByteBuffer.allocate(SpanId.SIZE);
+ spanIdBuf.putLong(cloudTraceContext.getSpanId());
+
+ return SpanContext.create(
+ TraceId.fromBytes(traceIdBuf.array()),
+ SpanId.fromBytes(spanIdBuf.array()),
+ TraceOptions.builder().setIsSampled(cloudTraceContext.isTraceEnabled()).build());
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Converts {@code SpanContext} to AppEngine {@code CloudTraceContext}.
+ *
+ * @param spanContext the {@code SpanContext}.
+ * @return the converted AppEngine {@code CloudTraceContext}.
+ * @since 0.14
+ */
+ public static CloudTraceContext toCloudTraceContext(SpanContext spanContext) {
+ checkNotNull(spanContext, "spanContext");
+
+ ByteBuffer traceIdBuf = ByteBuffer.wrap(spanContext.getTraceId().getBytes());
+ TraceIdProto traceIdProto =
+ TraceIdProto.newBuilder().setHi(traceIdBuf.getLong()).setLo(traceIdBuf.getLong()).build();
+ ByteBuffer spanIdBuf = ByteBuffer.wrap(spanContext.getSpanId().getBytes());
+
+ return new CloudTraceContext(
+ traceIdProto.toByteArray(),
+ spanIdBuf.getLong(),
+ spanContext.getTraceOptions().isSampled() ? 1L : 0L);
+ }
+
+ private AppEngineCloudTraceContextUtils() {}
+}
diff --git a/contrib/appengine_standard_util/src/main/proto/trace_id.proto b/contrib/appengine_standard_util/src/main/proto/trace_id.proto
new file mode 100644
index 00000000..35e2e087
--- /dev/null
+++ b/contrib/appengine_standard_util/src/main/proto/trace_id.proto
@@ -0,0 +1,10 @@
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "io.opencensus.contrib.appengine.standard.util";
+option java_outer_classname = "TraceProto";
+
+message TraceIdProto {
+ fixed64 hi = 1;
+ fixed64 lo = 2;
+}
diff --git a/contrib/appengine_standard_util/src/test/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtilsTest.java b/contrib/appengine_standard_util/src/test/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtilsTest.java
new file mode 100644
index 00000000..dc53d8f3
--- /dev/null
+++ b/contrib/appengine_standard_util/src/test/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtilsTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.contrib.appengine.standard.util;
+
+import static com.google.common.truth.Truth.assertThat;
+import static io.opencensus.contrib.appengine.standard.util.AppEngineCloudTraceContextUtils.INVALID_CLOUD_TRACE_CONTEXT;
+
+import com.google.apphosting.api.CloudTraceContext;
+import io.opencensus.trace.SpanContext;
+import io.opencensus.trace.SpanId;
+import io.opencensus.trace.TraceId;
+import io.opencensus.trace.TraceOptions;
+import java.util.Arrays;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Unit tests for {@link AppEngineCloudTraceContextUtils}. */
+@RunWith(JUnit4.class)
+public class AppEngineCloudTraceContextUtilsTest {
+ @Test
+ public void toFromSampledCloudTraceContext() {
+ CloudTraceContext cloudTraceContext =
+ new CloudTraceContext(
+ // Protobuf-encoded upper and lower 64 bits of the example trace ID
+ // fae1c6346b9cf9a272cb6504b5a10dcc/123456789.
+ new byte[] {
+ (byte) 0x09,
+ (byte) 0xa2,
+ (byte) 0xf9,
+ (byte) 0x9c,
+ (byte) 0x6b,
+ (byte) 0x34,
+ (byte) 0xc6,
+ (byte) 0xe1,
+ (byte) 0xfa,
+ (byte) 0x11,
+ (byte) 0xcc,
+ (byte) 0x0d,
+ (byte) 0xa1,
+ (byte) 0xb5,
+ (byte) 0x04,
+ (byte) 0x65,
+ (byte) 0xcb,
+ (byte) 0x72
+ },
+ Long.MIN_VALUE,
+ // Trace enabled.
+ 1L);
+
+ SpanContext spanContext =
+ AppEngineCloudTraceContextUtils.fromCloudTraceContext(cloudTraceContext);
+
+ assertThat(spanContext)
+ .isEqualTo(
+ SpanContext.create(
+ TraceId.fromLowerBase16("fae1c6346b9cf9a272cb6504b5a10dcc"),
+ SpanId.fromLowerBase16("8000000000000000"),
+ TraceOptions.builder().setIsSampled(true).build()));
+
+ // CloudTraceContext does not implement equals, so need to check every argument.
+ CloudTraceContext newCloudTraceContext =
+ AppEngineCloudTraceContextUtils.toCloudTraceContext(spanContext);
+ assertThat(newCloudTraceContext.getTraceId()).isEqualTo(cloudTraceContext.getTraceId());
+ assertThat(newCloudTraceContext.getSpanId()).isEqualTo(cloudTraceContext.getSpanId());
+ assertThat(newCloudTraceContext.getTraceMask()).isEqualTo(cloudTraceContext.getTraceMask());
+ }
+
+ @Test
+ public void toFromNotSampledCloudTraceContext() {
+ CloudTraceContext cloudTraceContext =
+ new CloudTraceContext(
+ // Protobuf-encoded upper and lower 64 bits of the example trace ID
+ // fae1c6346b9cf9a272cb6504b5a10dcc/123456789.
+ new byte[] {
+ (byte) 0x09,
+ (byte) 0xa2,
+ (byte) 0xf9,
+ (byte) 0x9c,
+ (byte) 0x6b,
+ (byte) 0x34,
+ (byte) 0xc6,
+ (byte) 0xe1,
+ (byte) 0xfa,
+ (byte) 0x11,
+ (byte) 0xcc,
+ (byte) 0x0d,
+ (byte) 0xa1,
+ (byte) 0xb5,
+ (byte) 0x04,
+ (byte) 0x65,
+ (byte) 0xcb,
+ (byte) 0x72
+ },
+ Long.MIN_VALUE,
+ // Trace disabled.
+ 0L);
+
+ SpanContext spanContext =
+ AppEngineCloudTraceContextUtils.fromCloudTraceContext(cloudTraceContext);
+
+ assertThat(spanContext)
+ .isEqualTo(
+ SpanContext.create(
+ TraceId.fromLowerBase16("fae1c6346b9cf9a272cb6504b5a10dcc"),
+ SpanId.fromLowerBase16("8000000000000000"),
+ TraceOptions.builder().setIsSampled(false).build()));
+
+ // CloudTraceContext does not implement equals, so need to check every argument.
+ assertThat(
+ cloudTraceContextEquals(
+ AppEngineCloudTraceContextUtils.toCloudTraceContext(spanContext),
+ cloudTraceContext))
+ .isTrue();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void toCloudTraceContext_Null() {
+ AppEngineCloudTraceContextUtils.fromCloudTraceContext(null);
+ }
+
+ @Test
+ public void toCloudTraceContext_Invalid() {
+ assertThat(AppEngineCloudTraceContextUtils.fromCloudTraceContext(INVALID_CLOUD_TRACE_CONTEXT))
+ .isEqualTo(SpanContext.INVALID);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void fromCloudTraceContext_Null() {
+ AppEngineCloudTraceContextUtils.toCloudTraceContext(null);
+ }
+
+ @Test
+ public void fromCloudTraceContext_Invalid() {
+ assertThat(
+ cloudTraceContextEquals(
+ AppEngineCloudTraceContextUtils.toCloudTraceContext(SpanContext.INVALID),
+ INVALID_CLOUD_TRACE_CONTEXT))
+ .isTrue();
+ }
+
+ private static boolean cloudTraceContextEquals(CloudTraceContext obj1, CloudTraceContext obj2) {
+ return Arrays.equals(obj1.getTraceId(), obj2.getTraceId())
+ && obj1.getSpanId() == obj2.getSpanId()
+ && obj1.getTraceMask() == obj2.getTraceMask();
+ }
+}
diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml
index 87002bd0..78b915b9 100644
--- a/findbugs-exclude.xml
+++ b/findbugs-exclude.xml
@@ -2,38 +2,44 @@
<Match>
<!-- Reason: Null has a different meaning than a zero-length array in this case. -->
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
- <Class name="io.opencensus.stats.MutableDistribution" />
- <Method name="getInternalBucketCountsArray" />
+ <Class name="io.opencensus.stats.MutableDistribution"/>
+ <Method name="getInternalBucketCountsArray"/>
</Match>
<Match>
<!-- Reason: Equal is implemented in the AutoValue generated class. -->
<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
- <Class name="io.opencensus.common.Timestamp" />
- <Method name="compareTo" />
+ <Class name="io.opencensus.common.Timestamp"/>
+ <Method name="compareTo"/>
</Match>
<Match>
<!-- Reason: Equal is implemented in the AutoValue generated class. -->
<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
- <Class name="io.opencensus.common.Duration" />
- <Method name="compareTo" />
+ <Class name="io.opencensus.common.Duration"/>
+ <Method name="compareTo"/>
</Match>
<Match>
<!-- Reason: BaseMessageEvent only has two visible subclasses. -->
<Bug pattern="BC_UNCONFIRMED_CAST"/>
- <Class name="io.opencensus.trace.internal.BaseMessageEventUtils" />
+ <Class name="io.opencensus.trace.internal.BaseMessageEventUtils"/>
</Match>
<Match>
<!-- Reason: This test is testing for a NPE. -->
<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
- <Class name="io.opencensus.internal.UtilsTest" />
- <Method name="checkNotNull" />
+ <Class name="io.opencensus.internal.UtilsTest"/>
+ <Method name="checkNotNull"/>
</Match>
<Match>
<!-- Reason: It seems like FindBugs incorrectly assumes that all -->
<!-- Throwables are subclasses of Error or Exception. -->
<Bug pattern="BC_VACUOUS_INSTANCEOF"/>
- <Class name="io.opencensus.trace.CurrentSpanUtils$CallableInSpan" />
- <Method name="call" />
+ <Class name="io.opencensus.trace.CurrentSpanUtils$CallableInSpan"/>
+ <Method name="call"/>
+ </Match>
+ <Match>
+ <!-- Reason: Protobuf auto-generated code. -->
+ <Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
+ <Class name="io.opencensus.contrib.appengine.standard.util.TraceIdProto$Builder"/>
+ <Method name="maybeForceBuilderInitialization"/>
</Match>
<!-- Suppress some FindBugs warnings related to performance or robustness -->
@@ -41,27 +47,27 @@
<Match>
<!-- Reason: Only needed for performance. -->
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Match>
<Match>
<!-- Reason: Only needed for performance. -->
<Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Match>
<Match>
<!-- Reason: Only needed for performance. -->
<Bug pattern="UM_UNNECESSARY_MATH"/>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Match>
<Match>
<!-- Reason: This is less important in a test environment. -->
<Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Match>
<Match>
<!-- Reason: Many classes initialize fields in @Before methods. -->
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Match>
<!-- Suppress all FindBugs warnings about NullPointerExceptions in -->
@@ -71,19 +77,19 @@
<Match>
<Bug code="NP"/>
<Not>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Not>
</Match>
<Match>
<Bug pattern="UR_UNINIT_READ"/>
<Not>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Not>
</Match>
<Match>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
<Not>
- <Source name="~.*Test\.java" />
+ <Source name="~.*Test\.java"/>
</Not>
</Match>
</FindBugsFilter>
diff --git a/settings.gradle b/settings.gradle
index 3d9a0ee0..92c19282 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -14,6 +14,7 @@ include ":opencensus-exporter-stats-signalfx"
include ":opencensus-exporter-stats-stackdriver"
include ":opencensus-exporter-stats-prometheus"
include ":opencensus-contrib-agent"
+include ":opencensus-contrib-appengine-standard-util"
include ":opencensus-contrib-grpc-metrics"
include ":opencensus-contrib-grpc-util"
include ":opencensus-contrib-http-util"
@@ -25,6 +26,8 @@ project(':opencensus-impl-lite').projectDir = "$rootDir/impl_lite" as File
project(':opencensus-impl').projectDir = "$rootDir/impl" as File
project(':opencensus-testing').projectDir = "$rootDir/testing" as File
project(':opencensus-contrib-agent').projectDir = "$rootDir/contrib/agent" as File
+project(':opencensus-contrib-appengine-standard-util').projectDir =
+ "$rootDir/contrib/appengine_standard_util" as File
project(':opencensus-contrib-grpc-metrics').projectDir = "$rootDir/contrib/grpc_metrics" as File
project(':opencensus-contrib-grpc-util').projectDir = "$rootDir/contrib/grpc_util" as File
project(':opencensus-contrib-http-util').projectDir = "$rootDir/contrib/http_util" as File