From bd11de2dc53558403fd7a159bad04ecddc769801 Mon Sep 17 00:00:00 2001 From: Florian Hermouet-Joscht Date: Mon, 13 May 2019 11:06:03 +0200 Subject: [PATCH] improv: add tracing documentation --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index c29a6e1..db8bd0c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # pm2-io-apm-python ## Getting started + ```python from pm2_io_apm_python import pm2io from pm2_io_apm_python import config @@ -10,6 +11,7 @@ pm2.start() ``` ## Add action + ```python pm2.actionService.addAction( pm2.actionManager.Action("i'm an action", lambda data: "i'm the answer\n") @@ -17,6 +19,7 @@ pm2.actionService.addAction( ``` ## Add metric + ```python randMetric = pm2.metricManager.Metric('random', 'r', 'rand') pm2.metricService.addMetric(randMetric) @@ -25,6 +28,28 @@ randMetric.setValue(random.randint(1, 1000)) ``` ## Logging + ```python pm2.notifier.log("Completely started") +``` + +## Tracing +We are using OpenCensus for Transaction Tracing in Python. You can check integrations available on [https://github.com/census-instrumentation/opencensus-python#integration](OpenCensus python integration). + +The exporter is automatically configured when you init the agent with httplib integration. + +### Example (MySQL) + +#### Install + +```python +pip install opencensus-ext-mysql +``` + +#### Add tracing + +```python +from opencensus.trace import config_integration + +config_integration.trace_integrations(['httplib', 'mysql']) ``` \ No newline at end of file