@@ -51,7 +51,7 @@ public static void main(String[] args) throws IOException, InterruptedException
51
51
// Register the view. It is imperative that this step exists,
52
52
// otherwise recorded metrics will be dropped and never exported.
53
53
View view = View .create (
54
- Name .create ("task_latency_distribution_4 " ),
54
+ Name .create ("task_latency_distribution " ),
55
55
"The distribution of the task latencies." ,
56
56
LATENCY_MS ,
57
57
Aggregation .Distribution .create (LATENCY_BOUNDARIES ),
@@ -68,7 +68,6 @@ public static void main(String[] args) throws IOException, InterruptedException
68
68
StackdriverStatsExporter .createAndRegister ();
69
69
// [END setup_exporter]
70
70
71
- // [START example_code]
72
71
// Record 100 fake latency values between 0 and 5 seconds.
73
72
Random rand = new Random ();
74
73
for (int i = 0 ; i < 100 ; i ++) {
@@ -81,8 +80,9 @@ public static void main(String[] args) throws IOException, InterruptedException
81
80
// live for at least the interval past any metrics that must be collected, or some risk being
82
81
// lost if they are recorded after the last export.
83
82
83
+ System .out .println (String .format (
84
+ "Sleeping %d seconds before shutdown to ensure all records are flushed." , EXPORT_INTERVAL ));
84
85
Thread .sleep (TimeUnit .MILLISECONDS .convert (EXPORT_INTERVAL , TimeUnit .SECONDS ));
85
- // [END example_code]
86
86
}
87
87
}
88
88
// [END monitoring_opencensus_metrics_quickstart]
0 commit comments