TransactionManagerImpl(SessionImpl session) { this.session = session; this.span = Tracing.getTracer().getCurrentSpan(); }
private AbstractReadContext(SessionImpl session, SpannerRpc rpc, int defaultPrefetchChunks) { this(session, rpc, defaultPrefetchChunks, Tracing.getTracer().getCurrentSpan()); }
TransactionRunnerImpl( SessionImpl session, SpannerRpc rpc, Sleeper sleeper, int defaultPrefetchChunks) { this.session = session; this.sleeper = sleeper; this.span = Tracing.getTracer().getCurrentSpan(); this.txn = session.newTransaction(); }
@Override public void onError(Throwable throwable) { Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.Query: Error"); documentObserver.onError(throwable); }
@Override public void onCompleted() { Tracing.getTracer() .getCurrentSpan() .addAnnotation( "Firestore.Query: Completed", ImmutableMap.of( "numDocuments", AttributeValue.longAttributeValue(numDocuments))); documentObserver.onCompleted(readTime); } };
Span span = Tracing.getTracer().getCurrentSpan(); span.addAnnotation("Acquiring read write session"); Waiter waiter = null;
Span span = Tracing.getTracer().getCurrentSpan(); span.addAnnotation("Acquiring session"); Waiter waiter = null;
@Override public void onNext(RunQueryResponse response) { if (!firstResponse) { firstResponse = true; Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.Query: First response"); } if (response.hasDocument()) { numDocuments++; if (numDocuments % 100 == 0) { Tracing.getTracer() .getCurrentSpan() .addAnnotation("Firestore.Query: Received 100 documents"); } Document document = response.getDocument(); QueryDocumentSnapshot documentSnapshot = QueryDocumentSnapshot.fromDocument( firestore, Timestamp.fromProto(response.getReadTime()), document); documentObserver.onNext(documentSnapshot); } if (readTime == null) { readTime = Timestamp.fromProto(response.getReadTime()); } }
private void maybeCreateSession() { Span span = Tracing.getTracer().getCurrentSpan(); synchronized (lock) { if (numWaiters() >= numSessionsBeingCreated) { if (canCreateSession()) { span.addAnnotation("Creating session"); createSession(); } else if (options.isFailIfPoolExhausted()) { span.addAnnotation("Pool exhausted. Failing"); // throw specific exception throw newSpannerException( ErrorCode.RESOURCE_EXHAUSTED, "No session available in the pool. Maximum number of sessions in the pool can be" + " overridden by invoking SessionPoolOptions#Builder#setMaxSessions. Client can be made to block" + " rather than fail by setting SessionPoolOptions#Builder#setBlockIfPoolExhausted."); } } } } /**
Tracing.getTracer() .getCurrentSpan() .addAnnotation(
Tracing.getTracer() .getCurrentSpan() .addAnnotation(
options.getProjectId(), instanceId, databaseId)); try (Scope ss = Tracing.getTracer() .spanBuilderWithExplicitParent(SAMPLE_SPAN, null) .setSampler(Samplers.alwaysSample())
/** * Construct new client filter with custom configuration. * * @param extractor the {@code HttpExtractor} used to extract information from the * request/response. * @param propagationFormat the {@code TextFormat} used in HTTP propagation. */ public JaxrsClientFilter( HttpExtractor<ClientRequestContext, ClientResponseContext> extractor, TextFormat propagationFormat) { handler = new HttpClientHandler<>(Tracing.getTracer(), extractor, propagationFormat, SETTER); }
TransactionRunnerImpl( SessionImpl session, SpannerRpc rpc, Sleeper sleeper, int defaultPrefetchChunks) { this.session = session; this.sleeper = sleeper; this.span = Tracing.getTracer().getCurrentSpan(); this.txn = session.newTransaction(); }
@MustBeClosed Scope withSpan() { return Tracing.getTracer().withSpan(handler.getSpanFromContext(context)); } }
@Override public void onError(Throwable throwable) { Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.Query: Error"); documentObserver.onError(throwable); }
/** Create a new {@code OcJettyHttpClient}. */ public OcJettyHttpClient() { super(); OcJettyHttpClientExtractor extractor = new OcJettyHttpClientExtractor(); handler = new HttpClientHandler<Request, Response, Request>( Tracing.getTracer(), extractor, Tracing.getPropagationComponent().getTraceContextFormat(), setter); }
static HttpServerHandler<HttpServletRequest, HttpServletResponse, HttpServletRequest> buildHttpServerHandler() { return new HttpServerHandler<HttpServletRequest, HttpServletResponse, HttpServletRequest>( Tracing.getTracer(), // TODO[rghetia]: // 1. provide options to configure custom extractor, propagator and endpoint. new OcHttpServletExtractor(), Tracing.getPropagationComponent().getTraceContextFormat(), getter, true); }
@MustBeClosed @Override public Closeable startScopedSpan(String spanName) { checkNotNull(spanName, "spanName"); return Tracing.getTracer() .spanBuilder(spanName) .setSampler(Samplers.alwaysSample()) .setRecordEvents(true) .startScopedSpan(); }
@Override @SuppressWarnings("MustBeClosedChecker") // Close will happen in response filter method public void filter(ContainerRequestContext requestContext) throws IOException { ExtendedContainerRequest extendedRequest = new ExtendedContainerRequest(requestContext, info); HttpRequestContext context = handler.handleStart(requestContext, extendedRequest); requestContext.setProperty(CONTEXT_PROPERTY, context); if (requestContext.getLength() > 0) { handler.handleMessageReceived(context, requestContext.getLength()); } requestContext.setProperty( SPAN_PROPERTY, Tracing.getTracer().withSpan(handler.getSpanFromContext(context))); }