Search in sources :

Example 1 with TagContext

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

the class ContextUtilsTest method testGetCurrentTagContext_DefaultContext.

@Test
public void testGetCurrentTagContext_DefaultContext() {
    TagContext tags = ContextUtils.getValue(Context.current());
    assertThat(tags).isNotNull();
    assertThat(asList(tags)).isEmpty();
}
Also used : TagContext(io.opencensus.tags.TagContext) Test(org.junit.Test)

Example 2 with TagContext

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

the class RecordDifferentTagValuesBenchmark method record.

private static MeasureMap record(Data data, Measure.MeasureLong measure, int value) {
    MeasureMap map = data.recorder.newMeasureMap();
    map.put(measure, value);
    for (TagContext tags : data.contexts) {
        map.record(tags);
    }
    return map;
}
Also used : TagContext(io.opencensus.tags.TagContext) MeasureMap(io.opencensus.stats.MeasureMap)

Example 3 with TagContext

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

the class OcAgentMetricsExporterIntegrationTest method recordTaggedStat.

private static void recordTaggedStat(TagKey key, String value, MeasureLong ml, long n) {
    TagContext context = tagger.emptyBuilder().put(key, TagValue.create(value)).build();
    statsRecorder.newMeasureMap().put(ml, n).record(context);
}
Also used : TagContext(io.opencensus.tags.TagContext)

Example 4 with TagContext

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

the class OcAgentMetricsExporterIntegrationTest method recordTaggedStat.

private static void recordTaggedStat(TagKey key, String value, MeasureDouble md, double d) {
    TagContext context = tagger.emptyBuilder().put(key, TagValue.create(value)).build();
    statsRecorder.newMeasureMap().put(md, d).record(context);
}
Also used : TagContext(io.opencensus.tags.TagContext)

Example 5 with TagContext

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

the class OcAgentMetricsExporterIntegrationTest method recordStat.

private static void recordStat(MeasureLong ml, Long n) {
    TagContext empty = tagger.emptyBuilder().build();
    statsRecorder.newMeasureMap().put(ml, n).record(empty);
}
Also used : TagContext(io.opencensus.tags.TagContext)

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