Skip to content

Commit dbf47e3

Browse files
committed
Readme
1 parent 7511f64 commit dbf47e3

File tree

1 file changed

+58
-1
lines changed
  • sdk/core/azure-core-tracing-opencensus

1 file changed

+58
-1
lines changed
Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,61 @@
11

22

3-
# Azure Core Tracing OpenCensus plugin
3+
# Azure Core Tracing OpenCensus client library for Python
44

5+
## Getting started
6+
7+
Install the opencensus python for Python with [pip](https://pypi.org/project/pip/):
8+
9+
```bash
10+
pip install azure-core-tracing-opencensus --pre
11+
```
12+
13+
Now you can use opencensus for Python as usual with any SDKs that is compatible
14+
with azure-core tracing. This includes (not exhaustive list), azure-storage-blob, azure-keyvault-secrets, azure-eventhub, etc.
15+
16+
## Key concepts
17+
18+
* You don't need to pass any context, SDK will get it for you
19+
* The opencensus threading plugin is installed with this package
20+
21+
## Examples
22+
23+
There is no explicit context to pass, you just create your usual opencensus and tracer and
24+
call any SDK code that is compatible with azure-core tracing. This is an example
25+
using Azure Monitor exporter, but you can use any exporter (Zipkin, etc.).
26+
27+
```python
28+
from opencensus.ext.azure.trace_exporter import AzureExporter
29+
30+
from opencensus.trace.tracer import Tracer
31+
from opencensus.trace.samplers import AlwaysOnSampler
32+
33+
from azure.storage.blob import BlobServiceClient
34+
35+
exporter = AzureExporter(
36+
instrumentation_key="uuid of the instrumentation key (see your Azure Monitor account)"
37+
)
38+
39+
tracer = Tracer(exporter=exporter, sampler=AlwaysOnSampler())
40+
with tracer.span(name="MyApplication") as span:
41+
client = BlobServiceClient.from_connection_string('connectionstring')
42+
client.delete_container('mycontainer') # Call will be traced
43+
```
44+
45+
46+
## Troubleshooting
47+
48+
This client raises exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/docs/exceptions.md).
49+
50+
51+
## Next steps
52+
53+
More documentation on OpenCensus configuration can be found on the [OpenCensus website](https://opencensus.io)
54+
55+
56+
## Contributing
57+
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
58+
59+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
60+
61+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

0 commit comments

Comments
 (0)