Microsoft Azure Azure Core Opencensus plugin Library for Python
Project description
Azure Core Tracing OpenCensus client library for Python
Getting started
Install the opencensus python for Python with pip:
pip install azure-core-tracing-opencensus --pre
Now you can use opencensus for Python as usual with any SDKs that is compatible with azure-core tracing. This includes (not exhaustive list), azure-storage-blob, azure-keyvault-secrets, azure-eventhub, etc.
Key concepts
- You don't need to pass any context, SDK will get it for you
- The opencensus threading plugin is installed with this package
Examples
There is no explicit context to pass, you just create your usual opencensus and tracer and call any SDK code that is compatible with azure-core tracing. This is an example using Azure Monitor exporter, but you can use any exporter (Zipkin, etc.).
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.tracer import Tracer
from opencensus.trace.samplers import AlwaysOnSampler
from azure.storage.blob import BlobServiceClient
exporter = AzureExporter(
instrumentation_key="uuid of the instrumentation key (see your Azure Monitor account)"
)
tracer = Tracer(exporter=exporter, sampler=AlwaysOnSampler())
with tracer.span(name="MyApplication") as span:
client = BlobServiceClient.from_connection_string('connectionstring')
client.delete_container('mycontainer') # Call will be traced
Troubleshooting
This client raises exceptions defined in Azure Core.
Next steps
More documentation on OpenCensus configuration can be found on the OpenCensus website
Contributing
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.
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.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Release History
1.0.0b7 (2021-04-08)
Link
andSpanKind
can now be added while creating the span instance.
1.0.0b6 (2020-05-04)
link
andlink_from_headers
now accept attributes.
1.0.0b5 (2019-01-14)
Bugfix
- Fix context passing for multi-threading
- Don't fail on unknown span type, but maps to PRODUCER or UNSPECIFIED
Features
- Implement new "change_context" API
1.0.0b4 (2019-10-07)
Features
- Opencensus implementation of azure-core tracing protocol
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file azure-core-tracing-opencensus-1.0.0b7.zip
.
File metadata
- Download URL: azure-core-tracing-opencensus-1.0.0b7.zip
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6f36ed7f5a3543b2de17d5f054641e0faa0b0dae3df3e0e9a5027f1310d30d |
|
MD5 | 57d6b3027839ebc917f6ecb18c660128 |
|
BLAKE2b-256 | 8f984c919e8fc1829e83facf0c0c18336f3c686a476579c670f8add255c887c2 |
File details
Details for the file azure_core_tracing_opencensus-1.0.0b7-py2.py3-none-any.whl
.
File metadata
- Download URL: azure_core_tracing_opencensus-1.0.0b7-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 517751a75f614f9fac6742eb54224cf4cbb44c84596666ddad5b4452caed3c64 |
|
MD5 | d648173cc3e1217bc8267e82d001f803 |
|
BLAKE2b-256 | e41761cc55011b92bc6314a9234fe6a81c1660d1fb884e0c9abd2fac1263b722 |