Skip to content

Latest commit

 

History

History

opencensus

OpenCensus logo

OpenCensus Stackdriver Metrics Sample

OpenCensus is a toolkit for collecting application performance and behavior data. OpenCensus includes utilities for distributed tracing, metrics collection, and context propagation within and between services.

This example demonstrates using the OpenCensus client to send metrics data to the Stackdriver Monitoring backend.

Prerequisites

Install the OpenCensus core and Stackdriver exporter libraries:

pip install -r opencensus/requirements.txt

Make sure that your environment is configured to authenticate with GCP.

Running the example

python opencensus/metrics_quickstart.py

The example generates a histogram of simulated latencies, which is exported to Stackdriver after 60 seconds. After it's exported, the histogram will be visible on the Stackdriver Metrics Explorer page as OpenCensus/task_latency_view.