Radiant SDK
Project description
Radiant SDK
Radiant SDK is a Python package that simplifies the process of adding OpenTelemetry instrumentation to your applications, with a focus on integrating with Radiant's observability platform.
Features
- Easy setup of OpenTelemetry tracing with Radiant
- Automatic instrumentation of OpenAI API calls
- Simple decorator for annotating functions with tracing
Installation
The Radiant SDK uses Poetry for dependency management and packaging. To install the SDK and its dependencies:
-
Make sure you have Poetry installed. If not, install it by following the instructions at https://python-poetry.org/docs/#installation
-
Clone the repository:
git clone https://github.com/your-repo/radiant-sdk.git cd radiant-sdk
-
Install the dependencies:
poetry install
Usage
Basic Setup
from radiant import Instrumentor, annotate
# Initialize the instrumentor with your Radiant endpoint
Instrumentor.start("http://your-radiant-endpoint.com/api/v0/otel_receiver")
# Use the annotate decorator to trace functions
@annotate
def my_function():
# Your function code here
pass
Error Handling
The SDK will raise a RadiantConfigurationError
if the Radiant endpoint is not provided:
try:
Instrumentor.start("http://your-radiant-endpoint.com/api/v0/ingest/submit/otel/{YOUR_APP_NAME}", "<YOUR_API_KEY>")
except RadiantConfigurationError as e:
print(f"Failed to initialize Radiant: {e}")
If you already have a TracerProvider
(`opentelemetry.sdk.trace.TracerProvider()), you can just pass that into the configuration as well.
tracer_provider = opentelemetry.sdk.trace.TracerProvider()
try:
Instrumentor.start("http://your-radiant-endpoint.com/api/v0/ingest/submit/otel/{YOUR_APP_NAME}", "<YOUR_API_KEY>" tracer_provider)
except RadiantConfigurationError as e:
print(f"Failed to initialize Radiant: {e}")
Running Tests
To run the tests using pytest:
poetry run pytest
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
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 radiantai-0.137.0.tar.gz
.
File metadata
- Download URL: radiantai-0.137.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72cf2ee0c96281b13b22fa8fa72d8dd107803e0b687a836c4e8a2ba6062342d2 |
|
MD5 | c118638a4281f01b17477c8180ee0c2c |
|
BLAKE2b-256 | f556041b76d2e43ae1ba5f1b4be37118bf858ad81050fd8c7af5b5fdbe67dd60 |
File details
Details for the file radiantai-0.137.0-py3-none-any.whl
.
File metadata
- Download URL: radiantai-0.137.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e95f452373d41f8d930b205e8e747e7da376162050817edc688f4324df3f0350 |
|
MD5 | aa7a4aa5e1e0c0bce706ba3bd6eb2965 |
|
BLAKE2b-256 | 25b97fbaaf296934ca2f61a475fbc44b8308bef4795924465905f901423af375 |