本文整理了Java中com.nike.wingtips.Tracer.getSpanLoggingRepresentation()
方法的一些代码示例,展示了Tracer.getSpanLoggingRepresentation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tracer.getSpanLoggingRepresentation()
方法的具体详情如下:
包路径:com.nike.wingtips.Tracer
类名称:Tracer
方法名:getSpanLoggingRepresentation
暂无
代码示例来源:origin: Nike-Inc/wingtips
@DataProvider(value = {
"JSON",
"KEY_VALUE",
"null"
})
@Test
public void constructor_works_as_expected(SpanLoggingRepresentation spanLoggingFormat) {
// given
WingtipsSpringBootProperties props = generateProps(
false, UUID.randomUUID().toString(), spanLoggingFormat, "someTagStrategy", "someTagAdapter"
);
SpanLoggingRepresentation existingSpanLoggingFormat = Tracer.getInstance().getSpanLoggingRepresentation();
SpanLoggingRepresentation expectedSpanLoggingFormat = (spanLoggingFormat == null)
? existingSpanLoggingFormat
: spanLoggingFormat;
// when
WingtipsSpringBootConfiguration conf = new WingtipsSpringBootConfiguration(props);
// then
assertThat(conf.wingtipsProperties).isSameAs(props);
assertThat(Tracer.getInstance().getSpanLoggingRepresentation()).isEqualTo(expectedSpanLoggingFormat);
}
代码示例来源:origin: Nike-Inc/wingtips
@DataProvider(value = {
"JSON",
"KEY_VALUE"
}, splitBy = "\\|")
@Test
public void verify_span_serialization_methods(Tracer.SpanLoggingRepresentation serializationOption) {
// given
Span span = Span.generateRootSpanForNewTrace(UUID.randomUUID().toString(), SpanPurpose.LOCAL_ONLY).build();
String expectedOutput;
switch(serializationOption) {
case JSON:
expectedOutput = span.toJSON();
break;
case KEY_VALUE:
expectedOutput = span.toKeyValueString();
break;
default:
throw new IllegalArgumentException("Unhandled option: " + serializationOption);
}
Tracer.getInstance().setSpanLoggingRepresentation(serializationOption);
// then
assertThat(Tracer.getInstance().getSpanLoggingRepresentation()).isEqualTo(serializationOption);
// and when
String serializedString = Tracer.getInstance().serializeSpanToDesiredStringRepresentation(span);
// then
assertThat(serializedString).isEqualTo(expectedOutput);
}
内容来源于网络,如有侵权,请联系作者删除!