Add your description here
Project description
Astrotel
Astrotel sending OpenTelemetry tracing and logging integration for Python applications into Signoz, Jaeger, OTEL Collector,... with support for FastAPI, Celery, MCP,... application
Installation
Install with pip (requires Python 3.12+):
pip install astrotel[fastapi]
For FastAPI support:
pip install astrotel[fastapi]
Usage
Basic Usage
from astrotel.provider.fastapi import FastAPIOpentelemetryTracing
from fastapi import FastAPI
app = FastAPI()
tracer = FastAPIOpentelemetryTracing()
tracer.configure_tracing(app)
Logging Integration
import logging
tracer = FastAPIOpentelemetryTracing()
logging_handler = tracer.configure_logging_handler()
# Attach handler to root logger
logging.basicConfig(
level=logging.INFO,
handlers=[logging_handler, logging.StreamHandler()] # also keep console logs
)
# Attach handler to FastAPI's logger too
uvicorn_logger = logging.getLogger("uvicorn")
uvicorn_logger.addHandler(logging_handler)
uvicorn_logger = logging.getLogger("uvicorn.access")
uvicorn_logger.addHandler(logging_handler)
fastapi_logger = logging.getLogger("fastapi")
fastapi_logger.addHandler(logging_handler)
Configuration
You can configure Astrotel via environment variables or by creating environment variables:
Meaning
OTEL_SERVICE_NAME: Set service nameOTEL_DEPLOYMENT_ENVIRONMENT: Set deployment environment nameOTEL_MODE: Send to exporter byhttporgrpcOTEL_GRPC_ENDPOINT: gRPC OTEL collector endpoint (default:http://localhost:4317)OTEL_HTTP_ENDPOINT: HTTP OTEL collector endpoint (default:http://localhost:4318)OTEL_LOGS_SHIP_LEVEL: Minimum log level to ship (DEBUG,INFO,WARNING,ERROR,CRITICAL)
For example
OTEL_SERVICE_NAME=my-service
OTEL_DEPLOYMENT_ENVIRONMENT=production
OTEL_MODE=grpc
OTEL_GRPC_ENDPOINT=http://otel-collector:4317
OTEL_HTTP_ENDPOINT=http://otel-collector:4318
OTEL_LOGS_SHIP_LEVEL=INFO
Documentation
See the docs/ or build the documentation locally:
make -C docs html
Development
- Lint:
make lint - Format:
make format
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astrotel-0.1.0.tar.gz.
File metadata
- Download URL: astrotel-0.1.0.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
053dc3789f69495756e3093673a4fa60b50064710ddb33e6e622088e6461b161
|
|
| MD5 |
141ba62090ecc12c28a026ba41ac6c8a
|
|
| BLAKE2b-256 |
54f3000e1771038fee9a0e36a2dcb3d2a1692d9666fff46a671aef38d334fb02
|
Provenance
The following attestation bundles were made for astrotel-0.1.0.tar.gz:
Publisher:
_release.yml on ghbihuy123/astrotel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astrotel-0.1.0.tar.gz -
Subject digest:
053dc3789f69495756e3093673a4fa60b50064710ddb33e6e622088e6461b161 - Sigstore transparency entry: 621097452
- Sigstore integration time:
-
Permalink:
ghbihuy123/astrotel@508b0a69aa79cecb31bbe9346a5debab347b125b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ghbihuy123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
_release.yml@508b0a69aa79cecb31bbe9346a5debab347b125b -
Trigger Event:
push
-
Statement type:
File details
Details for the file astrotel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: astrotel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d766d93315ca3e7b81b6af386557521e2f65963c804c5af76bd324d3a4848e
|
|
| MD5 |
82c32d6cc4b0985f7a77518118af1e5a
|
|
| BLAKE2b-256 |
d6be7b2cb2519c6d3685cdcf7359790af5190db69870e734dc0cca5c3978cd29
|
Provenance
The following attestation bundles were made for astrotel-0.1.0-py3-none-any.whl:
Publisher:
_release.yml on ghbihuy123/astrotel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astrotel-0.1.0-py3-none-any.whl -
Subject digest:
39d766d93315ca3e7b81b6af386557521e2f65963c804c5af76bd324d3a4848e - Sigstore transparency entry: 621097454
- Sigstore integration time:
-
Permalink:
ghbihuy123/astrotel@508b0a69aa79cecb31bbe9346a5debab347b125b -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ghbihuy123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
_release.yml@508b0a69aa79cecb31bbe9346a5debab347b125b -
Trigger Event:
push
-
Statement type: