• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SpanBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LongBigArrayBigList类代码示例发布时间:2022-05-23
下一篇:
Java NOP类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap