GabrielEValenzuela / chatML

A web API exposing a neural network to detect duplicate entities in knowledge graphs. It uses API key authentication and rate limits requests based on client tiers (FREEMIUM, PREMIUM)
MIT License
0 stars 0 forks source link

Spike to evaluate logging libraries (`loguru, opentelemetry, uvicorn`) #10

Open GabrielEValenzuela opened 1 month ago

GabrielEValenzuela commented 1 month ago

Description

Conduct a spike to evaluate and compare three logging solutions for use within the FastAPI project: Loguru, OpenTelemetry, and Uvicorn. The goal is to determine which solution best suits the project’s needs, considering factors such as ease of use, configurability, log formatting, and integration with FastAPI.

User Stories


Details


Evaluation Criteria

  1. Ease of Use: How simple it is to set up and use the library.
  2. Configurability: Options for customizing log format, levels, and handling.
  3. Integration: Compatibility with FastAPI and potential for integration with external monitoring solutions.
  4. Performance: Impact on application performance, especially in a production setting.
  5. Features:
    • Loguru: Known for simplicity and powerful logging with minimal setup.
    • OpenTelemetry: Popular for distributed tracing and performance monitoring, which may add valuable insights.
    • Uvicorn Logging: Native logging solution tailored to FastAPI’s default server.

Steps to Perform

  1. Loguru Setup:

    • Install and configure Loguru in a sample FastAPI route.
    • Implement log levels (info, debug, error).
    • Test structured logging and output formatting.
    • Document ease of configuration and any noteworthy features (e.g., rotating log files).
  2. OpenTelemetry Setup:

    • Set up OpenTelemetry with FastAPI.
    • Configure tracing and logging, integrating with a sample trace exporter (e.g., Jaeger).
    • Test the capability for distributed tracing and correlation of logs with traces.
    • Evaluate complexity and configuration flexibility.
  3. Uvicorn Logging:

    • Use Uvicorn’s native logging configuration with FastAPI.
    • Implement logging with various levels (info, debug, error) and observe outputs.
    • Document pros and cons, particularly in a FastAPI context, including any limitations or advantages specific to Uvicorn.
  4. Compare and Document Findings:

    • Summarize findings, with pros and cons for each option.
    • Include a recommendation based on the evaluation criteria.

Example of Findings Report (Template) for comment this issue

Library Ease of Use Configurability Integration Performance Impact Features
Loguru Easy High Limited to logging Low Simple setup, powerful formatting
OpenTelemetry Moderate High Excellent for tracing Moderate Distributed tracing, good for microservices
Uvicorn Simple Limited Native to FastAPI Minimal Basic logging, limited customization

Recommendation: [Choose library based on findings, with a summary of why this library is best suited for the project.]