io.opentracing.tag.StringTag Java Examples
The following examples show how to use
io.opentracing.tag.StringTag.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SofaTracerTest.java From sofa-tracer with Apache License 2.0 | 5 votes |
/** * Method: withTag(String key, String value) */ @Test public void testWithTagForKeyValue() { //create SofaTracerSpan spanParent = (SofaTracerSpan) this.sofaTracer .buildSpan("testWithTagForKeyValue") .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER).start(); //tags StringTag stringTag = new StringTag("tagkey"); stringTag.set(spanParent, "tagvalue"); //tags spanParent.setTag("tag1", "value"); Map<String, String> tagsStr = spanParent.getTagsWithStr(); //string assertTrue("tagsStr : " + tagsStr, tagsStr.keySet().contains("tagkey") && tagsStr.values().contains("tagvalue")); assertTrue(tagsStr.keySet().contains("tag1") && tagsStr.values().contains("value")); //bool spanParent.setTag("bool", Boolean.TRUE); spanParent.setTag("bool1", Boolean.FALSE); assertTrue(spanParent.getTagsWithBool().get("bool").equals(Boolean.TRUE)); assertTrue(spanParent.getTagsWithBool().get("bool1").equals(Boolean.FALSE)); //number spanParent.setTag("num1", new Integer(10)); spanParent.setTag("num2", 20); spanParent.setTag("num3", 2.22); assertTrue(spanParent.getTagsWithNumber().get("num1").equals(10)); assertTrue(spanParent.getTagsWithNumber().get("num2").equals(20)); assertTrue(spanParent.getTagsWithNumber().get("num3").equals(2.22)); }
Example #2
Source File: TagListenerTest.java From opentracing-toolbox with MIT License | 5 votes |
@Test void shouldDelegateSpanBuilderTag() { final Tracer.SpanBuilder builder = unit.buildSpan("test") .withTag(new StringTag("k4"), "v"); verify(listener).onTag(eq(builder), tag("k4"), eq("v")); }
Example #3
Source File: ServletFilterHeaderSpanDecorator.java From java-specialagent with Apache License 2.0 | 4 votes |
private StringTag buildTag(String tag) { if (prefix == null) { return new StringTag(tag); } return new StringTag(prefix + tag); }
Example #4
Source File: ServletFilterHeaderSpanDecorator.java From java-web-servlet-filter with Apache License 2.0 | 4 votes |
private StringTag buildTag(String tag) { if (prefix == null) { return new StringTag(tag); } return new StringTag(prefix + tag); }
Example #5
Source File: NormalizingSpan.java From opentracing-toolbox with MIT License | 4 votes |
@Override default Span setTag(final String key, final String value) { return setTag(new StringTag(key), value); }
Example #6
Source File: NormalizingSpanBuilder.java From opentracing-toolbox with MIT License | 4 votes |
@Override default SpanBuilder withTag(final String key, final String value) { return withTag(new StringTag(key), value); }
Example #7
Source File: TagInterceptorTest.java From opentracing-toolbox with MIT License | 4 votes |
@Override public <T> Collection<TagPair> intercept(final Tag<T> tag, final T value) { return singleton(TagPair.of(new StringTag("type"), "test")); }