Shared logging and metrics library for Road24 FastAPI microservices
Project description
road24-sdk
Shared logging and metrics SDK for Road24 microservices. Provides structured JSON logging, Prometheus metrics, and framework-specific integrations following a Sentry SDK-like pattern.
Installation
# Core library
pip install road24-sdk
# With all integrations
pip install road24-sdk[all]
# Development (includes test tools)
pip install road24-sdk[dev]
Quick Start
import road24_sdk
from fastapi import FastAPI
from httpx import AsyncClient, Timeout
from road24_sdk.integrations.fastapi import FastApiLoggingIntegration
from road24_sdk.integrations.httpx import HttpxLoggingIntegration
from road24_sdk.integrations.redis import RedisLoggingIntegration
from road24_sdk.integrations.sqlalchemy import SqlalchemyLoggingIntegration
def setup_road24_sdk():
road24_sdk.init(
service_name="my-service",
log_level="INFO",
integrations=[
HttpxLoggingIntegration(),
SqlalchemyLoggingIntegration(),
RedisLoggingIntegration(),
],
)
# FastAPI requires .setup(app) since it needs the app instance
app = FastAPI()
setup_road24_sdk()
FastApiLoggingIntegration().setup(app)
Available Integrations
| Integration | Extra | Description |
|---|---|---|
FastApiLoggingIntegration |
fastapi |
Inbound HTTP request/response logging and metrics |
HttpxLoggingIntegration |
httpx |
Outbound HTTP request/response logging and metrics |
SqlalchemyLoggingIntegration |
sqlalchemy |
Database query logging and metrics |
RedisLoggingIntegration |
redis |
Redis command logging and metrics |
Manual Testing
Standalone scripts to inspect structured JSON logs and metrics (no server needed):
make test-logs-http-input # Inbound HTTP request log
make test-logs-http-output # Outbound HTTPX request log
make test-metrics-http # Prometheus metrics after HTTP calls
make test-logs-redis # Redis command logs (SET, GET, HSET, etc.)
make test-logs-db # DB query logs (SELECT, INSERT, UPDATE, DELETE)
Development
make install # Install all dependencies (requires uv)
make test # Run tests with coverage
make lint # Lint with ruff
make format # Format with ruff
make check # Lint + test
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
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 road24_sdk-0.1.3.tar.gz.
File metadata
- Download URL: road24_sdk-0.1.3.tar.gz
- Upload date:
- Size: 92.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6cc8538fe2a91e90be61ac782c4ce98735612623d493a33bc0c03c8f950c3ec
|
|
| MD5 |
7e49e49fc4b3f211099df2102e60a6f2
|
|
| BLAKE2b-256 |
a1451ee5170eb84ee216c18ed69a78b658d07c999d0ad1dbcb6e85862faf58f2
|
File details
Details for the file road24_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: road24_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a1cc21a44457246046dbd08ac95cfd8c4cc5d4f90746b710a585cdc51c2751
|
|
| MD5 |
ac831cf7184fadff9015477600542eea
|
|
| BLAKE2b-256 |
f68967f0836ab172747d51981a946587d596f1d34beb4d00b3473f9a11f44cfa
|