1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.devtools.cloudtrace.v2; 17 18 import static io.grpc.MethodDescriptor.generateFullMethodName; 19 20 /** 21 * 22 * 23 * <pre> 24 * Service for collecting and viewing traces and spans within a trace. 25 * A trace is a collection of spans corresponding to a single 26 * operation or a set of operations in an application. 27 * A span is an individual timed event which forms a node of the trace tree. 28 * A single trace can contain spans from multiple services. 29 * </pre> 30 */ 31 @javax.annotation.Generated( 32 value = "by gRPC proto compiler", 33 comments = "Source: google/devtools/cloudtrace/v2/tracing.proto") 34 @io.grpc.stub.annotations.GrpcGenerated 35 public final class TraceServiceGrpc { 36 TraceServiceGrpc()37 private TraceServiceGrpc() {} 38 39 public static final String SERVICE_NAME = "google.devtools.cloudtrace.v2.TraceService"; 40 41 // Static method descriptors that strictly reflect the proto. 42 private static volatile io.grpc.MethodDescriptor< 43 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest, com.google.protobuf.Empty> 44 getBatchWriteSpansMethod; 45 46 @io.grpc.stub.annotations.RpcMethod( 47 fullMethodName = SERVICE_NAME + '/' + "BatchWriteSpans", 48 requestType = com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest.class, 49 responseType = com.google.protobuf.Empty.class, 50 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 51 public static io.grpc.MethodDescriptor< 52 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest, com.google.protobuf.Empty> getBatchWriteSpansMethod()53 getBatchWriteSpansMethod() { 54 io.grpc.MethodDescriptor< 55 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest, com.google.protobuf.Empty> 56 getBatchWriteSpansMethod; 57 if ((getBatchWriteSpansMethod = TraceServiceGrpc.getBatchWriteSpansMethod) == null) { 58 synchronized (TraceServiceGrpc.class) { 59 if ((getBatchWriteSpansMethod = TraceServiceGrpc.getBatchWriteSpansMethod) == null) { 60 TraceServiceGrpc.getBatchWriteSpansMethod = 61 getBatchWriteSpansMethod = 62 io.grpc.MethodDescriptor 63 .<com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest, 64 com.google.protobuf.Empty> 65 newBuilder() 66 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 67 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BatchWriteSpans")) 68 .setSampledToLocalTracing(true) 69 .setRequestMarshaller( 70 io.grpc.protobuf.ProtoUtils.marshaller( 71 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest 72 .getDefaultInstance())) 73 .setResponseMarshaller( 74 io.grpc.protobuf.ProtoUtils.marshaller( 75 com.google.protobuf.Empty.getDefaultInstance())) 76 .setSchemaDescriptor( 77 new TraceServiceMethodDescriptorSupplier("BatchWriteSpans")) 78 .build(); 79 } 80 } 81 } 82 return getBatchWriteSpansMethod; 83 } 84 85 private static volatile io.grpc.MethodDescriptor< 86 com.google.devtools.cloudtrace.v2.Span, com.google.devtools.cloudtrace.v2.Span> 87 getCreateSpanMethod; 88 89 @io.grpc.stub.annotations.RpcMethod( 90 fullMethodName = SERVICE_NAME + '/' + "CreateSpan", 91 requestType = com.google.devtools.cloudtrace.v2.Span.class, 92 responseType = com.google.devtools.cloudtrace.v2.Span.class, 93 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 94 public static io.grpc.MethodDescriptor< 95 com.google.devtools.cloudtrace.v2.Span, com.google.devtools.cloudtrace.v2.Span> getCreateSpanMethod()96 getCreateSpanMethod() { 97 io.grpc.MethodDescriptor< 98 com.google.devtools.cloudtrace.v2.Span, com.google.devtools.cloudtrace.v2.Span> 99 getCreateSpanMethod; 100 if ((getCreateSpanMethod = TraceServiceGrpc.getCreateSpanMethod) == null) { 101 synchronized (TraceServiceGrpc.class) { 102 if ((getCreateSpanMethod = TraceServiceGrpc.getCreateSpanMethod) == null) { 103 TraceServiceGrpc.getCreateSpanMethod = 104 getCreateSpanMethod = 105 io.grpc.MethodDescriptor 106 .<com.google.devtools.cloudtrace.v2.Span, 107 com.google.devtools.cloudtrace.v2.Span> 108 newBuilder() 109 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 110 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateSpan")) 111 .setSampledToLocalTracing(true) 112 .setRequestMarshaller( 113 io.grpc.protobuf.ProtoUtils.marshaller( 114 com.google.devtools.cloudtrace.v2.Span.getDefaultInstance())) 115 .setResponseMarshaller( 116 io.grpc.protobuf.ProtoUtils.marshaller( 117 com.google.devtools.cloudtrace.v2.Span.getDefaultInstance())) 118 .setSchemaDescriptor(new TraceServiceMethodDescriptorSupplier("CreateSpan")) 119 .build(); 120 } 121 } 122 } 123 return getCreateSpanMethod; 124 } 125 126 /** Creates a new async stub that supports all call types for the service */ newStub(io.grpc.Channel channel)127 public static TraceServiceStub newStub(io.grpc.Channel channel) { 128 io.grpc.stub.AbstractStub.StubFactory<TraceServiceStub> factory = 129 new io.grpc.stub.AbstractStub.StubFactory<TraceServiceStub>() { 130 @java.lang.Override 131 public TraceServiceStub newStub( 132 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 133 return new TraceServiceStub(channel, callOptions); 134 } 135 }; 136 return TraceServiceStub.newStub(factory, channel); 137 } 138 139 /** 140 * Creates a new blocking-style stub that supports unary and streaming output calls on the service 141 */ newBlockingStub(io.grpc.Channel channel)142 public static TraceServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { 143 io.grpc.stub.AbstractStub.StubFactory<TraceServiceBlockingStub> factory = 144 new io.grpc.stub.AbstractStub.StubFactory<TraceServiceBlockingStub>() { 145 @java.lang.Override 146 public TraceServiceBlockingStub newStub( 147 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 148 return new TraceServiceBlockingStub(channel, callOptions); 149 } 150 }; 151 return TraceServiceBlockingStub.newStub(factory, channel); 152 } 153 154 /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ newFutureStub(io.grpc.Channel channel)155 public static TraceServiceFutureStub newFutureStub(io.grpc.Channel channel) { 156 io.grpc.stub.AbstractStub.StubFactory<TraceServiceFutureStub> factory = 157 new io.grpc.stub.AbstractStub.StubFactory<TraceServiceFutureStub>() { 158 @java.lang.Override 159 public TraceServiceFutureStub newStub( 160 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 161 return new TraceServiceFutureStub(channel, callOptions); 162 } 163 }; 164 return TraceServiceFutureStub.newStub(factory, channel); 165 } 166 167 /** 168 * 169 * 170 * <pre> 171 * Service for collecting and viewing traces and spans within a trace. 172 * A trace is a collection of spans corresponding to a single 173 * operation or a set of operations in an application. 174 * A span is an individual timed event which forms a node of the trace tree. 175 * A single trace can contain spans from multiple services. 176 * </pre> 177 */ 178 public interface AsyncService { 179 180 /** 181 * 182 * 183 * <pre> 184 * Batch writes new spans to new or existing traces. You cannot update 185 * existing spans. 186 * </pre> 187 */ batchWriteSpans( com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver)188 default void batchWriteSpans( 189 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request, 190 io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) { 191 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 192 getBatchWriteSpansMethod(), responseObserver); 193 } 194 195 /** 196 * 197 * 198 * <pre> 199 * Creates a new span. 200 * </pre> 201 */ createSpan( com.google.devtools.cloudtrace.v2.Span request, io.grpc.stub.StreamObserver<com.google.devtools.cloudtrace.v2.Span> responseObserver)202 default void createSpan( 203 com.google.devtools.cloudtrace.v2.Span request, 204 io.grpc.stub.StreamObserver<com.google.devtools.cloudtrace.v2.Span> responseObserver) { 205 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCreateSpanMethod(), responseObserver); 206 } 207 } 208 209 /** 210 * Base class for the server implementation of the service TraceService. 211 * 212 * <pre> 213 * Service for collecting and viewing traces and spans within a trace. 214 * A trace is a collection of spans corresponding to a single 215 * operation or a set of operations in an application. 216 * A span is an individual timed event which forms a node of the trace tree. 217 * A single trace can contain spans from multiple services. 218 * </pre> 219 */ 220 public abstract static class TraceServiceImplBase 221 implements io.grpc.BindableService, AsyncService { 222 223 @java.lang.Override bindService()224 public final io.grpc.ServerServiceDefinition bindService() { 225 return TraceServiceGrpc.bindService(this); 226 } 227 } 228 229 /** 230 * A stub to allow clients to do asynchronous rpc calls to service TraceService. 231 * 232 * <pre> 233 * Service for collecting and viewing traces and spans within a trace. 234 * A trace is a collection of spans corresponding to a single 235 * operation or a set of operations in an application. 236 * A span is an individual timed event which forms a node of the trace tree. 237 * A single trace can contain spans from multiple services. 238 * </pre> 239 */ 240 public static final class TraceServiceStub 241 extends io.grpc.stub.AbstractAsyncStub<TraceServiceStub> { TraceServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)242 private TraceServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 243 super(channel, callOptions); 244 } 245 246 @java.lang.Override build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)247 protected TraceServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 248 return new TraceServiceStub(channel, callOptions); 249 } 250 251 /** 252 * 253 * 254 * <pre> 255 * Batch writes new spans to new or existing traces. You cannot update 256 * existing spans. 257 * </pre> 258 */ batchWriteSpans( com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver)259 public void batchWriteSpans( 260 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request, 261 io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) { 262 io.grpc.stub.ClientCalls.asyncUnaryCall( 263 getChannel().newCall(getBatchWriteSpansMethod(), getCallOptions()), 264 request, 265 responseObserver); 266 } 267 268 /** 269 * 270 * 271 * <pre> 272 * Creates a new span. 273 * </pre> 274 */ createSpan( com.google.devtools.cloudtrace.v2.Span request, io.grpc.stub.StreamObserver<com.google.devtools.cloudtrace.v2.Span> responseObserver)275 public void createSpan( 276 com.google.devtools.cloudtrace.v2.Span request, 277 io.grpc.stub.StreamObserver<com.google.devtools.cloudtrace.v2.Span> responseObserver) { 278 io.grpc.stub.ClientCalls.asyncUnaryCall( 279 getChannel().newCall(getCreateSpanMethod(), getCallOptions()), request, responseObserver); 280 } 281 } 282 283 /** 284 * A stub to allow clients to do synchronous rpc calls to service TraceService. 285 * 286 * <pre> 287 * Service for collecting and viewing traces and spans within a trace. 288 * A trace is a collection of spans corresponding to a single 289 * operation or a set of operations in an application. 290 * A span is an individual timed event which forms a node of the trace tree. 291 * A single trace can contain spans from multiple services. 292 * </pre> 293 */ 294 public static final class TraceServiceBlockingStub 295 extends io.grpc.stub.AbstractBlockingStub<TraceServiceBlockingStub> { TraceServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)296 private TraceServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 297 super(channel, callOptions); 298 } 299 300 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)301 protected TraceServiceBlockingStub build( 302 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 303 return new TraceServiceBlockingStub(channel, callOptions); 304 } 305 306 /** 307 * 308 * 309 * <pre> 310 * Batch writes new spans to new or existing traces. You cannot update 311 * existing spans. 312 * </pre> 313 */ batchWriteSpans( com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request)314 public com.google.protobuf.Empty batchWriteSpans( 315 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request) { 316 return io.grpc.stub.ClientCalls.blockingUnaryCall( 317 getChannel(), getBatchWriteSpansMethod(), getCallOptions(), request); 318 } 319 320 /** 321 * 322 * 323 * <pre> 324 * Creates a new span. 325 * </pre> 326 */ createSpan( com.google.devtools.cloudtrace.v2.Span request)327 public com.google.devtools.cloudtrace.v2.Span createSpan( 328 com.google.devtools.cloudtrace.v2.Span request) { 329 return io.grpc.stub.ClientCalls.blockingUnaryCall( 330 getChannel(), getCreateSpanMethod(), getCallOptions(), request); 331 } 332 } 333 334 /** 335 * A stub to allow clients to do ListenableFuture-style rpc calls to service TraceService. 336 * 337 * <pre> 338 * Service for collecting and viewing traces and spans within a trace. 339 * A trace is a collection of spans corresponding to a single 340 * operation or a set of operations in an application. 341 * A span is an individual timed event which forms a node of the trace tree. 342 * A single trace can contain spans from multiple services. 343 * </pre> 344 */ 345 public static final class TraceServiceFutureStub 346 extends io.grpc.stub.AbstractFutureStub<TraceServiceFutureStub> { TraceServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)347 private TraceServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 348 super(channel, callOptions); 349 } 350 351 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)352 protected TraceServiceFutureStub build( 353 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 354 return new TraceServiceFutureStub(channel, callOptions); 355 } 356 357 /** 358 * 359 * 360 * <pre> 361 * Batch writes new spans to new or existing traces. You cannot update 362 * existing spans. 363 * </pre> 364 */ 365 public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty> batchWriteSpans(com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request)366 batchWriteSpans(com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest request) { 367 return io.grpc.stub.ClientCalls.futureUnaryCall( 368 getChannel().newCall(getBatchWriteSpansMethod(), getCallOptions()), request); 369 } 370 371 /** 372 * 373 * 374 * <pre> 375 * Creates a new span. 376 * </pre> 377 */ 378 public com.google.common.util.concurrent.ListenableFuture< 379 com.google.devtools.cloudtrace.v2.Span> createSpan(com.google.devtools.cloudtrace.v2.Span request)380 createSpan(com.google.devtools.cloudtrace.v2.Span request) { 381 return io.grpc.stub.ClientCalls.futureUnaryCall( 382 getChannel().newCall(getCreateSpanMethod(), getCallOptions()), request); 383 } 384 } 385 386 private static final int METHODID_BATCH_WRITE_SPANS = 0; 387 private static final int METHODID_CREATE_SPAN = 1; 388 389 private static final class MethodHandlers<Req, Resp> 390 implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, 391 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, 392 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, 393 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { 394 private final AsyncService serviceImpl; 395 private final int methodId; 396 MethodHandlers(AsyncService serviceImpl, int methodId)397 MethodHandlers(AsyncService serviceImpl, int methodId) { 398 this.serviceImpl = serviceImpl; 399 this.methodId = methodId; 400 } 401 402 @java.lang.Override 403 @java.lang.SuppressWarnings("unchecked") invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)404 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { 405 switch (methodId) { 406 case METHODID_BATCH_WRITE_SPANS: 407 serviceImpl.batchWriteSpans( 408 (com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest) request, 409 (io.grpc.stub.StreamObserver<com.google.protobuf.Empty>) responseObserver); 410 break; 411 case METHODID_CREATE_SPAN: 412 serviceImpl.createSpan( 413 (com.google.devtools.cloudtrace.v2.Span) request, 414 (io.grpc.stub.StreamObserver<com.google.devtools.cloudtrace.v2.Span>) 415 responseObserver); 416 break; 417 default: 418 throw new AssertionError(); 419 } 420 } 421 422 @java.lang.Override 423 @java.lang.SuppressWarnings("unchecked") invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)424 public io.grpc.stub.StreamObserver<Req> invoke( 425 io.grpc.stub.StreamObserver<Resp> responseObserver) { 426 switch (methodId) { 427 default: 428 throw new AssertionError(); 429 } 430 } 431 } 432 bindService(AsyncService service)433 public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { 434 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) 435 .addMethod( 436 getBatchWriteSpansMethod(), 437 io.grpc.stub.ServerCalls.asyncUnaryCall( 438 new MethodHandlers< 439 com.google.devtools.cloudtrace.v2.BatchWriteSpansRequest, 440 com.google.protobuf.Empty>(service, METHODID_BATCH_WRITE_SPANS))) 441 .addMethod( 442 getCreateSpanMethod(), 443 io.grpc.stub.ServerCalls.asyncUnaryCall( 444 new MethodHandlers< 445 com.google.devtools.cloudtrace.v2.Span, com.google.devtools.cloudtrace.v2.Span>( 446 service, METHODID_CREATE_SPAN))) 447 .build(); 448 } 449 450 private abstract static class TraceServiceBaseDescriptorSupplier 451 implements io.grpc.protobuf.ProtoFileDescriptorSupplier, 452 io.grpc.protobuf.ProtoServiceDescriptorSupplier { TraceServiceBaseDescriptorSupplier()453 TraceServiceBaseDescriptorSupplier() {} 454 455 @java.lang.Override getFileDescriptor()456 public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { 457 return com.google.devtools.cloudtrace.v2.TracingProto.getDescriptor(); 458 } 459 460 @java.lang.Override getServiceDescriptor()461 public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { 462 return getFileDescriptor().findServiceByName("TraceService"); 463 } 464 } 465 466 private static final class TraceServiceFileDescriptorSupplier 467 extends TraceServiceBaseDescriptorSupplier { TraceServiceFileDescriptorSupplier()468 TraceServiceFileDescriptorSupplier() {} 469 } 470 471 private static final class TraceServiceMethodDescriptorSupplier 472 extends TraceServiceBaseDescriptorSupplier 473 implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { 474 private final String methodName; 475 TraceServiceMethodDescriptorSupplier(String methodName)476 TraceServiceMethodDescriptorSupplier(String methodName) { 477 this.methodName = methodName; 478 } 479 480 @java.lang.Override getMethodDescriptor()481 public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { 482 return getServiceDescriptor().findMethodByName(methodName); 483 } 484 } 485 486 private static volatile io.grpc.ServiceDescriptor serviceDescriptor; 487 getServiceDescriptor()488 public static io.grpc.ServiceDescriptor getServiceDescriptor() { 489 io.grpc.ServiceDescriptor result = serviceDescriptor; 490 if (result == null) { 491 synchronized (TraceServiceGrpc.class) { 492 result = serviceDescriptor; 493 if (result == null) { 494 serviceDescriptor = 495 result = 496 io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) 497 .setSchemaDescriptor(new TraceServiceFileDescriptorSupplier()) 498 .addMethod(getBatchWriteSpansMethod()) 499 .addMethod(getCreateSpanMethod()) 500 .build(); 501 } 502 } 503 } 504 return result; 505 } 506 } 507