aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKristen Kozak <sebright@google.com>2017-09-11 10:40:35 -0700
committerKristen Kozak <sebright@google.com>2017-09-16 09:43:29 -0700
commitc74c55e40382b9622a4b26ce2e8c77edc9c15839 (patch)
treef62997ac910bd163c2a4b7756e7a0828ed4d16a6 /examples
parentee94e55010d67c5041aa8e6011a0c1b2d813f8a5 (diff)
downloadplatform_external_opencensus-java-c74c55e40382b9622a4b26ce2e8c77edc9c15839.tar.gz
platform_external_opencensus-java-c74c55e40382b9622a4b26ce2e8c77edc9c15839.tar.bz2
platform_external_opencensus-java-c74c55e40382b9622a4b26ce2e8c77edc9c15839.zip
Rename TagContexts to Tagger (fixes #588).
Diffstat (limited to 'examples')
-rw-r--r--examples/src/main/java/io/opencensus/examples/stats/StatsRunner.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/src/main/java/io/opencensus/examples/stats/StatsRunner.java b/examples/src/main/java/io/opencensus/examples/stats/StatsRunner.java
index 5c231b57..12a6fc23 100644
--- a/examples/src/main/java/io/opencensus/examples/stats/StatsRunner.java
+++ b/examples/src/main/java/io/opencensus/examples/stats/StatsRunner.java
@@ -22,9 +22,9 @@ import io.opencensus.stats.MeasureMap;
import io.opencensus.stats.Stats;
import io.opencensus.stats.StatsRecorder;
import io.opencensus.tags.TagContext;
-import io.opencensus.tags.TagContexts;
import io.opencensus.tags.TagKey.TagKeyString;
import io.opencensus.tags.TagValue.TagValueString;
+import io.opencensus.tags.Tagger;
import io.opencensus.tags.Tags;
/** Simple program that uses Stats contexts. */
@@ -44,7 +44,7 @@ public class StatsRunner {
private static final MeasureDouble M1 = MeasureDouble.create("m1", "1st test metric", UNIT);
private static final MeasureDouble M2 = MeasureDouble.create("m2", "2nd test metric", UNIT);
- private static final TagContexts tagContexts = Tags.getTagContexts();
+ private static final Tagger tagger = Tags.getTagger();
private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();
/**
@@ -54,23 +54,23 @@ public class StatsRunner {
*/
public static void main(String[] args) {
System.out.println("Hello Stats World");
- System.out.println("Default Tags: " + tagContexts.empty());
- System.out.println("Current Tags: " + tagContexts.getCurrentTagContext());
- TagContext tags1 = tagContexts.emptyBuilder().put(K1, V1).put(K2, V2).build();
- try (Scope scopedTagCtx1 = tagContexts.withTagContext(tags1)) {
- System.out.println(" Current Tags: " + tagContexts.getCurrentTagContext());
+ System.out.println("Default Tags: " + tagger.empty());
+ System.out.println("Current Tags: " + tagger.getCurrentTagContext());
+ TagContext tags1 = tagger.emptyBuilder().put(K1, V1).put(K2, V2).build();
+ try (Scope scopedTagCtx1 = tagger.withTagContext(tags1)) {
+ System.out.println(" Current Tags: " + tagger.getCurrentTagContext());
System.out.println(
- " Current == Default + tags1: " + tagContexts.getCurrentTagContext().equals(tags1));
- TagContext tags2 = tagContexts.toBuilder(tags1).put(K3, V3).put(K4, V4).build();
- try (Scope scopedTagCtx2 = tagContexts.withTagContext(tags2)) {
- System.out.println(" Current Tags: " + tagContexts.getCurrentTagContext());
+ " Current == Default + tags1: " + tagger.getCurrentTagContext().equals(tags1));
+ TagContext tags2 = tagger.toBuilder(tags1).put(K3, V3).put(K4, V4).build();
+ try (Scope scopedTagCtx2 = tagger.withTagContext(tags2)) {
+ System.out.println(" Current Tags: " + tagger.getCurrentTagContext());
System.out.println(
" Current == Default + tags1 + tags2: "
- + tagContexts.getCurrentTagContext().equals(tags2));
+ + tagger.getCurrentTagContext().equals(tags2));
statsRecorder.record(MeasureMap.builder().set(M1, 0.2).set(M2, 0.4).build());
}
}
System.out.println(
- "Current == Default: " + tagContexts.getCurrentTagContext().equals(tagContexts.empty()));
+ "Current == Default: " + tagger.getCurrentTagContext().equals(tagger.empty()));
}
}