Tabnine Logo
ApiCallContext.withTracer
Code IndexAdd Tabnine to your IDE (free)

How to use
withTracer
method
in
com.google.api.gax.rpc.ApiCallContext

Best Java code snippets using com.google.api.gax.rpc.ApiCallContext.withTracer (Showing top 5 results out of 315)

origin: com.google.api/gax

 @Override
 public void call(
   RequestT request, ResponseObserver<ResponseT> responseObserver, ApiCallContext context) {

  ApiTracer tracer = tracerFactory.newTracer(spanName);
  TracedResponseObserver<ResponseT> tracedObserver =
    new TracedResponseObserver<>(tracer, responseObserver);

  context = context.withTracer(tracer);

  try {
   innerCallable.call(request, tracedObserver, context);
  } catch (RuntimeException e) {
   tracedObserver.onError(e);
   throw e;
  }
 }
}
origin: googleapis/gax-java

 /**
  * Calls the wrapped {@link UnaryCallable} within the context of a new trace.
  *
  * @param request the request to send.
  * @param context {@link ApiCallContext} to make the call with.
  */
 @Override
 public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) {
  ApiTracer tracer = tracerFactory.newTracer(spanName);
  TraceFinisher<ResponseT> finisher = new TraceFinisher<>(tracer);

  try {
   context = context.withTracer(tracer);
   ApiFuture<ResponseT> future = innerCallable.futureCall(request, context);
   ApiFutures.addCallback(future, finisher, MoreExecutors.directExecutor());

   return future;
  } catch (RuntimeException e) {
   finisher.onFailure(e);
   throw e;
  }
 }
}
origin: com.google.api/gax

 /**
  * Calls the wrapped {@link UnaryCallable} within the context of a new trace.
  *
  * @param request the request to send.
  * @param context {@link ApiCallContext} to make the call with.
  */
 @Override
 public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) {
  ApiTracer tracer = tracerFactory.newTracer(spanName);
  TraceFinisher<ResponseT> finisher = new TraceFinisher<>(tracer);

  try {
   context = context.withTracer(tracer);
   ApiFuture<ResponseT> future = innerCallable.futureCall(request, context);
   ApiFutures.addCallback(future, finisher, MoreExecutors.directExecutor());

   return future;
  } catch (RuntimeException e) {
   finisher.onFailure(e);
   throw e;
  }
 }
}
origin: com.google.api/gax

@Override
public ClientStream<RequestT> internalCall(
  ResponseObserver<ResponseT> responseObserver,
  ClientStreamReadyObserver<RequestT> onReady,
  ApiCallContext context) {
 ApiTracer tracer = tracerFactory.newTracer(spanName);
 context = context.withTracer(tracer);
 AtomicBoolean wasCancelled = new AtomicBoolean();
 ResponseObserver<ResponseT> tracedObserver =
   new TracedResponseObserver<>(tracer, responseObserver, wasCancelled);
 ClientStreamReadyObserver<RequestT> tracedReadyObserver =
   new TracedClientStreamReadyObserver<>(tracer, onReady, wasCancelled);
 try {
  ClientStream<RequestT> clientStream =
    innerCallable.internalCall(tracedObserver, tracedReadyObserver, context);
  return new TracingClientStream<>(tracer, clientStream, wasCancelled);
 } catch (RuntimeException e) {
  tracer.operationFailed(e);
  throw e;
 }
}
origin: com.google.api/gax

 @Override
 public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) {
  // NOTE: This will be invoked asynchronously outside of the original caller's thread.
  // So this start a top level tracer.
  ApiTracer tracer = tracerFactory.newRootTracer(spanName);
  TraceFinisher<ResponseT> finisher = new TraceFinisher<>(tracer);

  try {
   long elementCount = batchingDescriptor.countElements(request);
   long requestSize = batchingDescriptor.countBytes(request);

   tracer.batchRequestSent(elementCount, requestSize);

   context = context.withTracer(tracer);
   ApiFuture<ResponseT> future = innerCallable.futureCall(request, context);
   ApiFutures.addCallback(future, finisher, MoreExecutors.directExecutor());

   return future;
  } catch (RuntimeException e) {
   finisher.onFailure(e);
   throw e;
  }
 }
}
com.google.api.gax.rpcApiCallContextwithTracer

Javadoc

Returns a new ApiCallContext with the given ApiTracer.

The ApiTracer will be used to trace the current operation and to annotate various events like retries.

Popular methods of ApiCallContext

  • getStreamIdleTimeout
    The stream idle timeout set for this context.
  • getStreamWaitTimeout
    Return the stream wait timeout set for this context.
  • getTimeout
    Returns the configured per-RPC timeout.
  • getTracer
    The ApiTracer that was previously set for this context.The ApiTracer will be used to trace the curre
  • nullToSelf
    If inputContext is not null, returns it; if it is null, returns the present instance.
  • withTimeout
    Returns a new ApiCallContext with the given timeout set.This sets the maximum amount of time a singl
  • merge
    For any values in inputCallContext that are not null, override the corresponding values in the prese
  • withCredentials
    Returns a new ApiCallContext with the given credentials set.
  • withStreamIdleTimeout
    Returns a new ApiCallContext with the given stream idle timeout set.This timeout only applies to a S
  • withStreamWaitTimeout
    Returns a new ApiCallContext with the given stream timeout set.This timeout only applies to a Server
  • withTransportChannel
    Returns a new ApiCallContext with the given channel set.
  • withTransportChannel

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Join (org.hibernate.mapping)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now