本文整理汇总了Java中io.opentracing.propagation.TextMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java TextMap.put方法的具体用法?Java TextMap.put怎么用?Java TextMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.opentracing.propagation.TextMap
的用法示例。
在下文中一共展示了TextMap.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterMethod
import io.opentracing.propagation.TextMap; //导入方法依赖的package包/类
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Object ret) throws Throwable {
Format format = (Format)allArguments[1];
if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
TextMap carrier = (TextMap)allArguments[2];
ContextCarrier contextCarrier = new ContextCarrier();
ContextManager.inject(contextCarrier);
CarrierItem next = contextCarrier.items();
while (next.hasNext()) {
next = next.next();
carrier.put(next.getHeadKey(), next.getHeadValue());
}
} else {
//Don't support other format yet.
}
return null;
}
示例2: injectItem
import io.opentracing.propagation.TextMap; //导入方法依赖的package包/类
private void injectItem(Map.Entry<String, String> item, TextMap textMap) {
if (TRACE_ID.equalsIgnoreCase(item.getKey())) {
// Save trace id as a String because it might not be a number, as MockContext expects
textMap.put(TRACE_ID, item.getValue());
} else {
textMap.put(BAGGAGE_PREFIX + item.getKey(), item.getValue());
}
}
示例3: inject
import io.opentracing.propagation.TextMap; //导入方法依赖的package包/类
@Override
public <C> void inject(MockSpan.MockContext ctx, Format<C> format, C carrier) {
if (carrier instanceof TextMap) {
TextMap textMap = (TextMap) carrier;
for (Map.Entry<String, String> entry : ctx.baggageItems()) {
textMap.put(BAGGAGE_KEY_PREFIX + entry.getKey(), entry.getValue());
}
textMap.put(SPAN_ID_KEY, String.valueOf(ctx.spanId()));
textMap.put(TRACE_ID_KEY, String.valueOf(ctx.traceId()));
} else {
throw new IllegalArgumentException("Unknown carrier");
}
}
示例4: put
import io.opentracing.propagation.TextMap; //导入方法依赖的package包/类
private void put(TextMap carrier, Object key, Object value) {
carrier.put(keyCodex.encode(key), valueCodex.encode(value));
}
示例5: inject
import io.opentracing.propagation.TextMap; //导入方法依赖的package包/类
public void inject(StackDriverOTSpanContext spanContext, TextMap textMap) {
com.google.cloud.trace.core.SpanContext context = spanContext.getUnderlyingSpanContext();
textMap.put(FIELD_TRACE_ID, context.getTraceId().getApiString());
textMap.put(FIELD_SPAN_ID, context.getSpanId().getApiString());
}