{"id":18894873,"url":"https://github.com/vmware-archive/wavefront-opentracing-sdk-python","last_synced_at":"2025-06-11T14:12:54.821Z","repository":{"id":33761605,"uuid":"145069933","full_name":"vmware-archive/wavefront-opentracing-sdk-python","owner":"vmware-archive","description":"Wavefront OpenTracing Python SDK","archived":false,"fork":false,"pushed_at":"2023-01-19T21:27:58.000Z","size":133,"stargazers_count":0,"open_issues_count":0,"forks_count":12,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-05-05T23:39:19.830Z","etag":null,"topics":["opentracing","python","tracing","wavefront"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmware-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-17T04:01:10.000Z","updated_at":"2023-03-30T09:47:07.000Z","dependencies_parsed_at":"2023-02-11T21:30:57.304Z","dependency_job_id":null,"html_url":"https://github.com/vmware-archive/wavefront-opentracing-sdk-python","commit_stats":null,"previous_names":["wavefronthq/wavefront-opentracing-sdk-python"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fwavefront-opentracing-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fwavefront-opentracing-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fwavefront-opentracing-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fwavefront-opentracing-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmware-archive","download_url":"https://codeload.github.com/vmware-archive/wavefront-opentracing-sdk-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmware-archive%2Fwavefront-opentracing-sdk-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258885820,"owners_count":22773031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opentracing","python","tracing","wavefront"],"created_at":"2024-11-08T08:25:14.100Z","updated_at":"2025-06-11T14:12:54.730Z","avatar_url":"https://github.com/vmware-archive.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wavefront-opentracing-sdk-python\n\n# We are deprecating the OpenTracing repositories, and they are no longer supported. To migrate from OpenTracing to OpenTelemetry, see the migration steps in our [documentation](https://docs.wavefront.com/opentracing_to_opentelemetry_migration.html)\nContact our support team if you have any questions (support@wavefront.com). Thank you! \n\n![example workflow](https://github.com/wavefrontHQ/wavefront-opentracing-sdk-python/actions/workflows/main.yml/badge.svg)\n[![OpenTracing Badge](https://img.shields.io/badge/OpenTracing-enabled-blue.svg)](http://opentracing.io)\n[![image](https://img.shields.io/pypi/v/wavefront-opentracing-sdk-python.svg)](https://pypi.org/project/wavefront-opentracing-sdk-python/)\n[![image](https://img.shields.io/pypi/l/wavefront-opentracing-sdk-python.svg)](https://pypi.org/project/wavefront-opentracing-sdk-python/)\n[![image](https://img.shields.io/pypi/pyversions/wavefront-opentracing-sdk-python.svg)](https://pypi.org/project/wavefront-opentracing-sdk-python/)\n\n## Table of Content\n* [Requirements and Installation](#Requirements-and-Installation)\n* [Usage](#Usage)\n  * [Application Tags](#1-Set-Up-Application-Tags)\n  * [WavefrontSender](#2-Set-Up-a-WavefrontSender)\n  * [Reporter](#3-Set-Up-a-Reporter)\n  * [WavefrontTracer](#4-Create-a-WavefrontTracer)\n* [Span Logs](#Span-Logs)\n* [Cross Process Context Propagation](#Cross-Process-Context-Propagation)\n* [RED Metrics](#RED-Metrics)\n* [License](#License)\n* [How to Contribute](#How-to-Contribute)\n\n# Welcome to Wavefront's Python SDK\nThis is the Wavefront by VMware OpenTracing SDK for Python that provides distributed tracing support for Wavefront.\n\nThe Wavefront OpenTracing SDK for Python automatically reports metrics, custom trace data, and derived metrics.\n\n**Before you start implementing, let us make sure you are using the correct SDK!**\n\n\n![Python Tracing SDK Decision Tree](docs/python_tracing_sdk.png)\n\n\u003e ***Note***:\n\u003e \u003c/br\u003e\n\u003e   * **This is the Wavefront by VMware OpenTracing SDK for Python!**\n\u003e   If this SDK is not what you were looking for, see the [table](#wavefront-sdks) given below.\n\u003e   * See \u003ca href=\"https://docs.wavefront.com/tracing_instrumenting_frameworks.html\"\u003einstrument your application for tracing\u003c/a\u003e for more information.\n\n#### Wavefront SDKs\n\n\u003ctable id=\"SDKlevels\" style=\"width: 100%\"\u003e\n\u003ctr\u003e\n  \u003cth width=\"10%\"\u003eSDK Type\u003c/th\u003e\n  \u003cth width=\"45%\"\u003eSDK Description\u003c/th\u003e\n  \u003cth width=\"45%\"\u003eSupported Languages\u003c/th\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-collecting-trace-data\"\u003eOpenTracing SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eImplements the OpenTracing specification. Lets you define, collect, and report custom trace data from any part of your application code. \u003cbr\u003eAutomatically derives Rate Errors Duration (RED) metrics from the reported spans. \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n      \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-java\"\u003eOpenTracing SDK\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-bundle-java\"\u003eTracing Agent\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-python\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-go\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-opentracing-sdk-csharp\"\u003eOpenTracing SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-collecting-metrics-and-histograms\"\u003eMetrics SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eImplements a standard metrics library. Lets you define, collect, and report custom business metrics and histograms from any part of your application code.   \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n    \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-dropwizard-metrics-sdk-java\"\u003eDropwizard\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href =\"https://github.com/wavefrontHQ/wavefront-runtime-sdk-jvm\"\u003eJVM\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-pyformance\"\u003ePyformance SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/go-metrics-wavefront\"\u003eGo Metrics SDK\u003c/a\u003e\n      \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-appmetrics-sdk-csharp\"\u003eApp Metrics SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-that-instrument-frameworks\"\u003eFramework SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eReports predefined traces, metrics, and histograms from the APIs of a supported app framework. Lets you get started quickly with minimal code changes.\u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\u003cb\u003eJava\u003c/b\u003e:\n    \u003ca href=\"https://github.com/wavefrontHQ/wavefront-dropwizard-sdk-java\"\u003eDropwizard\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-gRPC-sdk-java\"\u003egRPC\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-jaxrs-sdk-java\"\u003eJAX-RS\u003c/a\u003e \u003cb\u003e|\u003c/b\u003e \u003ca href=\"https://github.com/wavefrontHQ/wavefront-jersey-sdk-java\"\u003eJersey\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003e.Net/C#\u003c/b\u003e:\n    \u003ca href=\"https://github.com/wavefrontHQ/wavefront-aspnetcore-sdk-csharp\"\u003eASP.Net core\u003c/a\u003e \u003c/li\u003e\n    \u003c!--- [Python](wavefront_sdks_python.html#python-sdks-that-instrument-frameworks) ---\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n  \u003ctd\u003e\u003ca href=\"https://docs.wavefront.com/wavefront_sdks.html#sdks-for-sending-raw-data-to-wavefront\"\u003eSender SDK\u003c/a\u003e\u003c/td\u003e\n  \u003ctd align=\"justify\"\u003eLets you send raw values to Wavefront for storage as metrics, histograms, or traces, e.g., to import CSV data into Wavefront.\n  \u003c/td\u003e\n  \u003ctd\u003e\n    \u003cul\u003e\n    \u003cli\u003e\n    \u003cb\u003eJava\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-java\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003ePython\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-python\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003eGo\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-go\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003e.Net/C#\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-csharp\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n    \u003cb\u003eC++\u003c/b\u003e: \u003ca href =\"https://github.com/wavefrontHQ/wavefront-sdk-cpp\"\u003eSender SDK\u003c/a\u003e\n    \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n## Requirements and Installation\n\nThis SDK supports Python 3.x.\n\n```bash\npip install wavefront-opentracing-sdk-python\n```\n\n## Usage\n\n[Tracer](https://github.com/opentracing/specification/blob/master/specification.md#tracer) is an OpenTracing interface for creating spans and propagating them across arbitrary transports.\n\nThis SDK provides a `WavefrontTracer` to create spans and send them to Wavefront. The `WavefrontTracer` also automatically generates and reports [RED metrics](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/common/metrics.md#red-metrics) from your spans.\n\nFollow these steps to create a `WavefrontTracer`:\n1. [Create an `ApplicationTags` instance](#1-Set-Up-Application-Tags), to specify metadata about your application.\n2. [Create a `WavefrontSender` instance](#2-Set-Up-a-WavefrontSender) to send trace data to Wavefront.\n3. [Create a `WavefrontSpanReporter` instance](#3-Set-Up-a-Reporter) to report trace data to Wavefront.\n4. [Create the `WavefrontTracer` instance](#4-Create-a-WavefrontTracer).\n\n\nThe following code sample creates a Tracer. For the details of each step, see the sections below.\n\n```python\ntracer = WavefrontTracer(reporter=reporter, application_tags=application_tags)\n```\n\n### 1. Set Up Application Tags\n\nApplication tags describe the structure of your application. They are included with every span reported to Wavefront and are associated with span tags that you can use to filter and query trace data in Wavefront.\n\nYou encapsulate application tags in an `ApplicationTags` object.\nSee [Instantiating ApplicationTags](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/python/applicationtags.md).\n\n\n### 2. Set Up a WavefrontSender\n\nA `WavefrontSender` object implements the low-level interface for sending data to Wavefront. You can choose to send data using the [Wavefront proxy](https://docs.wavefront.com/proxies.html) or [direct ingestion](https://docs.wavefront.com/direct_ingestion.html).\n\n* If you have already set up a `WavefrontSender` for another SDK that runs in the same process, use that one. (For details about sharing a Wavefront sender, see [Share a Wavefront Sender](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/python/wavefrontsender.md#share-a-wavefront-sender).\n\n* Otherwise, [Set Up a Wavefront Sender](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/python/wavefrontsender.md#set-up-a-wavefront-sender).\n\n\n### 3. Set Up a Reporter\nYou must create a `WavefrontSpanReporter` to report trace data to Wavefront. Optionally, you can create a `CompositeReporter` to send data to Wavefront and to print to the console.\n\n#### Create a WavefrontSpanReporter\nTo create a `WavefrontSpanReporter`:\n* Specify the Wavefront sender from [Step 2](#2-set-up-a-wavefront-sender), i.e. either `WavefrontProxyClient` or `WavefrontDirectClient`.\n* (Optional) Specify a string that represents the source for the reported spans. If you omit the source, the host name is used.\n\nExample: Create a `WavefrontSpanReporter`:\n\n```python\nimport wavefront_opentracing_sdk.reporting\nfrom wavefront_sdk import WavefrontDirectClient\n  # or\n  # from wavefront_sdk import WavefrontProxyClient\n\nwavefront_sender = ...   # see Step 2\n\nwf_span_reporter = wavefront_opentracing_sdk.reporting.WavefrontSpanReporter(\n    client=wavefront_sender,\n    source='wavefront-tracing-example'   # optional nondefault source name\n)\n\n# To get failures observed while reporting.\ntotal_failures = wf_span_reporter.get_failure_count()\n```\n\n\u003e **Note:** After you initialize the `WavefrontTracer` with the `WavefrontSpanReporter` (below), completed spans are automatically reported to Wavefront.\n\u003e You do not need to start the reporter explicitly.\n\n#### Create a CompositeReporter (Optional)\nA `CompositeReporter` enables you to chain a `WavefrontSpanReporter` to another reporter, such as a `ConsoleReporter`. A console reporter is useful for debugging.\n\n```python\nfrom wavefront_opentracing_sdk.reporting import CompositeReporter\nfrom wavefront_opentracing_sdk.reporting import ConsoleReporter\nfrom wavefront_opentracing_sdk.reporting import WavefrontSpanReporter\n\nwf_span_reporter = ...\n\n# Create a console reporter that reports span to stdout\nconsole_reporter = ConsoleReporter(source='wavefront-tracing-example')\n\n# Instantiate a composite reporter composed of console and WavefrontSpanReporter.\ncomposite_reporter = CompositeReporter(wf_span_reporter, console_reporter)\n```\n\n### 4. Create a WavefrontTracer\n\nTo create a `WavefrontTracer`, you pass the `ApplicationTags` and `Reporter` instances you created in the previous steps:\n\n```python\nimport wavefront_opentracing_sdk\n\nfrom wavefront_opentracing_sdk.reporting import WavefrontSpanReporter\nfrom wavefront_sdk.common import ApplicationTags\nfrom wavefront_sdk import WavefrontDirectClient\n  # or\n  # from wavefront_sdk import WavefrontProxyClient\n\napplication_tags = ...   # see Step 1 above\nwf_span_reporter = ...   # see Step 3 above\n\n# Construct Wavefront opentracing Tracer\ntracer = wavefront_opentracing_sdk.WavefrontTracer(\n    reporter=wf_span_reporter,\n    application_tags=application_tags)\n```\n\n#### Add Custom Span-Level RED metrics\n\nOptionally, you can propagate custom span-level tags to RED metrics. See [Custom Span-Level Tags for RED Metrics](https://docs.wavefront.com/trace_data_details.html#custom-span-level-tags-for-red-metrics) for details.\n\n```python\n# Construct Wavefront opentracing Tracer\ntracer = wavefront_opentracing_sdk.WavefrontTracer(\n    reporter=wf_span_reporter,\n    application_tags=application_tags,\n    red_metrics_custom_tag_keys={'env', 'location'})\n```\n\n#### Close the Tracer\nAlways close the tracer before exiting your application to flush all buffered spans to Wavefront.\n\n```python\ntracer.close()\n```\n\n## Span Logs\n\nYou can instrument your application to emit logs or events with spans, and examine them from the [Wavefront Tracing UI](https://docs.wavefront.com/tracing_ui_overview.html#drill-down-into-spans-and-view-metrics-and-span-logs).\n\nUse the [OpenTracing Span object's log_kv() method](https://opentracing-python.readthedocs.io/en/latest/api.html#opentracing.Span.log_kv) in your application.\n\n\n## Cross Process Context Propagation\nSee the [context propagation documentation](https://github.com/wavefrontHQ/wavefront-opentracing-sdk-python/tree/master/docs/contextpropagation.md) for details on propagating span contexts across process boundaries.\n\n## RED Metrics\n\nSee the [RED metrics documentation](https://github.com/wavefrontHQ/wavefront-sdk-doc-sources/blob/master/common/metrics.md#red-metrics) for details on the out-of-the-box metrics and histograms that are provided.\n\n## License\n[Apache 2.0 License](LICENSE).\n\n## How to Contribute\n\n* Reach out to us on our public [Slack channel](https://www.wavefront.com/join-public-slack).\n* If you run into any issues, let us know by creating a GitHub issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmware-archive%2Fwavefront-opentracing-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmware-archive%2Fwavefront-opentracing-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmware-archive%2Fwavefront-opentracing-sdk-python/lists"}