@@ -16,6 +16,10 @@ OpenCensus for Python - A stats collection and distributed tracing framework
1616
1717.. _API Documentation : https://opencensus.io/api/python/trace/usage.html
1818
19+ --------
20+ Tracing
21+ --------
22+
1923Installation & basic usage
2024--------------------------
2125
@@ -210,7 +214,7 @@ For Django, you can configure the blacklist in the ``OPENCENSUS_PARAMS`` in ``se
210214 }
211215
212216
213- .. note :: By default the health check path for the App Engine flexible environment is not traced,
217+ .. note :: By default, the health check path for the App Engine flexible environment is not traced,
214218 but you can turn it on by excluding it from the blacklist setting.
215219
216220Framework Integration
@@ -219,7 +223,7 @@ Framework Integration
219223Census supports integration with popular web frameworks including
220224Django, Flask, Pyramid, and Webapp2. When the application receives a HTTP request,
221225the tracer will automatically generate a span context using the trace
222- information extracted from the request headers, and propagated to the
226+ information extracted from the request headers and propagated to the
223227child spans.
224228
225229Flask
@@ -397,6 +401,70 @@ You can enable Requests integration by specifying ``'requests'`` to ``trace_inte
397401
398402.. _Requests package : https://pypi.python.org/pypi/requests
399403
404+ ------
405+ Stats
406+ ------
407+
408+ Stackdriver Stats
409+ -----------------
410+
411+ The OpenCensus Stackdriver Stats Exporter allows users
412+ to export metrics to Stackdriver Monitoring.
413+ The API of this project is still evolving.
414+ The use of vendoring or a dependency management tool is recommended.
415+
416+ .. _Stackdriver : https://app.google.stackdriver.com/metrics-explorer
417+
418+ Exporter Usage
419+ ~~~~~~~~~~~~~~
420+
421+ Import
422+ ******
423+
424+ .. code :: python
425+
426+ from opencensus.stats.exporters import stackdriver_exporter as stackdriver
427+ from opencensus.stats import stats as stats_module
428+
429+ Prerequisites
430+ *************
431+
432+ - OpenCensus Python libraries require Python 2.7 or later.
433+ - Google Cloud Platform account and project.
434+ - Google Stackdriver Monitoring enabled on your project (Need help? `Click here `_).
435+
436+ .. _Click here : https://opencensus.io/codelabs/stackdriver
437+
438+ Register the exporter
439+ *********************
440+ .. code :: python
441+
442+ stats = stats_module.Stats()
443+ view_manager = stats.view_manager
444+
445+ exporter = stackdriver.new_stats_exporter(stackdriver.Options(project_id = " <id_value>" ))
446+ view_manager.register_exporter(exporter)
447+ ...
448+
449+
450+ Code Reference
451+ **************
452+
453+ In the *examples * folder, you can find all the necessary steps to get the exporter, register a view, put tags on the measure, and see the values against the Stackdriver monitoring tool once you have defined the *project_id *.
454+
455+ For further details for the Stackdriver implementation, see the file *stackdriver_exporter.py *.
456+
457+ +----------------------------------------------------+-------------------------------------+
458+ | Path & File | Short Description |
459+ +====================================================+=====================================+
460+ | examples/stats/exporter/stackdriver.py | End to end example |
461+ +----------------------------------------------------+-------------------------------------+
462+ | opencensus/stats/exporters/stackdriver_exporter.py | Stats implementation for Stackdriver|
463+ +----------------------------------------------------+-------------------------------------+
464+
465+ ------------------
466+ Additional Info
467+ ------------------
400468
401469Contributing
402470------------
0 commit comments