當前位置: 首頁>>代碼示例>>Java>>正文


Java Tracer.inject方法代碼示例

本文整理匯總了Java中io.opentracing.Tracer.inject方法的典型用法代碼示例。如果您正苦於以下問題:Java Tracer.inject方法的具體用法?Java Tracer.inject怎麽用?Java Tracer.inject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.opentracing.Tracer的用法示例。


在下文中一共展示了Tracer.inject方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: attachTraceInfo

import io.opentracing.Tracer; //導入方法依賴的package包/類
protected void attachTraceInfo(Tracer tracer, Span span, final Invocation inv) {
    tracer.inject(span.context(), Format.Builtin.TEXT_MAP, new TextMap() {

        @Override
        public void put(String key, String value) {
            inv.getAttachments().put(key, value);
        }

        @Override
        public Iterator<Map.Entry<String, String>> iterator() {
            throw new UnsupportedOperationException("TextMapInjectAdapter should only be used with Tracer.inject()");
        }
    });
}
 
開發者ID:yangfuhai,項目名稱:jboot,代碼行數:15,代碼來源:JbootDubboConsumerTracingFilter.java

示例2: attachTraceInfo

import io.opentracing.Tracer; //導入方法依賴的package包/類
protected void attachTraceInfo(Tracer tracer, Span span, final Request request) {
    tracer.inject(span.context(), Format.Builtin.TEXT_MAP, new TextMap() {

        @Override
        public void put(String key, String value) {
            request.setAttachment(key, value);
        }

        @Override
        public Iterator<Map.Entry<String, String>> iterator() {
            throw new UnsupportedOperationException("TextMapInjectAdapter should only be used with Tracer.inject()");
        }
    });
}
 
開發者ID:yangfuhai,項目名稱:jboot,代碼行數:15,代碼來源:JbootMotanTracingFilter.java

示例3: testInject

import io.opentracing.Tracer; //導入方法依賴的package包/類
@Test
public void testInject() {
    Tracer tracer = new StackDriverOTTracer(Trace.getTracer());

    Span span = tracer.buildSpan("Dummy").start();
    com.google.cloud.trace.core.SpanContext contextToInject = ((StackDriverOTSpanContext)span.context()).getUnderlyingSpanContext();

    Map<String, String> resultingMap = new HashMap<>();
    tracer.inject(span.context(), Format.Builtin.TEXT_MAP, new TextMapInjectAdapter(resultingMap));

    assertEquals(contextToInject.getTraceId().getApiString(), resultingMap.get(TextMapPropagator.FIELD_TRACE_ID));
    assertEquals(contextToInject.getSpanId().getApiString(), resultingMap.get(TextMapPropagator.FIELD_SPAN_ID));
}
 
開發者ID:connctd,項目名稱:stackdriver-opentracing,代碼行數:14,代碼來源:TextMapPropagatorTest.java

示例4: inject

import io.opentracing.Tracer; //導入方法依賴的package包/類
/**
 * Inject Span Context to record headers
 *
 * @param spanContext Span Context
 * @param headers record headers
 */
static void inject(SpanContext spanContext, Headers headers,
    Tracer tracer) {
  tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
      new HeadersMapInjectAdapter(headers, false));
}
 
開發者ID:opentracing-contrib,項目名稱:java-kafka-client,代碼行數:12,代碼來源:TracingKafkaUtils.java

示例5: injectSecond

import io.opentracing.Tracer; //導入方法依賴的package包/類
/**
 * Inject second Span Context to record headers
 *
 * @param spanContext Span Context
 * @param headers record headers
 */
static void injectSecond(SpanContext spanContext, Headers headers,
    Tracer tracer) {
  tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
      new HeadersMapInjectAdapter(headers, true));
}
 
開發者ID:opentracing-contrib,項目名稱:java-kafka-client,代碼行數:12,代碼來源:TracingKafkaUtils.java

示例6: inject

import io.opentracing.Tracer; //導入方法依賴的package包/類
/**
 * Inject span context to JMS message properties
 *
 * @param span span
 * @param message JMS message
 */
public static void inject(Span span, Message message, Tracer tracer) {
  tracer.inject(span.context(), Format.Builtin.TEXT_MAP, new JmsTextMapInjectAdapter(message));
}
 
開發者ID:Estafet-LTD,項目名稱:estafet-microservices-scrum-api-project-burndown,代碼行數:10,代碼來源:PropagatingTracingMessageUtils.java


注:本文中的io.opentracing.Tracer.inject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。