Search in sources :

Example 16 with TagContext

use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.

the class TagMapImplTest method remove_differentKey.

@Test
public void remove_differentKey() {
    TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1));
    assertThat(((TagMapImpl) tagger.toBuilder(tags).remove(K2).build()).getTags()).containsExactly(K1, VM1);
}
Also used : TagContext(io.opencensus.tags.TagContext) Test(org.junit.Test)

Example 17 with TagContext

use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.

the class TagMapImplTest method put_nullKey.

@Test
public void put_nullKey() {
    TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1));
    TagContextBuilder builder = tagger.toBuilder(tags);
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("key");
    builder.put(null, V2);
}
Also used : TagContext(io.opencensus.tags.TagContext) TagContextBuilder(io.opencensus.tags.TagContextBuilder) Test(org.junit.Test)

Example 18 with TagContext

use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.

the class TagMapImplTest method remove_nullKey.

@Test
public void remove_nullKey() {
    TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1));
    TagContextBuilder builder = tagger.toBuilder(tags);
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("key");
    builder.remove(null);
}
Also used : TagContext(io.opencensus.tags.TagContext) TagContextBuilder(io.opencensus.tags.TagContextBuilder) Test(org.junit.Test)

Example 19 with TagContext

use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.

the class TagMapImplTest method putLocal.

@Test
public void putLocal() {
    TagContext tags1 = tagger.emptyBuilder().put(K1, V1, METADATA_NO_PROPAGATION).build();
    TagContext tags2 = tagger.emptyBuilder().putLocal(K1, V1).build();
    assertThat(tags1).isEqualTo(tags2);
}
Also used : TagContext(io.opencensus.tags.TagContext) Test(org.junit.Test)

Example 20 with TagContext

use of io.opencensus.tags.TagContext in project instrumentation-java by census-instrumentation.

the class TagMapImplTest method put_newKey.

@Test
public void put_newKey() {
    TagContext tags = new TagMapImpl(ImmutableMap.of(K1, VM1));
    assertThat(((TagMapImpl) tagger.toBuilder(tags).put(K2, V2).build()).getTags()).containsExactly(K1, VM1, K2, VM2);
}
Also used : TagContext(io.opencensus.tags.TagContext) Test(org.junit.Test)

Aggregations

TagContext (io.opencensus.tags.TagContext)76 Test (org.junit.Test)56 Tag (io.opencensus.tags.Tag)10 TagContextBuilder (io.opencensus.tags.TagContextBuilder)9 ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)7 Context (io.grpc.Context)6 Scope (io.opencensus.common.Scope)5 StatsTestUtil.createEmptyViewData (io.opencensus.implcore.stats.StatsTestUtil.createEmptyViewData)5 View (io.opencensus.stats.View)5 ViewData (io.opencensus.stats.ViewData)5 Metadata (io.grpc.Metadata)3 StatsTestUtils (io.grpc.internal.testing.StatsTestUtils)3 MeasureMap (io.opencensus.stats.MeasureMap)3 TagValue (io.opencensus.tags.TagValue)3 SpanContext (io.opencensus.trace.SpanContext)3 HashMap (java.util.HashMap)3 ServerStreamTracer (io.grpc.ServerStreamTracer)2 CallAttemptsTracerFactory (io.grpc.census.CensusTracingModule.CallAttemptsTracerFactory)2 HttpRequestContext (io.opencensus.contrib.http.HttpRequestContext)2 SimpleTagContext (io.opencensus.implcore.stats.StatsTestUtil.SimpleTagContext)2