Skip to main content

Lightweight OpenTelemetry collector

Project description

pyrotel

Python package for the Rotel lightweight OpenTelemetry collector.

PyPI - Version PyPI - Python Version

Description

This package provides an embedded OpenTelemetry collector, built on the lightweight Rotel collector. When invoked, it spawns a background daemon that accepts OpenTelemetry metrics, traces, and logs. Designed for minimal overhead, Rotel reduces resource consumption while simplifying telemetry collection and processing in complex Python applications—without requiring additional sidecar containers.

By default, the Rotel agent listens for OpenTelemetry (OTel) data over gRPC (port 4317) and HTTP (port 4318) on localhost. It efficiently batches telemetry signals and forwards them to a configurable OTLP endpoint. Future updates will introduce support for additional filtering, transformations, and endpoints.

Usage

Add the rotel Python package to your project's dependencies.

Create the following __rotel__.py file and place it at the top of your project directory.

from rotel import Rotel, OTLPExporter

rotel = Rotel(
    exporter = OTLPExporter(
        endpoint="{ROTEL_ENDPOINT}",
    ),
)

In your main.py, add the following to load the Rotel agent:

import rotel
rotel.start()

In your deployment configuration, add the following environment variables to configure Rotel:

  • ROTEL_ENABLED=true (Rotel will only be started if this is set, allowing you to disable it in dev environments)
  • ROTEL_ENDPOINT=https://foo.example.com (match to your provider's API endpoint)

To configure the OpenTelemetry SDK, point the exporter configuration to the localhost Rotel agent. Adjust these depending on whether you are using the grpc or http exporter in your code.

  • OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
  • OTEL_EXPORTER_OTLP_PROTOCOL=grpc

See the configuration documentation for more configuration options.

Development

Install the latest version of the hatch build tool. We'll use this to manage the environments, run tests and perform builds.

Managing Python versions

Hatch will default to the system's Python version. If you want to install additional Python versions, you can use hatch to manage those. The following will install Python 3.9:

hatch python install 3.9

Then you can run tests against version 3.9 with:

hatch run test.py39:pytest

Wheel builds

To build locally using an existing Rotel agent binary, run:

hatch run build:me ../path/to/agent/file

You can always download the latest rotel agent binary from Github. Make sure to create a Github Personal Access Token (PAT) that allows you to pull Github release artifacts. Set that as GITHUB_API_TOKEN for the commands below.

To build using the latest Github built binary:

GITHUB_API_TOKEN=1234 hatch run build:me

Finally, to build for all supported platforms:

GITHUB_API_TOKEN=1234 hatch run build:all

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

rotel-0.0.1a2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

rotel-0.0.1a2-py3-none-macosx_10_9_universal2.macosx_12_3_arm64.whl (3.5 MB view details)

Uploaded Python 3macOS 10.9+ universal2 (ARM64, x86-64)macOS 12.3+ ARM64

File details

Details for the file rotel-0.0.1a2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rotel-0.0.1a2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 191223ff8db54b22e6236e5bc51b15eee5e156b514312b523933a4c1a616a340
MD5 fe172ec3154ed5735604ae4de7b02afe
BLAKE2b-256 c5130dc4d60ce507015e8f57ed4ee9e7052ff02863a1030edef251459762be36

See more details on using hashes here.

Provenance

The following attestation bundles were made for rotel-0.0.1a2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build-release.yml on streamfold/pyrotel

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-0.0.1a2-py3-none-macosx_10_9_universal2.macosx_12_3_arm64.whl.

File metadata

File hashes

Hashes for rotel-0.0.1a2-py3-none-macosx_10_9_universal2.macosx_12_3_arm64.whl
Algorithm Hash digest
SHA256 e58b5d2bae7722d9f7bf7f76f9387811423220cc41aba42e0b2618bda4aaa1d8
MD5 dc6b9849bea7fe504cfc5f8a27bcbb05
BLAKE2b-256 aa0b6563330184164a5b5af6611d046e7b22c679a535c4de4365c77308fd948d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rotel-0.0.1a2-py3-none-macosx_10_9_universal2.macosx_12_3_arm64.whl:

Publisher: build-release.yml on streamfold/pyrotel

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