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