use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method withTagContext_ConvertUnknownTagContextToTagMapImpl.
@Test
public void withTagContext_ConvertUnknownTagContextToTagMapImpl() {
TagContext unknownTagContext = new SimpleTagContext(TAG1, TAG2, TAG3);
TagContext result = getResultOfWithTagContext(unknownTagContext);
assertThat(result).isInstanceOf(TagMapImpl.class);
assertThat(tagContextToList(result)).containsExactly(TAG1, TAG2, TAG3);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method withTagContext_RemoveDuplicatesFromUnknownTagContext.
@Test
public void withTagContext_RemoveDuplicatesFromUnknownTagContext() {
Tag tag1 = Tag.create(K1, V1);
Tag tag2 = Tag.create(K1, V2);
TagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
TagContext result = getResultOfWithTagContext(tagContextWithDuplicateTags);
assertThat(tagContextToList(result)).containsExactly(tag2);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder_TaggingReenabled.
@Test
public void currentBuilder_TaggingReenabled() {
TagContext tags = new SimpleTagContext(TAG1);
tagsComponent.setState(TaggingState.DISABLED);
assertThat(getResultOfCurrentBuilder(tags)).isSameInstanceAs(NoopTagMapBuilder.INSTANCE);
tagsComponent.setState(TaggingState.ENABLED);
TagContextBuilder builder = getResultOfCurrentBuilder(tags);
assertThat(builder).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(builder.build())).containsExactly(TAG1);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method toBuilder_RemoveDuplicatesFromUnknownTagContext.
@Test
public void toBuilder_RemoveDuplicatesFromUnknownTagContext() {
Tag tag1 = Tag.create(K1, V1);
Tag tag2 = Tag.create(K1, V2);
TagContext tagContextWithDuplicateTags = new SimpleTagContext(tag1, tag2);
TagContext newTagContext = tagger.toBuilder(tagContextWithDuplicateTags).build();
assertThat(tagContextToList(newTagContext)).containsExactly(tag2);
}
use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method getCurrentTagContext_DefaultIsEmptyTagMapImpl.
@Test
public void getCurrentTagContext_DefaultIsEmptyTagMapImpl() {
TagContext currentTagContext = tagger.getCurrentTagContext();
assertThat(tagContextToList(currentTagContext)).isEmpty();
assertThat(currentTagContext).isInstanceOf(TagMapImpl.class);
}
Aggregations