Skip to content

Commit 17f4d70

Browse files
committed
Working, though maybe not usefully yet
1 parent c6d8129 commit 17f4d70

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

opencensus/quickstart/quickstart.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# [START monitoring_opencensus_metrics_quickstart]
16+
1517
import time
1618
import random
1719

@@ -23,7 +25,7 @@
2325

2426
from opencensus.stats.exporters import stackdriver_exporter
2527

26-
28+
# [START setup_exporter]
2729
# Set up the metric to be tracked
2830

2931
# Latency of two kinds of simulated operations, "normal" and "extra"
@@ -45,8 +47,8 @@
4547
latency_distribution
4648
)
4749

48-
4950
# Initialization
51+
5052
statistics = stats.Stats()
5153

5254
view_manager = statistics.view_manager
@@ -57,15 +59,8 @@
5759

5860
view_manager.register_exporter(exporter)
5961
view_manager.register_view(latency_view)
60-
61-
# [START monitoring_opencensus_metrics_quickstart]
62-
63-
# [START setup_exporter]
64-
6562
# [END setup_exporter]
6663

67-
# [END monitoring_opencensus_metrics_quickstart]
68-
6964

7065
def process(kind):
7166
sleep_time = random.random() ** 2 # More interesting than just linear
@@ -95,7 +90,9 @@ def main(iteration_count):
9590
measure_map.measure_float_put(latency_measure, duration)
9691
tag_map = opencensus.tags.TagMap()
9792
tag_map.insert(latency_key, opencensus.tags.tag_value.TagValue(kind))
98-
measure_map.record(tag_map)
93+
94+
measure_map.record(tag_map)
95+
# [END monitoring_opencensus_metrics_quickstart]
9996

10097

10198
if __name__ == '__main__':

0 commit comments

Comments
 (0)