Skip to main content

This is common module for running fastapi with otel and oidc integration

Project description

fastapi_otel_common

Overview

fastapi_otel_common is a Python library designed to provide common utilities and components for FastAPI applications. It includes features such as configuration management, database integration, logging, routing, security, and telemetry.

Features

  • Core Configuration: Centralized configuration management for FastAPI applications.
  • Database Integration: Utilities for database connections and migrations.
  • Logging: Structured logging setup for better observability.
  • Routing: Predefined routes for health checks and other common endpoints.
  • Security: Authentication and authorization utilities.
  • Telemetry: OpenTelemetry integration for distributed tracing.

Installation

To install the package, use pip:

pip install fastapi_otel_common

Usage

Example

Here is an example of how to use fastapi_otel_common in your FastAPI application:

from fastapi import FastAPI
from fastapi_otel_common.core.config import Config
from fastapi_otel_common.logging.logger import setup_logging
from fastapi_otel_common.telemetry.tracing import setup_tracing

app = FastAPI()

# Setup configuration
config = Config()

# Setup logging
setup_logging(config)

# Setup telemetry
setup_tracing(app, config)

@app.get("/health")
def health_check():
    return {"status": "healthy"}

Project Structure

  • core/: Contains configuration and models.
  • database/: Database utilities and migration scripts.
  • logging/: Logging setup and utilities.
  • routes/: Predefined routes for the application.
  • security/: Authentication and authorization utilities.
  • telemetry/: OpenTelemetry integration for tracing.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, please contact the maintainers.

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

fastapi_otel_common-0.0.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

fastapi_otel_common-0.0.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_otel_common-0.0.2.tar.gz.

File metadata

  • Download URL: fastapi_otel_common-0.0.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fastapi_otel_common-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d936124893b1ffecc5fc134a15c5ff0702c6d90b2964c98fd4ab28ef3a6eaff1
MD5 e6b0b5bd43536b3132aa0dd178e09e8a
BLAKE2b-256 eaeab37bf722a69b523b0bc307310c6cdf692000a211f0e7de035e805c9c2431

See more details on using hashes here.

File details

Details for the file fastapi_otel_common-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_otel_common-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe2e6d245b7df9bb47ae85ac0b985b7f62d5a444d9c81d2cc8c00d2fa0a5411b
MD5 ead83130694c8d0f42358fb519f9654d
BLAKE2b-256 cdb847ac6d3e16cdb13d9260ae85a469d68d9889b1acdefb9e390aadc37c9d69

See more details on using hashes here.

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