diff --git a/gcloud-java-core/pom.xml b/gcloud-java-core/pom.xml
index 0a426d50a21b..50155634bd11 100644
--- a/gcloud-java-core/pom.xml
+++ b/gcloud-java-core/pom.xml
@@ -106,7 +106,7 @@
com.google.apigax
- 0.0.14
+ 0.0.16com.google.api.grpc
diff --git a/gcloud-java-trace/pom.xml b/gcloud-java-trace/pom.xml
new file mode 100644
index 000000000000..6796dc36415a
--- /dev/null
+++ b/gcloud-java-trace/pom.xml
@@ -0,0 +1,126 @@
+
+
+ 4.0.0
+ gcloud-java-trace
+ jar
+ GCloud Java Stackdriver Trace
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-trace
+
+ Java idiomatic client for Stackdriver Trace.
+
+
+ com.google.cloud
+ gcloud-java-pom
+ 0.2.9-SNAPSHOT
+
+
+ gcloud-java-trace
+
+
+
+ io.netty
+ netty-tcnative-boringssl-static
+ 1.1.33.Fork17
+
+
+ ${project.groupId}
+ gcloud-java-core
+ ${project.version}
+
+
+ com.google.api.grpc
+ grpc-google-devtools-cloudtrace-v1
+ 0.0.7
+
+
+ io.grpc
+ grpc-all
+ 0.15.0
+
+
+ com.google.auto.value
+ auto-value
+ 1.1
+
+
+ ${project.groupId}
+ gcloud-java-core
+ ${project.version}
+ test-jar
+ test
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ org.easymock
+ easymock
+ 3.4
+ test
+
+
+
+
+ doclint-java8-disable
+
+ [1.8,)
+
+
+
+ -Xdoclint:none
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.9.1
+
+
+ generate-sources
+ add-source
+
+
+ generated/src/main/java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+
+ attach-javadocs
+
+ jar
+
+
+ ${javadoc.opts}
+
+
+
+
+
+ maven-compiler-plugin
+
+
+
+ 3.1
+
+ 1.7
+ 1.7
+ UTF-8
+ -Xlint:unchecked
+
+
+
+
+
diff --git a/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceApi.java b/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceApi.java
new file mode 100644
index 000000000000..0e94787987e7
--- /dev/null
+++ b/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceApi.java
@@ -0,0 +1,422 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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 com.google.cloud.trace.spi.v1;
+
+import com.google.api.gax.core.PageAccessor;
+import com.google.api.gax.grpc.ApiCallable;
+import com.google.api.gax.protobuf.PathTemplate;
+import com.google.devtools.cloudtrace.v1.GetTraceRequest;
+import com.google.devtools.cloudtrace.v1.ListTracesRequest;
+import com.google.devtools.cloudtrace.v1.ListTracesResponse;
+import com.google.devtools.cloudtrace.v1.PatchTracesRequest;
+import com.google.devtools.cloudtrace.v1.Trace;
+import com.google.devtools.cloudtrace.v1.Traces;
+import com.google.protobuf.Empty;
+import io.grpc.ManagedChannel;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
+
+// AUTO-GENERATED DOCUMENTATION AND SERVICE
+/**
+ * Service Description: This file describes an API for collecting and viewing traces and spans
+ * within a trace. A Trace is a collection of spans corresponding to a single
+ * operation or set of operations for an application. A span is an individual
+ * timed event which forms a node of the trace tree. Spans for a single trace
+ * may span multiple services.
+ *
+ *
This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
Note: close() needs to be called on the traceServiceApi object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's methods:
+ *
+ *
+ *
A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available
+ * as parameters, and not every API method will have a flattened method entry point.
+ *
A "request object" method. This type of method only takes one parameter, a request
+ * object, which must be constructed before the call. Not every API method will have a request
+ * object method.
+ *
A "callable" method. This type of method takes no parameters and returns an immutable
+ * ApiCallable object, which can be used to initiate calls to the service.
+ *
+ *
+ *
See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parse method to extract the individual identifiers contained within names that are
+ * returned.
+ *
+ *
This class can be customized by passing in a custom instance of TraceServiceSettings to
+ * create(). For example:
+ *
+ *
+ */
+@javax.annotation.Generated("by GAPIC")
+public class TraceServiceApi implements AutoCloseable {
+ private final TraceServiceSettings settings;
+ private final ManagedChannel channel;
+ private final ScheduledExecutorService executor;
+ private final List closeables = new ArrayList<>();
+
+ private final ApiCallable patchTracesCallable;
+ private final ApiCallable getTraceCallable;
+ private final ApiCallable listTracesCallable;
+ private final ApiCallable> listTracesPagedCallable;
+
+ public final TraceServiceSettings getSettings() {
+ return settings;
+ }
+
+ /**
+ * Constructs an instance of TraceServiceApi with default settings.
+ */
+ public static final TraceServiceApi create() throws IOException {
+ return create(TraceServiceSettings.defaultBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of TraceServiceApi, using the given settings.
+ * The channels are created based on the settings passed in, or defaults for any
+ * settings that are not set.
+ */
+ public static final TraceServiceApi create(TraceServiceSettings settings) throws IOException {
+ return new TraceServiceApi(settings);
+ }
+
+ /**
+ * Constructs an instance of TraceServiceApi, using the given settings.
+ * This is protected so that it easy to make a subclass, but otherwise, the static
+ * factory methods should be preferred.
+ */
+ protected TraceServiceApi(TraceServiceSettings settings) throws IOException {
+ this.settings = settings;
+ this.executor = settings.getExecutorProvider().getOrBuildExecutor();
+ this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
+
+ this.patchTracesCallable =
+ ApiCallable.create(settings.patchTracesSettings(), this.channel, this.executor);
+ this.getTraceCallable =
+ ApiCallable.create(settings.getTraceSettings(), this.channel, this.executor);
+ this.listTracesCallable =
+ ApiCallable.create(settings.listTracesSettings(), this.channel, this.executor);
+ this.listTracesPagedCallable =
+ ApiCallable.createPagedVariant(settings.listTracesSettings(), this.channel, this.executor);
+
+ if (settings.getChannelProvider().shouldAutoClose()) {
+ closeables.add(
+ new Closeable() {
+ @Override
+ public void close() throws IOException {
+ channel.shutdown();
+ }
+ });
+ }
+ if (settings.getExecutorProvider().shouldAutoClose()) {
+ closeables.add(
+ new Closeable() {
+ @Override
+ public void close() throws IOException {
+ executor.shutdown();
+ }
+ });
+ }
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Sends new traces to Cloud Trace or updates existing traces. If the ID of
+ * a trace that you send matches that of an existing trace, any fields
+ * in the existing trace and its spans are overwritten by the provided values,
+ * and any new fields provided are merged with the existing trace data. If the
+ * ID does not match, a new trace is created.
+ *
+ * Sample code:
+ *
+ *
+ * @param projectId ID of the Cloud project where the trace data is stored.
+ * @param traces The body of the message.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ public final void patchTraces(String projectId, Traces traces) {
+ PatchTracesRequest request =
+ PatchTracesRequest.newBuilder().setProjectId(projectId).setTraces(traces).build();
+ patchTraces(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Sends new traces to Cloud Trace or updates existing traces. If the ID of
+ * a trace that you send matches that of an existing trace, any fields
+ * in the existing trace and its spans are overwritten by the provided values,
+ * and any new fields provided are merged with the existing trace data. If the
+ * ID does not match, a new trace is created.
+ *
+ * Sample code:
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ public final void patchTraces(PatchTracesRequest request) {
+ patchTracesCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Sends new traces to Cloud Trace or updates existing traces. If the ID of
+ * a trace that you send matches that of an existing trace, any fields
+ * in the existing trace and its spans are overwritten by the provided values,
+ * and any new fields provided are merged with the existing trace data. If the
+ * ID does not match, a new trace is created.
+ *
+ * Sample code:
+ *
+ *
+ * @param projectId ID of the Cloud project where the trace data is stored.
+ * @param traceId ID of the trace to return.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ public final Trace getTrace(String projectId, String traceId) {
+ GetTraceRequest request =
+ GetTraceRequest.newBuilder().setProjectId(projectId).setTraceId(traceId).build();
+ return getTrace(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a single trace by its ID.
+ *
+ * Sample code:
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ private final Trace getTrace(GetTraceRequest request) {
+ return getTraceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a single trace by its ID.
+ *
+ * Sample code:
+ *
+ */
+ public final ApiCallable getTraceCallable() {
+ return getTraceCallable;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns of a list of traces that match the specified filter conditions.
+ *
+ * Sample code:
+ *
+ *
+ * @param projectId ID of the Cloud project where the trace data is stored.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ public final PageAccessor listTraces(String projectId) {
+ ListTracesRequest request = ListTracesRequest.newBuilder().setProjectId(projectId).build();
+ return listTraces(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns of a list of traces that match the specified filter conditions.
+ *
+ * Sample code:
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
+ */
+ public final PageAccessor listTraces(ListTracesRequest request) {
+ return listTracesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns of a list of traces that match the specified filter conditions.
+ *
+ * Sample code:
+ *
+ */
+ public final ApiCallable> listTracesPagedCallable() {
+ return listTracesPagedCallable;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns of a list of traces that match the specified filter conditions.
+ *
+ * Sample code:
+ *
+ */
+ public final ApiCallable listTracesCallable() {
+ return listTracesCallable;
+ }
+
+ /**
+ * Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately
+ * cancelled.
+ */
+ @Override
+ public final void close() throws Exception {
+ for (AutoCloseable closeable : closeables) {
+ closeable.close();
+ }
+ }
+}
diff --git a/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java b/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java
new file mode 100644
index 000000000000..145adeffed56
--- /dev/null
+++ b/gcloud-java-trace/src/main/java/com/google/cloud/trace/spi/v1/TraceServiceSettings.java
@@ -0,0 +1,384 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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 com.google.cloud.trace.spi.v1;
+
+import com.google.api.gax.core.ConnectionSettings;
+import com.google.api.gax.core.RetrySettings;
+import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.PageStreamingCallSettings;
+import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.ServiceApiSettings;
+import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.auth.Credentials;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.devtools.cloudtrace.v1.GetTraceRequest;
+import com.google.devtools.cloudtrace.v1.ListTracesRequest;
+import com.google.devtools.cloudtrace.v1.ListTracesResponse;
+import com.google.devtools.cloudtrace.v1.PatchTracesRequest;
+import com.google.devtools.cloudtrace.v1.Trace;
+import com.google.devtools.cloudtrace.v1.TraceServiceGrpc;
+import com.google.protobuf.Empty;
+import io.grpc.ManagedChannel;
+import io.grpc.Status;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
+import org.joda.time.Duration;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Settings class to configure an instance of {@link TraceServiceApi}.
+ *
+ *
The default instance has everything set to sensible defaults:
+ *
+ *
+ *
The default service address (cloudtrace.googleapis.com) and default port (443)
+ * are used.
+ *
Credentials are acquired automatically through Application Default Credentials.
+ *
Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ *
The builder of this class is recursive, so contained classes are themselves builders.
+ * When build() is called, the tree of builders is called to create the complete settings
+ * object. For example, to set the total timeout of patchTraces to 30 seconds:
+ *
+ *