From e401ddb308c153e070fabfe7e9979eae1fefe5d6 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 09:30:20 +0000 Subject: [PATCH 1/8] chore: release 1.2.9-SNAPSHOT (#365) :robot: I have created a release \*beep\* \*boop\* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- google-cloud-trace-bom/pom.xml | 14 +++++++------- google-cloud-trace/pom.xml | 4 ++-- grpc-google-cloud-trace-v1/pom.xml | 4 ++-- grpc-google-cloud-trace-v2/pom.xml | 4 ++-- pom.xml | 10 +++++----- proto-google-cloud-trace-v1/pom.xml | 4 ++-- proto-google-cloud-trace-v2/pom.xml | 4 ++-- samples/snapshot/pom.xml | 6 +++--- versions.txt | 10 +++++----- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/google-cloud-trace-bom/pom.xml b/google-cloud-trace-bom/pom.xml index 1b1d0b91..bebaf4ce 100644 --- a/google-cloud-trace-bom/pom.xml +++ b/google-cloud-trace-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-trace-bom - 1.2.8 + 1.2.9-SNAPSHOT pom com.google.cloud @@ -63,32 +63,32 @@ com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT com.google.cloud google-cloud-trace - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/google-cloud-trace/pom.xml b/google-cloud-trace/pom.xml index 6c36488b..3d5985a7 100644 --- a/google-cloud-trace/pom.xml +++ b/google-cloud-trace/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-trace - 1.2.8 + 1.2.9-SNAPSHOT jar Google Cloud Trace https://github.com/googleapis/java-trace @@ -13,7 +13,7 @@ com.google.cloud google-cloud-trace-parent - 1.2.8 + 1.2.9-SNAPSHOT google-cloud-trace diff --git a/grpc-google-cloud-trace-v1/pom.xml b/grpc-google-cloud-trace-v1/pom.xml index f43589f7..45320547 100644 --- a/grpc-google-cloud-trace-v1/pom.xml +++ b/grpc-google-cloud-trace-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT grpc-google-cloud-trace-v1 GRPC library for grpc-google-cloud-trace-v1 com.google.cloud google-cloud-trace-parent - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/grpc-google-cloud-trace-v2/pom.xml b/grpc-google-cloud-trace-v2/pom.xml index 07deae21..9bebef72 100644 --- a/grpc-google-cloud-trace-v2/pom.xml +++ b/grpc-google-cloud-trace-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT grpc-google-cloud-trace-v2 GRPC library for grpc-google-cloud-trace-v2 com.google.cloud google-cloud-trace-parent - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/pom.xml b/pom.xml index 0204611c..0188ff7f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-trace-parent pom - 1.2.8 + 1.2.9-SNAPSHOT Google Cloud Trace Parent https://github.com/googleapis/java-core @@ -158,22 +158,22 @@ com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/proto-google-cloud-trace-v1/pom.xml b/proto-google-cloud-trace-v1/pom.xml index 60f0768f..3de36470 100644 --- a/proto-google-cloud-trace-v1/pom.xml +++ b/proto-google-cloud-trace-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.8 + 1.2.9-SNAPSHOT proto-google-cloud-trace-v1 PROTO library for proto-google-cloud-trace-v1 com.google.cloud google-cloud-trace-parent - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/proto-google-cloud-trace-v2/pom.xml b/proto-google-cloud-trace-v2/pom.xml index d8d9403d..cc0392ed 100644 --- a/proto-google-cloud-trace-v2/pom.xml +++ b/proto-google-cloud-trace-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.8 + 1.2.9-SNAPSHOT proto-google-cloud-trace-v2 PROTO library for proto-google-cloud-trace-v2 com.google.cloud google-cloud-trace-parent - 1.2.8 + 1.2.9-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 20fcb0c8..3dc489b8 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,19 +28,19 @@ com.google.cloud google-cloud-trace - 1.2.8 + 1.2.9-SNAPSHOT junit junit - 1.2.8 + 1.2.9-SNAPSHOT test com.google.truth truth - 1.2.8 + 1.2.9-SNAPSHOT test diff --git a/versions.txt b/versions.txt index 0a979856..8335a9f0 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-trace:1.2.8:1.2.8 -grpc-google-cloud-trace-v1:1.2.8:1.2.8 -grpc-google-cloud-trace-v2:1.2.8:1.2.8 -proto-google-cloud-trace-v1:1.2.8:1.2.8 -proto-google-cloud-trace-v2:1.2.8:1.2.8 +google-cloud-trace:1.2.8:1.2.9-SNAPSHOT +grpc-google-cloud-trace-v1:1.2.8:1.2.9-SNAPSHOT +grpc-google-cloud-trace-v2:1.2.8:1.2.9-SNAPSHOT +proto-google-cloud-trace-v1:1.2.8:1.2.9-SNAPSHOT +proto-google-cloud-trace-v2:1.2.8:1.2.9-SNAPSHOT From 4af695516ec16d7c99bbd3229ee12cfafaa329ca Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 8 Dec 2020 11:20:16 -0800 Subject: [PATCH 2/8] chore: Update publish_javadoc.sh (#367) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/4d646a8e-ed5d-4464-beec-8e528709fd94/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5d11bd2888c38ce1fb6fa6bf25494a4219a73928 --- .kokoro/release/publish_javadoc.sh | 7 ++++--- synth.metadata | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index bc3de464..cbcc8dcc 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -38,8 +38,8 @@ python3 -m pip install gcp-docuploader # compile all packages mvn clean install -B -q -DskipTests=true -NAME=google-cloud-trace -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +export NAME=google-cloud-trace +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) # build the docs mvn site -B -q @@ -59,7 +59,8 @@ python3 -m docuploader upload . \ popd -# V2 +# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. + mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" pushd target/devsite/reference diff --git a/synth.metadata b/synth.metadata index c724e262..22e82406 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-trace.git", - "sha": "0c94acad2847d4c1eb4e2a183d42d9b39e12f763" + "sha": "e401ddb308c153e070fabfe7e9979eae1fefe5d6" } }, { @@ -27,7 +27,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "943bb78606d035001123030067dffcc34f4645f2" + "sha": "5d11bd2888c38ce1fb6fa6bf25494a4219a73928" } } ], From 99d244884e743993a71cea3a73278d83d4857e52 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 14 Dec 2020 11:06:16 -0800 Subject: [PATCH 3/8] chore: migrate to microgenerator (#370) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7b434ed7-41bc-42d7-adee-51bd18fb325b/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 346372957 Source-Link: https://github.com/googleapis/googleapis/commit/857f70daef9f4c38f042fb3dfb7b8423ae18fd19 PiperOrigin-RevId: 346126713 Source-Link: https://github.com/googleapis/googleapis/commit/b8b2f8c288cec1f673bf10aa5008819c1576bf2e PiperOrigin-RevId: 345749672 Source-Link: https://github.com/googleapis/googleapis/commit/d3a630b0db63a11420e57c7a0d718e511203f022 PiperOrigin-RevId: 345067549 Source-Link: https://github.com/googleapis/googleapis/commit/8cfc6c874574b649b4524a4ef6a0651533325a84 PiperOrigin-RevId: 344134135 Source-Link: https://github.com/googleapis/googleapis/commit/b11a87f3b54be3a5e42c15020ee1e0781f86da90 --- .../cloud/trace/v1/TraceServiceClient.java | 281 ++++-------------- .../cloud/trace/v1/TraceServiceSettings.java | 58 ++-- .../google/cloud/trace/v1/package-info.java | 20 +- .../stub/GrpcTraceServiceCallableFactory.java | 40 ++- .../trace/v1/stub/GrpcTraceServiceStub.java | 95 +++--- .../cloud/trace/v1/stub/TraceServiceStub.java | 17 +- .../v1/stub/TraceServiceStubSettings.java | 225 +++++++------- .../cloud/trace/v2/TraceServiceClient.java | 181 +++-------- .../cloud/trace/v2/TraceServiceSettings.java | 54 ++-- .../google/cloud/trace/v2/package-info.java | 20 +- .../stub/GrpcTraceServiceCallableFactory.java | 40 ++- .../trace/v2/stub/GrpcTraceServiceStub.java | 70 +++-- .../cloud/trace/v2/stub/TraceServiceStub.java | 17 +- .../v2/stub/TraceServiceStubSettings.java | 114 ++++--- .../cloud/trace/v1/MockTraceService.java | 6 +- .../cloud/trace/v1/MockTraceServiceImpl.java | 18 +- .../trace/v1/TraceServiceClientTest.java | 133 ++++----- .../cloud/trace/v1/TraceServiceSmokeTest.java | 64 ---- .../cloud/trace/v2/MockTraceService.java | 6 +- .../cloud/trace/v2/MockTraceServiceImpl.java | 14 +- .../trace/v2/TraceServiceClientTest.java | 194 +++++++----- .../cloud/trace/v2/TraceServiceSmokeTest.java | 67 ----- .../devtools/cloudtrace/v2/ProjectName.java | 86 +++--- .../devtools/cloudtrace/v2/SpanName.java | 112 +++---- synth.metadata | 12 +- 25 files changed, 810 insertions(+), 1134 deletions(-) delete mode 100644 google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceSmokeTest.java delete mode 100644 google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceSmokeTest.java diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java index 62e4c794..704f9400 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1; import com.google.api.core.ApiFunction; @@ -40,7 +41,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * 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 @@ -50,17 +51,7 @@ *

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: * - *

- * 
- * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
- *   String projectId = "";
- *   Traces traces = Traces.newBuilder().build();
- *   traceServiceClient.patchTraces(projectId, traces);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the traceServiceClient object to clean up resources such + *

Note: close() needs to be called on the TraceServiceClient 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 @@ -88,30 +79,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * TraceServiceSettings traceServiceSettings =
  *     TraceServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * TraceServiceClient traceServiceClient =
- *     TraceServiceClient.create(traceServiceSettings);
- * 
- * 
+ * TraceServiceClient traceServiceClient = TraceServiceClient.create(traceServiceSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * TraceServiceSettings traceServiceSettings =
  *     TraceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * TraceServiceClient traceServiceClient =
- *     TraceServiceClient.create(traceServiceSettings);
- * 
- * 
+ * TraceServiceClient traceServiceClient = TraceServiceClient.create(traceServiceSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class TraceServiceClient implements BackgroundResource { private final TraceServiceSettings settings; private final TraceServiceStub stub; @@ -131,7 +118,7 @@ public static final TraceServiceClient create(TraceServiceSettings settings) thr /** * Constructs an instance of TraceServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer to use TraceServiceSettings}. + * for advanced usage - prefer using create(TraceServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final TraceServiceClient create(TraceServiceStub stub) { @@ -163,103 +150,10 @@ public TraceServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sends new traces to Stackdriver 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: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   Traces traces = Traces.newBuilder().build();
-   *   traceServiceClient.patchTraces(projectId, traces);
-   * }
-   * 
- * - * @param projectId Required. ID of the Cloud project where the trace data is stored. - * @param traces Required. The body of the message. - * @throws com.google.api.gax.rpc.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 Stackdriver 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: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   Traces traces = Traces.newBuilder().build();
-   *   PatchTracesRequest request = PatchTracesRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .setTraces(traces)
-   *     .build();
-   *   traceServiceClient.patchTraces(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void patchTraces(PatchTracesRequest request) { - patchTracesCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sends new traces to Stackdriver 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: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   Traces traces = Traces.newBuilder().build();
-   *   PatchTracesRequest request = PatchTracesRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .setTraces(traces)
-   *     .build();
-   *   ApiFuture<Void> future = traceServiceClient.patchTracesCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
- */ - public final UnaryCallable patchTracesCallable() { - return stub.patchTracesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns of a list of traces that match the specified filter conditions. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   for (Trace element : traceServiceClient.listTraces(projectId).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param projectId Required. ID of the Cloud project where the trace data is stored. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -268,24 +162,10 @@ public final ListTracesPagedResponse listTraces(String projectId) { return listTraces(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns of a list of traces that match the specified filter conditions. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   ListTracesRequest request = ListTracesRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .build();
-   *   for (Trace element : traceServiceClient.listTraces(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -293,75 +173,30 @@ public final ListTracesPagedResponse listTraces(ListTracesRequest request) { return listTracesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns of a list of traces that match the specified filter conditions. * *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   ListTracesRequest request = ListTracesRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .build();
-   *   ApiFuture<ListTracesPagedResponse> future = traceServiceClient.listTracesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Trace element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listTracesPagedCallable() { return stub.listTracesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns of a list of traces that match the specified filter conditions. * *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   ListTracesRequest request = ListTracesRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .build();
-   *   while (true) {
-   *     ListTracesResponse response = traceServiceClient.listTracesCallable().call(request);
-   *     for (Trace element : response.getTracesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listTracesCallable() { return stub.listTracesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a single trace by its ID. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   String traceId = "";
-   *   Trace response = traceServiceClient.getTrace(projectId, traceId);
-   * }
-   * 
- * * @param projectId Required. ID of the Cloud project where the trace data is stored. * @param traceId Required. ID of the trace to return. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -372,24 +207,10 @@ public final Trace getTrace(String projectId, String traceId) { return getTrace(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a single trace by its ID. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   String traceId = "";
-   *   GetTraceRequest request = GetTraceRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .setTraceId(traceId)
-   *     .build();
-   *   Trace response = traceServiceClient.getTrace(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -397,30 +218,60 @@ public final Trace getTrace(GetTraceRequest request) { return getTraceCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a single trace by its ID. * *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   String projectId = "";
-   *   String traceId = "";
-   *   GetTraceRequest request = GetTraceRequest.newBuilder()
-   *     .setProjectId(projectId)
-   *     .setTraceId(traceId)
-   *     .build();
-   *   ApiFuture<Trace> future = traceServiceClient.getTraceCallable().futureCall(request);
-   *   // Do something
-   *   Trace response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getTraceCallable() { return stub.getTraceCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sends new traces to Stackdriver 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. + * + * @param projectId Required. ID of the Cloud project where the trace data is stored. + * @param traces Required. The body of the message. + * @throws com.google.api.gax.rpc.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 Stackdriver 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. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void patchTraces(PatchTracesRequest request) { + patchTracesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sends new traces to Stackdriver 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: + */ + public final UnaryCallable patchTracesCallable() { + return stub.patchTracesCallable(); + } + @Override public final void close() { stub.close(); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceSettings.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceSettings.java index 2f66b358..1f5a94f8 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceSettings.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1; import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; @@ -39,7 +40,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TraceServiceClient}. * @@ -54,29 +55,24 @@ *

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: + *

For example, to set the total timeout of getTrace to 30 seconds: * - *

- * 
- * TraceServiceSettings.Builder traceServiceSettingsBuilder =
- *     TraceServiceSettings.newBuilder();
+ * 
{@code
+ * TraceServiceSettings.Builder traceServiceSettingsBuilder = TraceServiceSettings.newBuilder();
  * traceServiceSettingsBuilder
- *     .patchTracesSettings()
+ *     .getTraceSettings()
  *     .setRetrySettings(
- *         traceServiceSettingsBuilder.patchTracesSettings().getRetrySettings().toBuilder()
+ *         traceServiceSettingsBuilder
+ *             .getTraceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TraceServiceSettings traceServiceSettings = traceServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class TraceServiceSettings extends ClientSettings { - /** Returns the object with the settings used for calls to patchTraces. */ - public UnaryCallSettings patchTracesSettings() { - return ((TraceServiceStubSettings) getStubSettings()).patchTracesSettings(); - } /** Returns the object with the settings used for calls to listTraces. */ public PagedCallSettings @@ -89,6 +85,11 @@ public UnaryCallSettings getTraceSettings() { return ((TraceServiceStubSettings) getStubSettings()).getTraceSettings(); } + /** Returns the object with the settings used for calls to patchTraces. */ + public UnaryCallSettings patchTracesSettings() { + return ((TraceServiceStubSettings) getStubSettings()).patchTracesSettings(); + } + public static final TraceServiceSettings create(TraceServiceStubSettings stub) throws IOException { return new TraceServiceSettings.Builder(stub.toBuilder()).build(); @@ -149,18 +150,15 @@ protected TraceServiceSettings(Builder settingsBuilder) throws IOException { /** Builder for TraceServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(TraceServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(TraceServiceStubSettings.newBuilder()); - } - protected Builder(TraceServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -169,11 +167,15 @@ protected Builder(TraceServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(TraceServiceStubSettings.newBuilder()); + } + public TraceServiceStubSettings.Builder getStubSettingsBuilder() { return ((TraceServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -186,11 +188,6 @@ public Builder applyToAllUnaryMethods( return this; } - /** Returns the builder for the settings used for calls to patchTraces. */ - public UnaryCallSettings.Builder patchTracesSettings() { - return getStubSettingsBuilder().patchTracesSettings(); - } - /** Returns the builder for the settings used for calls to listTraces. */ public PagedCallSettings.Builder listTracesSettings() { @@ -202,6 +199,11 @@ public UnaryCallSettings.Builder getTraceSettings() { return getStubSettingsBuilder().getTraceSettings(); } + /** Returns the builder for the settings used for calls to patchTraces. */ + public UnaryCallSettings.Builder patchTracesSettings() { + return getStubSettingsBuilder().patchTracesSettings(); + } + @Override public TraceServiceSettings build() throws IOException { return new TraceServiceSettings(this); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/package-info.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/package-info.java index e1052539..6159c654 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/package-info.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -15,11 +15,9 @@ */ /** - * A client to Stackdriver Trace API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

================== TraceServiceClient ================== + *

======================= TraceServiceClient ======================= * *

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 @@ -27,18 +25,8 @@ * trace tree. Spans for a single trace may span multiple services. * *

Sample for TraceServiceClient: - * - *

- * 
- * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
- *   String projectId = "";
- *   Traces traces = Traces.newBuilder().build();
- *   traceServiceClient.patchTraces(projectId, traces);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.trace.v1; import javax.annotation.Generated; diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceCallableFactory.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceCallableFactory.java index 1272deb3..4ebce41e 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceCallableFactory.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Stackdriver Trace API. + * gRPC callable factory implementation for the TraceService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcTraceServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceStub.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceStub.java index 31db7e18..7684cc46 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceStub.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/GrpcTraceServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1.stub; import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -31,6 +31,7 @@ import com.google.devtools.cloudtrace.v1.ListTracesResponse; import com.google.devtools.cloudtrace.v1.PatchTracesRequest; import com.google.devtools.cloudtrace.v1.Trace; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -39,23 +40,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Stackdriver Trace API. + * gRPC stub implementation for the TraceService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcTraceServiceStub extends TraceServiceStub { - - private static final MethodDescriptor patchTracesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.devtools.cloudtrace.v1.TraceService/PatchTraces") - .setRequestMarshaller(ProtoUtils.marshaller(PatchTracesRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) - .build(); private static final MethodDescriptor listTracesMethodDescriptor = MethodDescriptor.newBuilder() @@ -64,6 +56,7 @@ public class GrpcTraceServiceStub extends TraceServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(ListTracesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListTracesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getTraceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -72,13 +65,21 @@ public class GrpcTraceServiceStub extends TraceServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(Trace.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; + private static final MethodDescriptor patchTracesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.devtools.cloudtrace.v1.TraceService/PatchTraces") + .setRequestMarshaller(ProtoUtils.marshaller(PatchTracesRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); - private final UnaryCallable patchTracesCallable; private final UnaryCallable listTracesCallable; private final UnaryCallable listTracesPagedCallable; private final UnaryCallable getTraceCallable; + private final UnaryCallable patchTracesCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcTraceServiceStub create(TraceServiceStubSettings settings) @@ -117,20 +118,8 @@ protected GrpcTraceServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - GrpcCallSettings patchTracesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(patchTracesMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(PatchTracesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("project_id", String.valueOf(request.getProjectId())); - return params.build(); - } - }) - .build(); GrpcCallSettings listTracesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listTracesMethodDescriptor) @@ -147,11 +136,31 @@ public Map extract(ListTracesRequest request) { GrpcCallSettings getTraceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getTraceMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetTraceRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("project_id", String.valueOf(request.getProjectId())); + params.put("trace_id", String.valueOf(request.getTraceId())); + return params.build(); + } + }) + .build(); + GrpcCallSettings patchTracesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(patchTracesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(PatchTracesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("project_id", String.valueOf(request.getProjectId())); + return params.build(); + } + }) .build(); - this.patchTracesCallable = - callableFactory.createUnaryCallable( - patchTracesTransportSettings, settings.patchTracesSettings(), clientContext); this.listTracesCallable = callableFactory.createUnaryCallable( listTracesTransportSettings, settings.listTracesSettings(), clientContext); @@ -161,26 +170,34 @@ public Map extract(ListTracesRequest request) { this.getTraceCallable = callableFactory.createUnaryCallable( getTraceTransportSettings, settings.getTraceSettings(), clientContext); + this.patchTracesCallable = + callableFactory.createUnaryCallable( + patchTracesTransportSettings, settings.patchTracesSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public UnaryCallable patchTracesCallable() { - return patchTracesCallable; + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable listTracesPagedCallable() { - return listTracesPagedCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable listTracesCallable() { return listTracesCallable; } + public UnaryCallable listTracesPagedCallable() { + return listTracesPagedCallable; + } + public UnaryCallable getTraceCallable() { return getTraceCallable; } + public UnaryCallable patchTracesCallable() { + return patchTracesCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStub.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStub.java index 66771bf3..a32c76c0 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStub.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1.stub; import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.devtools.cloudtrace.v1.GetTraceRequest; @@ -28,20 +28,15 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Stackdriver Trace API. + * Base stub class for the TraceService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class TraceServiceStub implements BackgroundResource { - public UnaryCallable patchTracesCallable() { - throw new UnsupportedOperationException("Not implemented: patchTracesCallable()"); - } - public UnaryCallable listTracesPagedCallable() { throw new UnsupportedOperationException("Not implemented: listTracesPagedCallable()"); } @@ -54,6 +49,10 @@ public UnaryCallable getTraceCallable() { throw new UnsupportedOperationException("Not implemented: getTraceCallable()"); } + public UnaryCallable patchTracesCallable() { + throw new UnsupportedOperationException("Not implemented: patchTracesCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStubSettings.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStubSettings.java index d39efc73..690a9039 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStubSettings.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/stub/TraceServiceStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1.stub; import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; @@ -54,7 +55,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TraceServiceStub}. * @@ -69,24 +70,25 @@ *

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: + *

For example, to set the total timeout of getTrace to 30 seconds: * - *

- * 
+ * 
{@code
  * TraceServiceStubSettings.Builder traceServiceSettingsBuilder =
  *     TraceServiceStubSettings.newBuilder();
  * traceServiceSettingsBuilder
- *     .patchTracesSettings()
+ *     .getTraceSettings()
  *     .setRetrySettings(
- *         traceServiceSettingsBuilder.patchTracesSettings().getRetrySettings().toBuilder()
+ *         traceServiceSettingsBuilder
+ *             .getTraceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TraceServiceStubSettings traceServiceSettings = traceServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class TraceServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -96,15 +98,63 @@ public class TraceServiceStubSettings extends StubSettings patchTracesSettings; private final PagedCallSettings listTracesSettings; private final UnaryCallSettings getTraceSettings; + private final UnaryCallSettings patchTracesSettings; - /** Returns the object with the settings used for calls to patchTraces. */ - public UnaryCallSettings patchTracesSettings() { - return patchTracesSettings; - } + private static final PagedListDescriptor + LIST_TRACES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTracesRequest injectToken(ListTracesRequest payload, String token) { + return ListTracesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTracesRequest injectPageSize(ListTracesRequest payload, int pageSize) { + return ListTracesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTracesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTracesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListTracesResponse payload) { + return payload.getTracesList() == null + ? ImmutableList.of() + : payload.getTracesList(); + } + }; + + private static final PagedListResponseFactory< + ListTracesRequest, ListTracesResponse, ListTracesPagedResponse> + LIST_TRACES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTracesRequest, ListTracesResponse, ListTracesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTracesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TRACES_PAGE_STR_DESC, request, context); + return ListTracesPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to listTraces. */ public PagedCallSettings @@ -117,16 +167,21 @@ public UnaryCallSettings getTraceSettings() { return getTraceSettings; } + /** Returns the object with the settings used for calls to patchTraces. */ + public UnaryCallSettings patchTracesSettings() { + return patchTracesSettings; + } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public TraceServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcTraceServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -186,74 +241,19 @@ public Builder toBuilder() { protected TraceServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); - patchTracesSettings = settingsBuilder.patchTracesSettings().build(); listTracesSettings = settingsBuilder.listTracesSettings().build(); getTraceSettings = settingsBuilder.getTraceSettings().build(); + patchTracesSettings = settingsBuilder.patchTracesSettings().build(); } - private static final PagedListDescriptor - LIST_TRACES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListTracesRequest injectToken(ListTracesRequest payload, String token) { - return ListTracesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListTracesRequest injectPageSize(ListTracesRequest payload, int pageSize) { - return ListTracesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListTracesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListTracesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListTracesResponse payload) { - return payload.getTracesList() != null - ? payload.getTracesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListTracesRequest, ListTracesResponse, ListTracesPagedResponse> - LIST_TRACES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListTracesRequest, ListTracesResponse, ListTracesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListTracesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_TRACES_PAGE_STR_DESC, request, context); - return ListTracesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for TraceServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder patchTracesSettings; private final PagedCallSettings.Builder< ListTracesRequest, ListTracesResponse, ListTracesPagedResponse> listTracesSettings; private final UnaryCallSettings.Builder getTraceSettings; - + private final UnaryCallSettings.Builder patchTracesSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -261,11 +261,10 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -284,74 +283,70 @@ public static class Builder extends StubSettings.Builder>of( - patchTracesSettings, listTracesSettings, getTraceSettings); - + listTracesSettings, getTraceSettings, patchTracesSettings); initDefaults(this); } + protected Builder(TraceServiceStubSettings settings) { + super(settings); + + listTracesSettings = settings.listTracesSettings.toBuilder(); + getTraceSettings = settings.getTraceSettings.toBuilder(); + patchTracesSettings = settings.patchTracesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listTracesSettings, getTraceSettings, patchTracesSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - - builder - .patchTracesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - builder .listTracesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getTraceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - return builder; - } - - protected Builder(TraceServiceStubSettings settings) { - super(settings); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - patchTracesSettings = settings.patchTracesSettings.toBuilder(); - listTracesSettings = settings.listTracesSettings.toBuilder(); - getTraceSettings = settings.getTraceSettings.toBuilder(); + builder + .patchTracesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - unaryMethodSettingsBuilders = - ImmutableList.>of( - patchTracesSettings, listTracesSettings, getTraceSettings); + return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -367,11 +362,6 @@ public Builder applyToAllUnaryMethods( return unaryMethodSettingsBuilders; } - /** Returns the builder for the settings used for calls to patchTraces. */ - public UnaryCallSettings.Builder patchTracesSettings() { - return patchTracesSettings; - } - /** Returns the builder for the settings used for calls to listTraces. */ public PagedCallSettings.Builder listTracesSettings() { @@ -383,6 +373,11 @@ public UnaryCallSettings.Builder getTraceSettings() { return getTraceSettings; } + /** Returns the builder for the settings used for calls to patchTraces. */ + public UnaryCallSettings.Builder patchTracesSettings() { + return patchTracesSettings; + } + @Override public TraceServiceStubSettings build() throws IOException { return new TraceServiceStubSettings(this); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java index ae8a9d29..f4b8619c 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2; import com.google.api.core.BetaApi; @@ -29,7 +30,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * 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 @@ -39,17 +40,7 @@ *

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: * - *

- * 
- * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
- *   ProjectName name = ProjectName.of("[PROJECT]");
- *   List<Span> spans = new ArrayList<>();
- *   traceServiceClient.batchWriteSpans(name, spans);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the traceServiceClient object to clean up resources such + *

Note: close() needs to be called on the TraceServiceClient 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 @@ -77,30 +68,26 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * TraceServiceSettings traceServiceSettings =
  *     TraceServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * TraceServiceClient traceServiceClient =
- *     TraceServiceClient.create(traceServiceSettings);
- * 
- * 
+ * TraceServiceClient traceServiceClient = TraceServiceClient.create(traceServiceSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * TraceServiceSettings traceServiceSettings =
  *     TraceServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * TraceServiceClient traceServiceClient =
- *     TraceServiceClient.create(traceServiceSettings);
- * 
- * 
+ * TraceServiceClient traceServiceClient = TraceServiceClient.create(traceServiceSettings); + * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class TraceServiceClient implements BackgroundResource { private final TraceServiceSettings settings; private final TraceServiceStub stub; @@ -120,7 +107,7 @@ public static final TraceServiceClient create(TraceServiceSettings settings) thr /** * Constructs an instance of TraceServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer to use TraceServiceSettings}. + * for advanced usage - prefer using create(TraceServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final TraceServiceClient create(TraceServiceStub stub) { @@ -152,81 +139,10 @@ public TraceServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new span. - * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   SpanName name = SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]");
-   *   String spanId = "";
-   *   TruncatableString displayName = TruncatableString.newBuilder().build();
-   *   Timestamp startTime = Timestamp.newBuilder().build();
-   *   Timestamp endTime = Timestamp.newBuilder().build();
-   *   Span request = Span.newBuilder()
-   *     .setName(name.toString())
-   *     .setSpanId(spanId)
-   *     .setDisplayName(displayName)
-   *     .setStartTime(startTime)
-   *     .setEndTime(endTime)
-   *     .build();
-   *   Span response = traceServiceClient.createSpan(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Span createSpan(Span request) { - return createSpanCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new span. - * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   SpanName name = SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]");
-   *   String spanId = "";
-   *   TruncatableString displayName = TruncatableString.newBuilder().build();
-   *   Timestamp startTime = Timestamp.newBuilder().build();
-   *   Timestamp endTime = Timestamp.newBuilder().build();
-   *   Span request = Span.newBuilder()
-   *     .setName(name.toString())
-   *     .setSpanId(spanId)
-   *     .setDisplayName(displayName)
-   *     .setStartTime(startTime)
-   *     .setEndTime(endTime)
-   *     .build();
-   *   ApiFuture<Span> future = traceServiceClient.createSpanCallable().futureCall(request);
-   *   // Do something
-   *   Span response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable createSpanCallable() { - return stub.createSpanCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sends new spans to new or existing traces. You cannot update existing spans. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   ProjectName name = ProjectName.of("[PROJECT]");
-   *   List<Span> spans = new ArrayList<>();
-   *   traceServiceClient.batchWriteSpans(name, spans);
-   * }
-   * 
- * * @param name Required. The name of the project where the spans belong. The format is * `projects/[PROJECT_ID]`. * @param spans Required. A list of new spans. The span names must not match existing spans, or @@ -242,20 +158,10 @@ public final void batchWriteSpans(ProjectName name, List spans) { batchWriteSpans(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sends new spans to new or existing traces. You cannot update existing spans. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   ProjectName name = ProjectName.of("[PROJECT]");
-   *   List<Span> spans = new ArrayList<>();
-   *   traceServiceClient.batchWriteSpans(name.toString(), spans);
-   * }
-   * 
- * * @param name Required. The name of the project where the spans belong. The format is * `projects/[PROJECT_ID]`. * @param spans Required. A list of new spans. The span names must not match existing spans, or @@ -268,24 +174,10 @@ public final void batchWriteSpans(String name, List spans) { batchWriteSpans(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sends new spans to new or existing traces. You cannot update existing spans. * - *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   ProjectName name = ProjectName.of("[PROJECT]");
-   *   List<Span> spans = new ArrayList<>();
-   *   BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .addAllSpans(spans)
-   *     .build();
-   *   traceServiceClient.batchWriteSpans(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -293,30 +185,37 @@ public final void batchWriteSpans(BatchWriteSpansRequest request) { batchWriteSpansCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sends new spans to new or existing traces. You cannot update existing spans. * *

Sample code: - * - *


-   * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
-   *   ProjectName name = ProjectName.of("[PROJECT]");
-   *   List<Span> spans = new ArrayList<>();
-   *   BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .addAllSpans(spans)
-   *     .build();
-   *   ApiFuture<Void> future = traceServiceClient.batchWriteSpansCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable batchWriteSpansCallable() { return stub.batchWriteSpansCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new span. + * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Span createSpan(Span request) { + return createSpanCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new span. + * + *

Sample code: + */ + public final UnaryCallable createSpanCallable() { + return stub.createSpanCallable(); + } + @Override public final void close() { stub.close(); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceSettings.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceSettings.java index f949907b..7df61c55 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceSettings.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2; import com.google.api.core.ApiFunction; @@ -33,7 +34,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TraceServiceClient}. * @@ -50,33 +51,33 @@ * *

For example, to set the total timeout of batchWriteSpans to 30 seconds: * - *

- * 
- * TraceServiceSettings.Builder traceServiceSettingsBuilder =
- *     TraceServiceSettings.newBuilder();
+ * 
{@code
+ * TraceServiceSettings.Builder traceServiceSettingsBuilder = TraceServiceSettings.newBuilder();
  * traceServiceSettingsBuilder
  *     .batchWriteSpansSettings()
  *     .setRetrySettings(
- *         traceServiceSettingsBuilder.batchWriteSpansSettings().getRetrySettings().toBuilder()
+ *         traceServiceSettingsBuilder
+ *             .batchWriteSpansSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TraceServiceSettings traceServiceSettings = traceServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class TraceServiceSettings extends ClientSettings { - /** Returns the object with the settings used for calls to createSpan. */ - public UnaryCallSettings createSpanSettings() { - return ((TraceServiceStubSettings) getStubSettings()).createSpanSettings(); - } /** Returns the object with the settings used for calls to batchWriteSpans. */ public UnaryCallSettings batchWriteSpansSettings() { return ((TraceServiceStubSettings) getStubSettings()).batchWriteSpansSettings(); } + /** Returns the object with the settings used for calls to createSpan. */ + public UnaryCallSettings createSpanSettings() { + return ((TraceServiceStubSettings) getStubSettings()).createSpanSettings(); + } + public static final TraceServiceSettings create(TraceServiceStubSettings stub) throws IOException { return new TraceServiceSettings.Builder(stub.toBuilder()).build(); @@ -137,18 +138,15 @@ protected TraceServiceSettings(Builder settingsBuilder) throws IOException { /** Builder for TraceServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(TraceServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(TraceServiceStubSettings.newBuilder()); - } - protected Builder(TraceServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -157,11 +155,15 @@ protected Builder(TraceServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(TraceServiceStubSettings.newBuilder()); + } + public TraceServiceStubSettings.Builder getStubSettingsBuilder() { return ((TraceServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -174,16 +176,16 @@ public Builder applyToAllUnaryMethods( return this; } - /** Returns the builder for the settings used for calls to createSpan. */ - public UnaryCallSettings.Builder createSpanSettings() { - return getStubSettingsBuilder().createSpanSettings(); - } - /** Returns the builder for the settings used for calls to batchWriteSpans. */ public UnaryCallSettings.Builder batchWriteSpansSettings() { return getStubSettingsBuilder().batchWriteSpansSettings(); } + /** Returns the builder for the settings used for calls to createSpan. */ + public UnaryCallSettings.Builder createSpanSettings() { + return getStubSettingsBuilder().createSpanSettings(); + } + @Override public TraceServiceSettings build() throws IOException { return new TraceServiceSettings(this); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/package-info.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/package-info.java index 807c7523..0923a0ea 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/package-info.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -15,11 +15,9 @@ */ /** - * A client to Stackdriver Trace API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

================== TraceServiceClient ================== + *

======================= TraceServiceClient ======================= * *

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 @@ -27,18 +25,8 @@ * trace tree. A single trace may contain span(s) from multiple services. * *

Sample for TraceServiceClient: - * - *

- * 
- * try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
- *   ProjectName name = ProjectName.of("[PROJECT]");
- *   List<Span> spans = new ArrayList<>();
- *   traceServiceClient.batchWriteSpans(name, spans);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.trace.v2; import javax.annotation.Generated; diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceCallableFactory.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceCallableFactory.java index 02c9eb60..6ad3ec38 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceCallableFactory.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Stackdriver Trace API. + * gRPC callable factory implementation for the TraceService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcTraceServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceStub.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceStub.java index 64a0de99..e08a3ae4 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceStub.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/GrpcTraceServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableMap; import com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest; import com.google.devtools.cloudtrace.v2.Span; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -34,23 +35,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Stackdriver Trace API. + * gRPC stub implementation for the TraceService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcTraceServiceStub extends TraceServiceStub { - - private static final MethodDescriptor createSpanMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.devtools.cloudtrace.v2.TraceService/CreateSpan") - .setRequestMarshaller(ProtoUtils.marshaller(Span.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Span.getDefaultInstance())) - .build(); private static final MethodDescriptor batchWriteSpansMethodDescriptor = MethodDescriptor.newBuilder() @@ -61,11 +53,19 @@ public class GrpcTraceServiceStub extends TraceServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; + private static final MethodDescriptor createSpanMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.devtools.cloudtrace.v2.TraceService/CreateSpan") + .setRequestMarshaller(ProtoUtils.marshaller(Span.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Span.getDefaultInstance())) + .build(); - private final UnaryCallable createSpanCallable; private final UnaryCallable batchWriteSpansCallable; + private final UnaryCallable createSpanCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcTraceServiceStub create(TraceServiceStubSettings settings) @@ -104,27 +104,28 @@ protected GrpcTraceServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - GrpcCallSettings createSpanTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(createSpanMethodDescriptor) + GrpcCallSettings batchWriteSpansTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(batchWriteSpansMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { + new RequestParamsExtractor() { @Override - public Map extract(Span request) { + public Map extract(BatchWriteSpansRequest request) { ImmutableMap.Builder params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } }) .build(); - GrpcCallSettings batchWriteSpansTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(batchWriteSpansMethodDescriptor) + GrpcCallSettings createSpanTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createSpanMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { + new RequestParamsExtractor() { @Override - public Map extract(BatchWriteSpansRequest request) { + public Map extract(Span request) { ImmutableMap.Builder params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); @@ -132,24 +133,29 @@ public Map extract(BatchWriteSpansRequest request) { }) .build(); - this.createSpanCallable = - callableFactory.createUnaryCallable( - createSpanTransportSettings, settings.createSpanSettings(), clientContext); this.batchWriteSpansCallable = callableFactory.createUnaryCallable( batchWriteSpansTransportSettings, settings.batchWriteSpansSettings(), clientContext); + this.createSpanCallable = + callableFactory.createUnaryCallable( + createSpanTransportSettings, settings.createSpanSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - public UnaryCallable createSpanCallable() { - return createSpanCallable; + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable batchWriteSpansCallable() { return batchWriteSpansCallable; } + public UnaryCallable createSpanCallable() { + return createSpanCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStub.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStub.java index 9291b84f..64a1f059 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStub.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest; @@ -23,24 +23,23 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Stackdriver Trace API. + * Base stub class for the TraceService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class TraceServiceStub implements BackgroundResource { - public UnaryCallable createSpanCallable() { - throw new UnsupportedOperationException("Not implemented: createSpanCallable()"); - } - public UnaryCallable batchWriteSpansCallable() { throw new UnsupportedOperationException("Not implemented: batchWriteSpansCallable()"); } + public UnaryCallable createSpanCallable() { + throw new UnsupportedOperationException("Not implemented: createSpanCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStubSettings.java b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStubSettings.java index d34a527f..fc6acefd 100644 --- a/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStubSettings.java +++ b/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/stub/TraceServiceStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2.stub; import com.google.api.core.ApiFunction; @@ -42,7 +43,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TraceServiceStub}. * @@ -59,22 +60,23 @@ * *

For example, to set the total timeout of batchWriteSpans to 30 seconds: * - *

- * 
+ * 
{@code
  * TraceServiceStubSettings.Builder traceServiceSettingsBuilder =
  *     TraceServiceStubSettings.newBuilder();
  * traceServiceSettingsBuilder
  *     .batchWriteSpansSettings()
  *     .setRetrySettings(
- *         traceServiceSettingsBuilder.batchWriteSpansSettings().getRetrySettings().toBuilder()
+ *         traceServiceSettingsBuilder
+ *             .batchWriteSpansSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TraceServiceStubSettings traceServiceSettings = traceServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class TraceServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -83,29 +85,29 @@ public class TraceServiceStubSettings extends StubSettings createSpanSettings; private final UnaryCallSettings batchWriteSpansSettings; - - /** Returns the object with the settings used for calls to createSpan. */ - public UnaryCallSettings createSpanSettings() { - return createSpanSettings; - } + private final UnaryCallSettings createSpanSettings; /** Returns the object with the settings used for calls to batchWriteSpans. */ public UnaryCallSettings batchWriteSpansSettings() { return batchWriteSpansSettings; } + /** Returns the object with the settings used for calls to createSpan. */ + public UnaryCallSettings createSpanSettings() { + return createSpanSettings; + } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public TraceServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcTraceServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -165,31 +167,28 @@ public Builder toBuilder() { protected TraceServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); - createSpanSettings = settingsBuilder.createSpanSettings().build(); batchWriteSpansSettings = settingsBuilder.batchWriteSpansSettings().build(); + createSpanSettings = settingsBuilder.createSpanSettings().build(); } /** Builder for TraceServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder createSpanSettings; private final UnaryCallSettings.Builder batchWriteSpansSettings; - + private final UnaryCallSettings.Builder createSpanSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); + definitions.put( + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -200,82 +199,79 @@ public static class Builder extends StubSettings.Builder>of( - createSpanSettings, batchWriteSpansSettings); - + batchWriteSpansSettings, createSpanSettings); initDefaults(this); } + protected Builder(TraceServiceStubSettings settings) { + super(settings); + + batchWriteSpansSettings = settings.batchWriteSpansSettings.toBuilder(); + createSpanSettings = settings.createSpanSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + batchWriteSpansSettings, createSpanSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { + builder + .batchWriteSpansSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .createSpanSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - builder - .batchWriteSpansSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); - return builder; } - protected Builder(TraceServiceStubSettings settings) { - super(settings); - - createSpanSettings = settings.createSpanSettings.toBuilder(); - batchWriteSpansSettings = settings.batchWriteSpansSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createSpanSettings, batchWriteSpansSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -291,16 +287,16 @@ public Builder applyToAllUnaryMethods( return unaryMethodSettingsBuilders; } - /** Returns the builder for the settings used for calls to createSpan. */ - public UnaryCallSettings.Builder createSpanSettings() { - return createSpanSettings; - } - /** Returns the builder for the settings used for calls to batchWriteSpans. */ public UnaryCallSettings.Builder batchWriteSpansSettings() { return batchWriteSpansSettings; } + /** Returns the builder for the settings used for calls to createSpan. */ + public UnaryCallSettings.Builder createSpanSettings() { + return createSpanSettings; + } + @Override public TraceServiceStubSettings build() throws IOException { return new TraceServiceStubSettings(this); diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceService.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceService.java index 3d8e855d..bfb7cd37 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceService.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceService.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTraceService implements MockGrpcService { private final MockTraceServiceImpl serviceImpl; diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceServiceImpl.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceServiceImpl.java index 1537bd33..29f37a81 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceServiceImpl.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceServiceImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1; import com.google.api.core.BetaApi; @@ -29,9 +30,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTraceServiceImpl extends TraceServiceImplBase { private List requests; private Queue responses; @@ -68,10 +70,10 @@ public void listTraces( Object response = responses.remove(); if (response instanceof ListTracesResponse) { requests.add(request); - responseObserver.onNext((ListTracesResponse) response); + responseObserver.onNext(((ListTracesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -82,10 +84,10 @@ public void getTrace(GetTraceRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Trace) { requests.add(request); - responseObserver.onNext((Trace) response); + responseObserver.onNext(((Trace) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -96,10 +98,10 @@ public void patchTraces(PatchTracesRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceClientTest.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceClientTest.java index c80da0a2..9477c42e 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceClientTest.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v1; import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; @@ -30,15 +31,17 @@ 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.TraceSpan; import com.google.devtools.cloudtrace.v1.Traces; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -46,31 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class TraceServiceClientTest { - private static MockTraceService mockTraceService; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private TraceServiceClient client; + private static MockTraceService mockTraceService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockTraceService = new MockTraceService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockTraceService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); TraceServiceSettings settings = TraceServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -85,22 +88,29 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void patchTracesTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listTracesTest() throws Exception { + Trace responsesElement = Trace.newBuilder().build(); + ListTracesResponse expectedResponse = + ListTracesResponse.newBuilder() + .setNextPageToken("") + .addAllTraces(Arrays.asList(responsesElement)) + .build(); mockTraceService.addResponse(expectedResponse); - String projectId = "projectId-1969970175"; - Traces traces = Traces.newBuilder().build(); + String projectId = "projectId-894832108"; - client.patchTraces(projectId, traces); + ListTracesPagedResponse pagedListResponse = client.listTraces(projectId); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTracesList().get(0), resources.get(0)); List actualRequests = mockTraceService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - PatchTracesRequest actualRequest = (PatchTracesRequest) actualRequests.get(0); + ListTracesRequest actualRequest = ((ListTracesRequest) actualRequests.get(0)); Assert.assertEquals(projectId, actualRequest.getProjectId()); - Assert.assertEquals(traces, actualRequest.getTraces()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -108,48 +118,41 @@ public void patchTracesTest() { } @Test - @SuppressWarnings("all") - public void patchTracesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listTracesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTraceService.addException(exception); try { - String projectId = "projectId-1969970175"; - Traces traces = Traces.newBuilder().build(); - - client.patchTraces(projectId, traces); + String projectId = "projectId-894832108"; + client.listTraces(projectId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listTracesTest() { - String nextPageToken = ""; - Trace tracesElement = Trace.newBuilder().build(); - List traces = Arrays.asList(tracesElement); - ListTracesResponse expectedResponse = - ListTracesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllTraces(traces) + public void getTraceTest() throws Exception { + Trace expectedResponse = + Trace.newBuilder() + .setProjectId("projectId-894832108") + .setTraceId("traceId-1067401920") + .addAllSpans(new ArrayList()) .build(); mockTraceService.addResponse(expectedResponse); - String projectId = "projectId-1969970175"; - - ListTracesPagedResponse pagedListResponse = client.listTraces(projectId); + String projectId = "projectId-894832108"; + String traceId = "traceId-1067401920"; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getTracesList().get(0), resources.get(0)); + Trace actualResponse = client.getTrace(projectId, traceId); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTraceService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListTracesRequest actualRequest = (ListTracesRequest) actualRequests.get(0); + GetTraceRequest actualRequest = ((GetTraceRequest) actualRequests.get(0)); Assert.assertEquals(projectId, actualRequest.getProjectId()); + Assert.assertEquals(traceId, actualRequest.getTraceId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -157,42 +160,36 @@ public void listTracesTest() { } @Test - @SuppressWarnings("all") - public void listTracesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getTraceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTraceService.addException(exception); try { - String projectId = "projectId-1969970175"; - - client.listTraces(projectId); + String projectId = "projectId-894832108"; + String traceId = "traceId-1067401920"; + client.getTrace(projectId, traceId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getTraceTest() { - String projectId2 = "projectId2939242356"; - String traceId2 = "traceId2987826376"; - Trace expectedResponse = - Trace.newBuilder().setProjectId(projectId2).setTraceId(traceId2).build(); + public void patchTracesTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockTraceService.addResponse(expectedResponse); - String projectId = "projectId-1969970175"; - String traceId = "traceId1270300245"; + String projectId = "projectId-894832108"; + Traces traces = Traces.newBuilder().build(); - Trace actualResponse = client.getTrace(projectId, traceId); - Assert.assertEquals(expectedResponse, actualResponse); + client.patchTraces(projectId, traces); List actualRequests = mockTraceService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetTraceRequest actualRequest = (GetTraceRequest) actualRequests.get(0); + PatchTracesRequest actualRequest = ((PatchTracesRequest) actualRequests.get(0)); Assert.assertEquals(projectId, actualRequest.getProjectId()); - Assert.assertEquals(traceId, actualRequest.getTraceId()); + Assert.assertEquals(traces, actualRequest.getTraces()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -200,19 +197,17 @@ public void getTraceTest() { } @Test - @SuppressWarnings("all") - public void getTraceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void patchTracesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTraceService.addException(exception); try { - String projectId = "projectId-1969970175"; - String traceId = "traceId1270300245"; - - client.getTrace(projectId, traceId); + String projectId = "projectId-894832108"; + Traces traces = Traces.newBuilder().build(); + client.patchTraces(projectId, traces); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceSmokeTest.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceSmokeTest.java deleted file mode 100644 index 1cd98dae..00000000 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceSmokeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * 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 - * - * https://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.v1; - -import static com.google.cloud.trace.v1.TraceServiceClient.ListTracesPagedResponse; - -import com.google.common.base.Preconditions; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class TraceServiceSmokeTest { - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - - @Test - public void run() { - main(null); - } - - public static void main(String args[]) { - Logger.getLogger("").setLevel(Level.WARNING); - try { - executeNoCatch(getProjectId()); - System.out.println("OK"); - } catch (Exception e) { - System.err.println("Failed with exception:"); - e.printStackTrace(System.err); - System.exit(1); - } - } - - public static void executeNoCatch(String projectId) throws Exception { - try (TraceServiceClient client = TraceServiceClient.create()) { - String projectId2 = projectId; - - ListTracesPagedResponse pagedResponse = client.listTraces(projectId2); - } - } - - private static String getProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - Preconditions.checkArgument(projectId != null, "A project ID is required."); - return projectId; - } -} diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceService.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceService.java index 490d2464..b1dbf104 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceService.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceService.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTraceService implements MockGrpcService { private final MockTraceServiceImpl serviceImpl; diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceServiceImpl.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceServiceImpl.java index d4534951..f034860c 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceServiceImpl.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceServiceImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2; import com.google.api.core.BetaApi; @@ -26,9 +27,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockTraceServiceImpl extends TraceServiceImplBase { private List requests; private Queue responses; @@ -65,10 +67,10 @@ public void batchWriteSpans( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -79,10 +81,10 @@ public void createSpan(Span request, StreamObserver responseObserver) { Object response = responses.remove(); if (response instanceof Span) { requests.add(request); - responseObserver.onNext((Span) response); + responseObserver.onNext(((Span) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceClientTest.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceClientTest.java index 52b7e32a..18e563db 100644 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceClientTest.java +++ b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.trace.v2; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,17 +27,21 @@ import com.google.devtools.cloudtrace.v2.ProjectName; import com.google.devtools.cloudtrace.v2.Span; import com.google.devtools.cloudtrace.v2.SpanName; +import com.google.devtools.cloudtrace.v2.StackTrace; import com.google.devtools.cloudtrace.v2.TruncatableString; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.BoolValue; import com.google.protobuf.Empty; +import com.google.protobuf.Int32Value; import com.google.protobuf.Timestamp; -import io.grpc.Status; +import com.google.rpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -44,31 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class TraceServiceClientTest { - private static MockTraceService mockTraceService; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private TraceServiceClient client; + private static MockTraceService mockTraceService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockTraceService = new MockTraceService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockTraceService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); TraceServiceSettings settings = TraceServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -83,45 +88,21 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createSpanTest() { - SpanName name2 = SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]"); - String spanId2 = "spanId2-643891741"; - String parentSpanId = "parentSpanId-1757797477"; - Span expectedResponse = - Span.newBuilder() - .setName(name2.toString()) - .setSpanId(spanId2) - .setParentSpanId(parentSpanId) - .build(); + public void batchWriteSpansTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockTraceService.addResponse(expectedResponse); - SpanName name = SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]"); - String spanId = "spanId-2011840976"; - TruncatableString displayName = TruncatableString.newBuilder().build(); - Timestamp startTime = Timestamp.newBuilder().build(); - Timestamp endTime = Timestamp.newBuilder().build(); - Span request = - Span.newBuilder() - .setName(name.toString()) - .setSpanId(spanId) - .setDisplayName(displayName) - .setStartTime(startTime) - .setEndTime(endTime) - .build(); + ProjectName name = ProjectName.of("[PROJECT]"); + List spans = new ArrayList<>(); - Span actualResponse = client.createSpan(request); - Assert.assertEquals(expectedResponse, actualResponse); + client.batchWriteSpans(name, spans); List actualRequests = mockTraceService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - Span actualRequest = (Span) actualRequests.get(0); + BatchWriteSpansRequest actualRequest = ((BatchWriteSpansRequest) actualRequests.get(0)); - Assert.assertEquals(name, SpanName.parse(actualRequest.getName())); - Assert.assertEquals(spanId, actualRequest.getSpanId()); - Assert.assertEquals(displayName, actualRequest.getDisplayName()); - Assert.assertEquals(startTime, actualRequest.getStartTime()); - Assert.assertEquals(endTime, actualRequest.getEndTime()); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(spans, actualRequest.getSpansList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -129,49 +110,35 @@ public void createSpanTest() { } @Test - @SuppressWarnings("all") - public void createSpanExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void batchWriteSpansExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTraceService.addException(exception); try { - SpanName name = SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]"); - String spanId = "spanId-2011840976"; - TruncatableString displayName = TruncatableString.newBuilder().build(); - Timestamp startTime = Timestamp.newBuilder().build(); - Timestamp endTime = Timestamp.newBuilder().build(); - Span request = - Span.newBuilder() - .setName(name.toString()) - .setSpanId(spanId) - .setDisplayName(displayName) - .setStartTime(startTime) - .setEndTime(endTime) - .build(); - - client.createSpan(request); + ProjectName name = ProjectName.of("[PROJECT]"); + List spans = new ArrayList<>(); + client.batchWriteSpans(name, spans); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void batchWriteSpansTest() { + public void batchWriteSpansTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTraceService.addResponse(expectedResponse); - ProjectName name = ProjectName.of("[PROJECT]"); + String name = "name3373707"; List spans = new ArrayList<>(); client.batchWriteSpans(name, spans); List actualRequests = mockTraceService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - BatchWriteSpansRequest actualRequest = (BatchWriteSpansRequest) actualRequests.get(0); + BatchWriteSpansRequest actualRequest = ((BatchWriteSpansRequest) actualRequests.get(0)); - Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertEquals(spans, actualRequest.getSpansList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -180,19 +147,102 @@ public void batchWriteSpansTest() { } @Test - @SuppressWarnings("all") - public void batchWriteSpansExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void batchWriteSpansExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTraceService.addException(exception); try { - ProjectName name = ProjectName.of("[PROJECT]"); + String name = "name3373707"; List spans = new ArrayList<>(); - client.batchWriteSpans(name, spans); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. + } + } + + @Test + public void createSpanTest() throws Exception { + Span expectedResponse = + Span.newBuilder() + .setName(SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]").toString()) + .setSpanId("spanId-896182779") + .setParentSpanId("parentSpanId1059234639") + .setDisplayName(TruncatableString.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setStackTrace(StackTrace.newBuilder().build()) + .setStatus(Status.newBuilder().build()) + .setSameProcessAsParentSpan(BoolValue.newBuilder().build()) + .setChildSpanCount(Int32Value.newBuilder().build()) + .build(); + mockTraceService.addResponse(expectedResponse); + + Span request = + Span.newBuilder() + .setName(SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]").toString()) + .setSpanId("spanId-896182779") + .setParentSpanId("parentSpanId1059234639") + .setDisplayName(TruncatableString.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setStackTrace(StackTrace.newBuilder().build()) + .setStatus(Status.newBuilder().build()) + .setSameProcessAsParentSpan(BoolValue.newBuilder().build()) + .setChildSpanCount(Int32Value.newBuilder().build()) + .build(); + + Span actualResponse = client.createSpan(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTraceService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + Span actualRequest = ((Span) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getSpanId(), actualRequest.getSpanId()); + Assert.assertEquals(request.getParentSpanId(), actualRequest.getParentSpanId()); + Assert.assertEquals(request.getDisplayName(), actualRequest.getDisplayName()); + Assert.assertEquals(request.getStartTime(), actualRequest.getStartTime()); + Assert.assertEquals(request.getEndTime(), actualRequest.getEndTime()); + Assert.assertEquals(request.getAttributes(), actualRequest.getAttributes()); + Assert.assertEquals(request.getStackTrace(), actualRequest.getStackTrace()); + Assert.assertEquals(request.getTimeEvents(), actualRequest.getTimeEvents()); + Assert.assertEquals(request.getLinks(), actualRequest.getLinks()); + Assert.assertEquals(request.getStatus(), actualRequest.getStatus()); + Assert.assertEquals( + request.getSameProcessAsParentSpan(), actualRequest.getSameProcessAsParentSpan()); + Assert.assertEquals(request.getChildSpanCount(), actualRequest.getChildSpanCount()); + Assert.assertEquals(request.getSpanKind(), actualRequest.getSpanKind()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSpanExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTraceService.addException(exception); + + try { + Span request = + Span.newBuilder() + .setName(SpanName.of("[PROJECT]", "[TRACE]", "[SPAN]").toString()) + .setSpanId("spanId-896182779") + .setParentSpanId("parentSpanId1059234639") + .setDisplayName(TruncatableString.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setStackTrace(StackTrace.newBuilder().build()) + .setStatus(Status.newBuilder().build()) + .setSameProcessAsParentSpan(BoolValue.newBuilder().build()) + .setChildSpanCount(Int32Value.newBuilder().build()) + .build(); + client.createSpan(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. } } } diff --git a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceSmokeTest.java b/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceSmokeTest.java deleted file mode 100644 index c1230b2f..00000000 --- a/google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceSmokeTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * 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 - * - * https://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.v2; - -import com.google.common.base.Preconditions; -import com.google.devtools.cloudtrace.v2.ProjectName; -import com.google.devtools.cloudtrace.v2.Span; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class TraceServiceSmokeTest { - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - - @Test - public void run() { - main(null); - } - - public static void main(String args[]) { - Logger.getLogger("").setLevel(Level.WARNING); - try { - executeNoCatch(getProjectId()); - System.out.println("OK"); - } catch (Exception e) { - System.err.println("Failed with exception:"); - e.printStackTrace(System.err); - System.exit(1); - } - } - - public static void executeNoCatch(String projectId) throws Exception { - try (TraceServiceClient client = TraceServiceClient.create()) { - ProjectName name = ProjectName.of(projectId); - List spans = new ArrayList<>(); - - client.batchWriteSpans(name, spans); - } - } - - private static String getProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - Preconditions.checkArgument(projectId != null, "A project ID is required."); - return projectId; - } -} diff --git a/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/ProjectName.java b/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/ProjectName.java index a3db8992..e3787e34 100644 --- a/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/ProjectName.java +++ b/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/SpanName.java b/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/SpanName.java index c60e8c47..884cfa1c 100644 --- a/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/SpanName.java +++ b/proto-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/SpanName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,20 +23,32 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SpanName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_TRACE_SPAN = PathTemplate.createWithoutUrlEncoding("projects/{project}/traces/{trace}/spans/{span}"); - private volatile Map fieldValuesMap; - private final String project; private final String trace; private final String span; + @Deprecated + protected SpanName() { + project = null; + trace = null; + span = null; + } + + private SpanName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + trace = Preconditions.checkNotNull(builder.getTrace()); + span = Preconditions.checkNotNull(builder.getSpan()); + } + public String getProject() { return project; } @@ -57,12 +69,6 @@ public Builder toBuilder() { return new Builder(this); } - private SpanName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - trace = Preconditions.checkNotNull(builder.getTrace()); - span = Preconditions.checkNotNull(builder.getSpan()); - } - public static SpanName of(String project, String trace, String span) { return newBuilder().setProject(project).setTrace(trace).setSpan(span).build(); } @@ -76,7 +82,7 @@ public static SpanName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_TRACE_SPAN.validatedMatch( formattedString, "SpanName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("trace"), matchMap.get("span")); } @@ -90,7 +96,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (SpanName value : values) { if (value == null) { list.add(""); @@ -102,17 +108,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_TRACE_SPAN.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("trace", trace); - fieldMapBuilder.put("span", span); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (trace != null) { + fieldMapBuilder.put("trace", trace); + } + if (span != null) { + fieldMapBuilder.put("span", span); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -126,16 +139,43 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "trace", trace, "span", span); + return PROJECT_TRACE_SPAN.instantiate("project", project, "trace", trace, "span", span); } - /** Builder for SpanName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SpanName that = ((SpanName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.trace, that.trace) + && Objects.equals(this.span, that.span); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(trace); + h *= 1000003; + h ^= Objects.hashCode(span); + return h; + } + + /** Builder for projects/{project}/traces/{trace}/spans/{span}. */ + public static class Builder { private String project; private String trace; private String span; + protected Builder() {} + public String getProject() { return project; } @@ -163,8 +203,6 @@ public Builder setSpan(String span) { return this; } - private Builder() {} - private Builder(SpanName spanName) { project = spanName.project; trace = spanName.trace; @@ -175,30 +213,4 @@ public SpanName build() { return new SpanName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof SpanName) { - SpanName that = (SpanName) o; - return (this.project.equals(that.project)) - && (this.trace.equals(that.trace)) - && (this.span.equals(that.span)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= trace.hashCode(); - h *= 1000003; - h ^= span.hashCode(); - return h; - } } diff --git a/synth.metadata b/synth.metadata index 22e82406..1a967e0b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-trace.git", - "sha": "e401ddb308c153e070fabfe7e9979eae1fefe5d6" + "sha": "4af695516ec16d7c99bbd3229ee12cfafaa329ca" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "13d3b3ace10bd5a4865094ad2ba5e62b02e1e6bf", - "internalRef": "319788951" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "13d3b3ace10bd5a4865094ad2ba5e62b02e1e6bf", - "internalRef": "319788951" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { @@ -135,11 +135,9 @@ "google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceService.java", "google-cloud-trace/src/test/java/com/google/cloud/trace/v1/MockTraceServiceImpl.java", "google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceClientTest.java", - "google-cloud-trace/src/test/java/com/google/cloud/trace/v1/TraceServiceSmokeTest.java", "google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceService.java", "google-cloud-trace/src/test/java/com/google/cloud/trace/v2/MockTraceServiceImpl.java", "google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceClientTest.java", - "google-cloud-trace/src/test/java/com/google/cloud/trace/v2/TraceServiceSmokeTest.java", "grpc-google-cloud-trace-v1/src/main/java/com/google/devtools/cloudtrace/v1/TraceServiceGrpc.java", "grpc-google-cloud-trace-v2/src/main/java/com/google/devtools/cloudtrace/v2/TraceServiceGrpc.java", "java.header", From dfaa057f471b052f5c7b8cc9c38cb24fc77e70bb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 14 Dec 2020 11:24:10 -0800 Subject: [PATCH 4/8] chore: regenerate README (#371) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-12-14 19:16:30,931 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-trace/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2020-12-14 19:16:31,782 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/15bb65ee-4592-4eb9-98fa-564fb9093345/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 4 ++-- README.md | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index e569d717..5a869597 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-trace.git", - "sha": "b498959990d5604efe299bf36dbe98fbf98248a0" + "sha": "99d244884e743993a71cea3a73278d83d4857e52" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "a073c873f3928c561bdf87fdfbf1d081d1998984" + "sha": "996775eca5fd934edac3c2ae34b80ff0395b1717" } } ] diff --git a/README.md b/README.md index 2e44b0a6..f530f6ae 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,11 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-trace:1.2.7' +compile 'com.google.cloud:google-cloud-trace:1.2.8' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-trace" % "1.2.7" +libraryDependencies += "com.google.cloud" % "google-cloud-trace" % "1.2.8" ``` ## Authentication @@ -127,6 +127,8 @@ Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] +Java is a registered trademark of Oracle and/or its affiliates. + [product-docs]: https://cloud.google.com/trace/docs/ [javadocs]: https://googleapis.dev/java/google-cloud-trace/latest/ [kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-trace/java7.svg From 78862eddd036f4e079cb0655fa045d2afa3c5a3f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Dec 2020 20:56:24 +0100 Subject: [PATCH 5/8] chore(deps): update dependency com.google.cloud:google-cloud-trace to v1.2.8 (#368) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:google-cloud-trace](https://togithub.com/googleapis/java-core) | patch | `1.2.7` -> `1.2.8` | --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-trace). --- samples/install-without-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b6e0f63a..0a4078f4 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-trace - 1.2.7 + 1.2.8 From fab413f9e98df18eb5616b59397ec3e2e7cab1d9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 14 Dec 2020 12:52:52 -0800 Subject: [PATCH 6/8] chore: regenerate README (#373) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-12-14 20:04:48,787 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-trace/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2020-12-14 20:04:49,673 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/3a58506d-7042-4f99-b0c2-5b085c3b749f/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 5a869597..01929fd2 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-trace.git", - "sha": "99d244884e743993a71cea3a73278d83d4857e52" + "sha": "78862eddd036f4e079cb0655fa045d2afa3c5a3f" } }, { diff --git a/README.md b/README.md index f530f6ae..57445842 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-trace - 1.2.7 + 1.2.8 ``` From 13f09a46f3efaae7254a9c124e74837d32d2f4b6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Dec 2020 22:36:18 +0100 Subject: [PATCH 7/8] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 (#372) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | patch | `0.16.0` -> `0.16.1` | --- ### Release Notes
googleapis/java-shared-dependencies ### [`v0.16.1`](https://togithub.com/googleapis/java-shared-dependencies/blob/master/CHANGELOG.md#​0161-httpswwwgithubcomgoogleapisjava-shared-dependenciescompare0160v0161-2020-12-14) [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v0.16.0...v0.16.1)
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-trace). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0188ff7f..58c11db2 100644 --- a/pom.xml +++ b/pom.xml @@ -179,7 +179,7 @@ com.google.cloud google-cloud-shared-dependencies - 0.16.0 + 0.16.1 pom import From c334e8a3f9e4f66c2c6091080d012c56df3f150c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 14 Dec 2020 22:10:20 +0000 Subject: [PATCH 8/8] chore: release 1.2.9 (#374) :robot: I have created a release \*beep\* \*boop\* --- ### [1.2.9](https://www.github.com/googleapis/java-trace/compare/v1.2.8...v1.2.9) (2020-12-14) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#372](https://www.github.com/googleapis/java-trace/issues/372)) ([13f09a4](https://www.github.com/googleapis/java-trace/commit/13f09a46f3efaae7254a9c124e74837d32d2f4b6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- CHANGELOG.md | 7 +++++++ google-cloud-trace-bom/pom.xml | 14 +++++++------- google-cloud-trace/pom.xml | 4 ++-- grpc-google-cloud-trace-v1/pom.xml | 4 ++-- grpc-google-cloud-trace-v2/pom.xml | 4 ++-- pom.xml | 10 +++++----- proto-google-cloud-trace-v1/pom.xml | 4 ++-- proto-google-cloud-trace-v2/pom.xml | 4 ++-- samples/snapshot/pom.xml | 6 +++--- versions.txt | 10 +++++----- 10 files changed, 37 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a546be83..acd2446b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.2.9](https://www.github.com/googleapis/java-trace/compare/v1.2.8...v1.2.9) (2020-12-14) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#372](https://www.github.com/googleapis/java-trace/issues/372)) ([13f09a4](https://www.github.com/googleapis/java-trace/commit/13f09a46f3efaae7254a9c124e74837d32d2f4b6)) + ### [1.2.8](https://www.github.com/googleapis/java-trace/compare/v1.2.7...v1.2.8) (2020-12-02) diff --git a/google-cloud-trace-bom/pom.xml b/google-cloud-trace-bom/pom.xml index bebaf4ce..c8a1f122 100644 --- a/google-cloud-trace-bom/pom.xml +++ b/google-cloud-trace-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-trace-bom - 1.2.9-SNAPSHOT + 1.2.9 pom com.google.cloud @@ -63,32 +63,32 @@ com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 com.google.cloud google-cloud-trace - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/google-cloud-trace/pom.xml b/google-cloud-trace/pom.xml index 3d5985a7..4d207d5f 100644 --- a/google-cloud-trace/pom.xml +++ b/google-cloud-trace/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-trace - 1.2.9-SNAPSHOT + 1.2.9 jar Google Cloud Trace https://github.com/googleapis/java-trace @@ -13,7 +13,7 @@ com.google.cloud google-cloud-trace-parent - 1.2.9-SNAPSHOT + 1.2.9 google-cloud-trace diff --git a/grpc-google-cloud-trace-v1/pom.xml b/grpc-google-cloud-trace-v1/pom.xml index 45320547..4cda6231 100644 --- a/grpc-google-cloud-trace-v1/pom.xml +++ b/grpc-google-cloud-trace-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 grpc-google-cloud-trace-v1 GRPC library for grpc-google-cloud-trace-v1 com.google.cloud google-cloud-trace-parent - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/grpc-google-cloud-trace-v2/pom.xml b/grpc-google-cloud-trace-v2/pom.xml index 9bebef72..f0d57048 100644 --- a/grpc-google-cloud-trace-v2/pom.xml +++ b/grpc-google-cloud-trace-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 grpc-google-cloud-trace-v2 GRPC library for grpc-google-cloud-trace-v2 com.google.cloud google-cloud-trace-parent - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/pom.xml b/pom.xml index 58c11db2..228662fb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-trace-parent pom - 1.2.9-SNAPSHOT + 1.2.9 Google Cloud Trace Parent https://github.com/googleapis/java-core @@ -158,22 +158,22 @@ com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc grpc-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 com.google.api.grpc grpc-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/proto-google-cloud-trace-v1/pom.xml b/proto-google-cloud-trace-v1/pom.xml index 3de36470..dd70cc71 100644 --- a/proto-google-cloud-trace-v1/pom.xml +++ b/proto-google-cloud-trace-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-trace-v1 - 1.2.9-SNAPSHOT + 1.2.9 proto-google-cloud-trace-v1 PROTO library for proto-google-cloud-trace-v1 com.google.cloud google-cloud-trace-parent - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/proto-google-cloud-trace-v2/pom.xml b/proto-google-cloud-trace-v2/pom.xml index cc0392ed..9da363ce 100644 --- a/proto-google-cloud-trace-v2/pom.xml +++ b/proto-google-cloud-trace-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-trace-v2 - 1.2.9-SNAPSHOT + 1.2.9 proto-google-cloud-trace-v2 PROTO library for proto-google-cloud-trace-v2 com.google.cloud google-cloud-trace-parent - 1.2.9-SNAPSHOT + 1.2.9 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 3dc489b8..078ffe3c 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,19 +28,19 @@ com.google.cloud google-cloud-trace - 1.2.9-SNAPSHOT + 1.2.9 junit junit - 1.2.9-SNAPSHOT + 1.2.9 test com.google.truth truth - 1.2.9-SNAPSHOT + 1.2.9 test diff --git a/versions.txt b/versions.txt index 8335a9f0..4060f0dc 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-trace:1.2.8:1.2.9-SNAPSHOT -grpc-google-cloud-trace-v1:1.2.8:1.2.9-SNAPSHOT -grpc-google-cloud-trace-v2:1.2.8:1.2.9-SNAPSHOT -proto-google-cloud-trace-v1:1.2.8:1.2.9-SNAPSHOT -proto-google-cloud-trace-v2:1.2.8:1.2.9-SNAPSHOT +google-cloud-trace:1.2.9:1.2.9 +grpc-google-cloud-trace-v1:1.2.9:1.2.9 +grpc-google-cloud-trace-v2:1.2.9:1.2.9 +proto-google-cloud-trace-v1:1.2.9:1.2.9 +proto-google-cloud-trace-v2:1.2.9:1.2.9