use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class ScopedTagMapTest method defaultTagContext.
@Test
public void defaultTagContext() {
TagContext defaultTagContext = tagger.getCurrentTagContext();
assertThat(tagContextToList(defaultTagContext)).isEmpty();
assertThat(defaultTagContext).isInstanceOf(TagMapImpl.class);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class CurrentTagMapUtilsTest method testGetCurrentTagMap_DefaultContext.
@Test
public void testGetCurrentTagMap_DefaultContext() {
TagContext tags = CurrentTagMapUtils.getCurrentTagMap();
assertThat(tags).isNotNull();
assertThat(tagContextToList(tags)).isEmpty();
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TagMapImplTest method remove_existingKey.
@Test
public void remove_existingKey() {
TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1, K2, VM2));
assertThat(((TagMapImpl) tagger.toBuilder(tags).remove(K1).build()).getTags()).containsExactly(K2, VM2);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TagMapImplTest method put_nullValue.
@Test
public void put_nullValue() {
TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1));
TagContextBuilder builder = tagger.toBuilder(tags);
thrown.expect(NullPointerException.class);
thrown.expectMessage("value");
builder.put(K2, null);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class CorrelationContextFormatTest method extract_OverrideTagWithSpaces.
@Test
public void extract_OverrideTagWithSpaces() throws TagContextDeserializationException {
Map<String, String> carrier = Collections.singletonMap(CORRELATION_CONTEXT, "k1= v1, k1=v2 ");
Tag expected = Tag.create(K1, V2, METADATA_UNLIMITED_PROPAGATION);
TagContext tagContext = textFormat.extract(carrier, getter);
assertThat(TagsTestUtil.tagContextToList(tagContext)).containsExactly(expected);
}
Aggregations