本文整理了Java中brave.Tracer.startScopedSpanWithParent()
方法的一些代码示例,展示了Tracer.startScopedSpanWithParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tracer.startScopedSpanWithParent()
方法的具体详情如下:
包路径:brave.Tracer
类名称:Tracer
方法名:startScopedSpanWithParent
[英]Same as #startScopedSpan(String), except ignores the current trace context.
Use this when you are creating a scoped span in a method block where the parent was created. You can also use this to force a new trace by passing null parent.
[中]与#startScopedSpan(字符串)相同,只是忽略当前跟踪上下文。
在创建父级的方法块中创建范围跨度时,请使用此选项。您还可以使用它通过传递null parent来强制执行新跟踪。
代码示例来源:origin: openzipkin/brave
/**
* Returns a new child span if there's a {@link #currentSpan()} or a new trace if there isn't. The
* result is the "current span" until {@link ScopedSpan#finish()} is called.
*
* Here's an example:
* <pre>{@code
* ScopedSpan span = tracer.startScopedSpan("encode");
* try {
* // The span is in "scope" so that downstream code such as loggers can see trace IDs
* return encoder.encode();
* } catch (RuntimeException | Error e) {
* span.error(e); // Unless you handle exceptions, you might not know the operation failed!
* throw e;
* } finally {
* span.finish();
* }
* }</pre>
*/
public ScopedSpan startScopedSpan(String name) {
return startScopedSpanWithParent(name, null);
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
@Override
public V call() throws Exception {
ScopedSpan span = this.tracer.startScopedSpanWithParent(this.spanName,
this.parent);
try {
return this.delegate.call();
}
catch (Exception | Error ex) {
span.error(ex);
throw ex;
}
finally {
span.finish();
}
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
@Override
public void run() {
ScopedSpan span = this.tracer.startScopedSpanWithParent(this.spanName,
this.parent);
try {
this.delegate.run();
}
catch (Exception | Error e) {
span.error(e);
throw e;
}
finally {
span.finish();
}
}
代码示例来源:origin: openzipkin/brave
void startScopedSpanWithParent(Tracer tracer, TraceContext context) {
ScopedSpan span = tracer.startScopedSpanWithParent("encode", context);
try {
span.tag("foo", "bar");
span.tag("baz", "qux");
} finally {
span.finish();
}
}
代码示例来源:origin: io.zipkin.brave/brave
/**
* Returns a new child span if there's a {@link #currentSpan()} or a new trace if there isn't. The
* result is the "current span" until {@link ScopedSpan#finish()} is called.
*
* Here's an example:
* <pre>{@code
* ScopedSpan span = tracer.startScopedSpan("encode");
* try {
* // The span is in "scope" so that downstream code such as loggers can see trace IDs
* return encoder.encode();
* } catch (RuntimeException | Error e) {
* span.error(e); // Unless you handle exceptions, you might not know the operation failed!
* throw e;
* } finally {
* span.finish();
* }
* }</pre>
*/
public ScopedSpan startScopedSpan(String name) {
return startScopedSpanWithParent(name, null);
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core
@Override
public V call() throws Exception {
ScopedSpan span = this.tracer.startScopedSpanWithParent(this.spanName,
this.parent);
try {
return this.delegate.call();
}
catch (Exception | Error ex) {
span.error(ex);
throw ex;
}
finally {
span.finish();
}
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-core
@Override
public void run() {
ScopedSpan span = this.tracer.startScopedSpanWithParent(this.spanName,
this.parent);
try {
this.delegate.run();
}
catch (Exception | Error e) {
span.error(e);
throw e;
}
finally {
span.finish();
}
}
内容来源于网络,如有侵权,请联系作者删除!