本文整理汇总了Java中io.opentracing.Tracer.SpanBuilder类的典型用法代码示例。如果您正苦于以下问题:Java SpanBuilder类的具体用法?Java SpanBuilder怎么用?Java SpanBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpanBuilder类属于io.opentracing.Tracer包,在下文中一共展示了SpanBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSpan
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
private Span createSpan(
Instant start, String service, String procedure, String caller, HttpHeaders httpHeaders) {
SpanBuilder spanBuilder =
tracer
.buildSpan(procedure)
.withStartTimestamp(Instant.EPOCH.until(start, ChronoUnit.MICROS))
.withTag(SpanTags.CALLER, caller)
.withTag(SpanTags.SERVICE, service)
.withTag(SpanTags.ENCODING, httpHeaders.get(HeaderMapper.ENCODING))
.withTag(SpanTags.TRANSPORT, "http");
SpanContext parent =
tracer.extract(Builtin.HTTP_HEADERS, new TextMapExtractAdapter(httpHeaders));
if (parent != null) {
spanBuilder.asChildOf(parent);
}
return spanBuilder.start();
}
开发者ID:yarpc,项目名称:yarpc-java,代码行数:18,代码来源:TransportRequestDecoderConfiguration.java
示例2: doStartSpan
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
protected void doStartSpan(SpanBuilder spanBuilder, String id) {
TraceState ts = traceState.get();
if (ts == null) {
ts = new TraceState();
traceState.set(ts);
if (log.isLoggable(Level.FINEST)) {
log.finest("Create trace state = " + ts);
}
}
Span span = spanBuilder.start();
if (log.isLoggable(Level.FINEST)) {
log.finest("Start span = " + span + " id = " + id + " trace state = " + ts);
}
ts.pushSpan(span, id);
}
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:21,代码来源:OpenTracingManager.java
示例3: addReference
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder addReference(String type, SpanContext ctx) {
if (ctx != null) {
spanBuilder.addReference(type, ctx);
}
return this;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:8,代码来源:OpenTracingHelper.java
示例4: asChildOf
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder asChildOf(SpanContext ctx) {
if (ctx != null) {
spanBuilder.asChildOf(ctx);
}
return this;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:8,代码来源:OpenTracingHelper.java
示例5: processRefererTrace
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
/**
* process trace in client end
*
* @param caller
* @param request
* @return
*/
protected Response processRefererTrace(Tracer tracer, Caller<?> caller, Request request) {
String operationName = buildOperationName(request);
SpanBuilder spanBuilder = tracer.buildSpan(operationName);
Span activeSpan = OpenTracingContext.getActiveSpan();
if (activeSpan != null) {
spanBuilder.asChildOf(activeSpan);
}
Span span = spanBuilder.start();
span.setTag("requestId", request.getRequestId());
attachTraceInfo(tracer, span, request);
return process(caller, request, span);
}
开发者ID:SkywalkingTest,项目名称:docker-skywalking-test-cluster,代码行数:22,代码来源:OpenTracingFilter.java
示例6: extractTraceInfo
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
protected Span extractTraceInfo(Request request, Tracer tracer) {
String operationName = buildOperationName(request);
SpanBuilder span = tracer.buildSpan(operationName);
try {
SpanContext spanContext = tracer.extract(Format.Builtin.TEXT_MAP, new TextMapExtractAdapter(request.getAttachments()));
if (spanContext != null) {
span.asChildOf(spanContext);
}
} catch (Exception e) {
span.withTag("Error", "extract from request fail, error msg:" + e.getMessage());
}
return span.start();
}
开发者ID:SkywalkingTest,项目名称:docker-skywalking-test-cluster,代码行数:14,代码来源:OpenTracingFilter.java
示例7: rewrap
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
/**
* Replaces the {@link #delegate} SpanBuilder by a delegated-method result.
*
* @param spanBuilder The builder returned from the delegate (normally '== delegate').
* @return This re-wrapped ManagedSpanBuilder.
*/
SpanBuilder rewrap(SpanBuilder spanBuilder) {
if (spanBuilder != null) {
this.delegate = spanBuilder;
}
return this;
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:13,代码来源:ManagedSpanBuilder.java
示例8: doStartSpanWithParent
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
protected void doStartSpanWithParent(SpanBuilder spanBuilder, String id) {
Span parentSpan = getSpan();
if (parentSpan != null) {
spanBuilder.asChildOf(parentSpan);
}
doStartSpan(spanBuilder, id);
}
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:10,代码来源:OpenTracingManager.java
示例9: beforeRequest
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
public void beforeRequest(Object request, Context context) {
logger.info("before send {}", request);
// we cannot use active span because we don't know in which thread it is executed
// and we cannot therefore activate span. thread can come from common thread pool.
SpanBuilder spanBuilder = tracer.buildSpan(OPERATION_NAME)
.ignoreActiveSpan()
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
if (parentContext != null) {
spanBuilder.asChildOf(parentContext);
}
context.put("span", spanBuilder.startManual());
}
开发者ID:opentracing,项目名称:opentracing-java,代码行数:16,代码来源:RequestHandler.java
示例10: buildSpan
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder buildSpan(String operation) {
return new AgentSpanBuilder(tracer.buildSpan(operation));
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:5,代码来源:OpenTracingHelper.java
示例11: AgentSpanBuilder
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
public AgentSpanBuilder(SpanBuilder spanBuilder) {
this.spanBuilder = spanBuilder;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:4,代码来源:OpenTracingHelper.java
示例12: withStartTimestamp
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder withStartTimestamp(long ts) {
spanBuilder.withStartTimestamp(ts);
return this;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:6,代码来源:OpenTracingHelper.java
示例13: withTag
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder withTag(String name, String value) {
spanBuilder.withTag(name, value);
return this;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:6,代码来源:OpenTracingHelper.java
示例14: ignoreActiveSpan
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder ignoreActiveSpan() {
spanBuilder.ignoreActiveSpan();
return this;
}
开发者ID:opentracing-contrib,项目名称:java-agent,代码行数:6,代码来源:OpenTracingHelper.java
示例15: builder
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
private SpanBuilder builder(String operationName) {
return tracer.buildSpan(operationName)
.withTag(Tags.COMPONENT.getKey(), COMPONENT_NAME)
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
.withTag(Tags.DB_TYPE.getKey(), "redis");
}
开发者ID:opentracing-contrib,项目名称:java-redis-client,代码行数:7,代码来源:TracingHelper.java
示例16: ManagedSpanBuilder
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
ManagedSpanBuilder(SpanBuilder delegate, SpanManager spanManager) {
if (delegate == null) throw new NullPointerException("Delegate SpanBuilder was <null>.");
if (spanManager == null) throw new NullPointerException("Span manager was <null>.");
this.delegate = delegate;
this.spanManager = spanManager;
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:7,代码来源:ManagedSpanBuilder.java
示例17: asChildOf
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder asChildOf(SpanContext parent) {
return addReference(References.CHILD_OF, parent);
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:5,代码来源:ManagedSpanBuilder.java
示例18: addReference
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder addReference(String referenceType, SpanContext context) {
return rewrap(delegate.addReference(referenceType, context));
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:5,代码来源:ManagedSpanBuilder.java
示例19: withTag
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder withTag(String key, String value) {
return rewrap(delegate.withTag(key, value));
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:5,代码来源:ManagedSpanBuilder.java
示例20: withStartTimestamp
import io.opentracing.Tracer.SpanBuilder; //导入依赖的package包/类
@Override
public SpanBuilder withStartTimestamp(long microseconds) {
return rewrap(delegate.withStartTimestamp(microseconds));
}
开发者ID:opentracing-contrib,项目名称:java-spanmanager,代码行数:5,代码来源:ManagedSpanBuilder.java
注:本文中的io.opentracing.Tracer.SpanBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论