本文整理了Java中io.opencensus.trace.Tracing.getTracer()
方法的一些代码示例,展示了Tracing.getTracer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tracing.getTracer()
方法的具体详情如下:
包路径:io.opencensus.trace.Tracing
类名称:Tracing
方法名:getTracer
[英]Returns the global Tracer.
[中]返回全局跟踪程序。
代码示例来源:origin: googleapis/google-cloud-java
TransactionManagerImpl(SessionImpl session) {
this.session = session;
this.span = Tracing.getTracer().getCurrentSpan();
}
代码示例来源:origin: googleapis/google-cloud-java
private AbstractReadContext(SessionImpl session, SpannerRpc rpc, int defaultPrefetchChunks) {
this(session, rpc, defaultPrefetchChunks, Tracing.getTracer().getCurrentSpan());
}
代码示例来源:origin: googleapis/google-cloud-java
TransactionRunnerImpl(
SessionImpl session, SpannerRpc rpc, Sleeper sleeper, int defaultPrefetchChunks) {
this.session = session;
this.sleeper = sleeper;
this.span = Tracing.getTracer().getCurrentSpan();
this.txn = session.newTransaction();
}
代码示例来源:origin: googleapis/google-cloud-java
@Override
public void onError(Throwable throwable) {
Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.Query: Error");
documentObserver.onError(throwable);
}
代码示例来源:origin: googleapis/google-cloud-java
@Override
public void onCompleted() {
Tracing.getTracer()
.getCurrentSpan()
.addAnnotation(
"Firestore.Query: Completed",
ImmutableMap.of(
"numDocuments", AttributeValue.longAttributeValue(numDocuments)));
documentObserver.onCompleted(readTime);
}
};
代码示例来源:origin: googleapis/google-cloud-java
Span span = Tracing.getTracer().getCurrentSpan();
span.addAnnotation("Acquiring read write session");
Waiter waiter = null;
代码示例来源:origin: googleapis/google-cloud-java
Span span = Tracing.getTracer().getCurrentSpan();
span.addAnnotation("Acquiring session");
Waiter waiter = null;
代码示例来源:origin: googleapis/google-cloud-java
@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());
}
}
代码示例来源:origin: googleapis/google-cloud-java
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.");
}
}
}
}
/**
代码示例来源:origin: googleapis/google-cloud-java
Tracing.getTracer()
.getCurrentSpan()
.addAnnotation(
代码示例来源:origin: googleapis/google-cloud-java
Tracing.getTracer()
.getCurrentSpan()
.addAnnotation(
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
options.getProjectId(), instanceId, databaseId));
try (Scope ss = Tracing.getTracer()
.spanBuilderWithExplicitParent(SAMPLE_SPAN, null)
.setSampler(Samplers.alwaysSample())
代码示例来源:origin: census-instrumentation/opencensus-java
/**
* 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);
}
代码示例来源:origin: com.google.cloud/google-cloud-spanner
TransactionRunnerImpl(
SessionImpl session, SpannerRpc rpc, Sleeper sleeper, int defaultPrefetchChunks) {
this.session = session;
this.sleeper = sleeper;
this.span = Tracing.getTracer().getCurrentSpan();
this.txn = session.newTransaction();
}
代码示例来源:origin: census-instrumentation/opencensus-java
@MustBeClosed
Scope withSpan() {
return Tracing.getTracer().withSpan(handler.getSpanFromContext(context));
}
}
代码示例来源:origin: com.google.cloud/google-cloud-firestore
@Override
public void onError(Throwable throwable) {
Tracing.getTracer().getCurrentSpan().addAnnotation("Firestore.Query: Error");
documentObserver.onError(throwable);
}
代码示例来源:origin: census-instrumentation/opencensus-java
/** 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);
}
代码示例来源:origin: census-instrumentation/opencensus-java
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);
}
代码示例来源:origin: census-instrumentation/opencensus-java
@MustBeClosed
@Override
public Closeable startScopedSpan(String spanName) {
checkNotNull(spanName, "spanName");
return Tracing.getTracer()
.spanBuilder(spanName)
.setSampler(Samplers.alwaysSample())
.setRecordEvents(true)
.startScopedSpan();
}
代码示例来源:origin: census-instrumentation/opencensus-java
@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)));
}
内容来源于网络,如有侵权,请联系作者删除!