Skip to main content

Rotel SDK for Python Processors

Project description

rotel-sdk 🌶️ 🍅

Python type hints package for the Rotel processor SDK.

Description

This package provides type hints for the Rotel processor SDK and is intended for use with your Python LSP (pyright or other) in your IDE of choice. Rotel is an efficient, high-performance solution for collecting, processing, and exporting telemetry data. Rotel is ideal for resource-constrained environments and applications where minimizing overhead is critical.

When using a Python processor enabled release of Rotel, you can write native Python code to process and filter your telemetry data before sending to an exporter. Rotel provides Rust binding for Python with the pyo3 create to provide a high-performance OpenTelemetry processor API bundled as a Python extension.

Supported Telemetry Types

Telemetry Type Support
Traces Alpha
Metrics Coming Soon
Logs Coming Soon

Modules and Classes Provided

Module Classes
rotel_sdk.open_telemetry.common.v1 AnyValue, ArrayValue, InstrumentationScope, KeyValue, KeyValueList,
rotel_sdk.open_telemetry.resource.v1 Resource
rotel_sdk.open_telemetry.trace.v1 ResourceSpans, ScopeSpans, Span, Event, Link, Status

Getting Started

In order to use the Rotel Python processor SDK you will need to either build from source using the --features pyo3 flag or download the latest Python processor enabled version of Rotel. Python processor versions of Rotel are prefixed with rotel_py_processor. Choose the release that matches your system architecture and the version of Python you have installed .

For example is you are going to run Rotel and write processors on x86_64 with Python 3.13 download and install...

rotel_py_processor_3.13_v0.0.1-alpha5_x86_64-unknown-linux-gnu.tar.gz

Setting up a rotel processor development environment

Create a new virtual environment and install the rotel-sdk

mkdir /tmp/rotel_processors_example; cd /tmp/rotel_processors_example
python -m venv ./.venv
source ./.venv/bin/activate
pip install rotel-sdk --pre

Writing a trace processor with the process(resource_spans: ResourceSpans) function.

Your processor must implement a function called process in order for rotel to execute your processor. Each time process is called your processor will be handed a instance of the ResourceSpan class for you to manipulate as you like.

Trace processor example

The following is an example OTel trace processor called append_resource_attributes.py which adds the OS name, version, and a timestamp named rotel.process.time to the Resource Attributes of a batch of Spans. Open up your editor or Python IDE and paste the following into a file called append_resource_attributes.py and run with the following command.

import platform
from datetime import datetime

from rotel_sdk.open_telemetry.resource.v1 import Resource
from rotel_sdk.open_telemetry.common.v1 import KeyValue
from rotel_sdk.open_telemetry.trace.v1 import ResourceSpans


def process(resource_spans: ResourceSpans):
    resource = resource_spans.resource
    # If resource is None, we'll create a new one to store our attributes, otherwise we'll append to the existing Resource
    if resource is None:
        resource = Resource()

    current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    os_name = platform.system()
    os_version = platform.release()
    # Add attributes
    resource.attributes.append(KeyValue.new_string_value("os.name", os_name))
    resource.attributes.append(KeyValue.new_string_value("os.version", os_version))
    resource.attributes.append(KeyValue.new_string_value("rotel.process.time", current_time))

Now start rotel and the processor with the following command.

./rotel start --otlp-exporter-endpoint <otlp-endpoint-url> --otlp-with-trace-processor ./append_resource_attributes.py

Community and Getting Help

Want to chat about this project, share feedback, or suggest improvements? Join our Discord server! Whether you're a user of this project or not, we'd love to hear your thoughts and ideas. See you there! 🚀

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

rotel_sdk-0.0.1a5.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rotel_sdk-0.0.1a5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file rotel_sdk-0.0.1a5.tar.gz.

File metadata

  • Download URL: rotel_sdk-0.0.1a5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rotel_sdk-0.0.1a5.tar.gz
Algorithm Hash digest
SHA256 a798c186123296cccbc40493e95dfbf4f803f38a117a8ac0ebd1083b7c7166cb
MD5 8b46ac4f0a797b2d16db473bc56ebb93
BLAKE2b-256 88c447ee8ccc0428496260f71c9f758f201cd19f3d987c6d10bc57067e4bd363

See more details on using hashes here.

Provenance

The following attestation bundles were made for rotel_sdk-0.0.1a5.tar.gz:

Publisher: rotel-sdk-release.yml on streamfold/rotel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rotel_sdk-0.0.1a5-py3-none-any.whl.

File metadata

  • Download URL: rotel_sdk-0.0.1a5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rotel_sdk-0.0.1a5-py3-none-any.whl
Algorithm Hash digest
SHA256 4c2f8c4a87ac619eae90c0a1d8aceecaf5bc202e5c723eb13c59e6f21b35869d
MD5 2d2902fbb85266acb813f25c65a346ae
BLAKE2b-256 6bb510d7f4de93ee433b7c491727ce693f54eb4d9051dffd67cb14e19e442de5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rotel_sdk-0.0.1a5-py3-none-any.whl:

Publisher: rotel-sdk-release.yml on streamfold/rotel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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