Skip to main content

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('my_container')  # 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.0b9 (2023-05-09)

Bugs Fixed

  • Fixed a bug where starting a span would fail if an unexpected keyword argument was passed in to OpenCensusSpan.

Other Changes

  • Python 2.7 is no longer supported. Please use Python version 3.7 or later.

1.0.0b8 (2021-07-01)

  • Fix for supporting kind keyword while instantiating the span.

1.0.0b7 (2021-04-08)

  • Link and SpanKind can now be added while creating the span instance.

1.0.0b6 (2020-05-04)

  • link and link_from_headers now accept attributes.

1.0.0b5 (2020-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure-core-tracing-opencensus-1.0.0b9.zip (20.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file azure-core-tracing-opencensus-1.0.0b9.zip.

File metadata

File hashes

Hashes for azure-core-tracing-opencensus-1.0.0b9.zip
Algorithm Hash digest
SHA256 2616ee1b85bc8f1175ad5d38a01b47ad415b7b1fef82a3e34f2c37bcf1e69f17
MD5 0253a36ed7044d1169f7959af0b8d394
BLAKE2b-256 ae49c03c53d63a36531372df3d8ecc7b1fd580cc1a3be448f8ef2a2c676fba7e

See more details on using hashes here.

File details

Details for the file azure_core_tracing_opencensus-1.0.0b9-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_core_tracing_opencensus-1.0.0b9-py3-none-any.whl
Algorithm Hash digest
SHA256 4b3a8a29bd939c816fb74ab4a920ad4925ee349c5864668782cff33d258a0d53
MD5 f5bba4a18eed1ea3c2ecc1c41a1ce689
BLAKE2b-256 7a3d146e63434ae12db014af99397effb8625a0fe9276e9ff92e44b85f47b73c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page