Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Allegro API server implementation with Prometheus metrics support #10

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

VikramxD
Copy link
Owner

Pull Request Template for MinMochi

Description

What does this PR do?

  • Adds new functionality
  • Fixes a bug
  • Updates documentation
  • Improves performance
  • Refactors code

This PR introduces the allegro_serve.py script to implement the Allegro API using LitServe. It also adds Prometheus metrics for tracking request processing times, integrates error handling and logging for better traceability, and implements S3 upload functionality for video outputs. Furthermore, it includes the creation of the AllegroRequest model for input validation and the AllegroAPI class for handling inference requests.


Related Issue

Fixes #


Changes Summary

Key Changes:

  1. allegro_serve.py:
    • Implements Allegro API using LitServe.
    • Includes Prometheus metrics for tracking request processing times.
    • Adds structured logging with Loguru and runtime error handling.
  2. AllegroRequest Model:
    • Handles input validation for Allegro API.
  3. S3 Integration:
    • Implements video output upload to S3 from a temporary directory.
  4. Error Logging:
    • Adds an error log file to capture runtime errors for debugging.

Added Dependencies:

  • No new dependencies were introduced.

Testing

Unit Tests:

  • Added/Updated unit tests.
  • Tested locally using specific test cases.

Steps to Test:

  1. Run the allegro_serve.py script locally using test payloads.
  2. Verify the Prometheus metrics for request processing times are being updated.
  3. Check that valid requests process successfully and output is uploaded to S3.
  4. Introduce invalid requests and confirm proper error handling and logging.

Expected Behavior:

  • Valid requests process without errors and upload outputs to S3.
  • Prometheus metrics capture request processing times accurately.
  • Errors are logged in the error log file for debugging.

Checklist

  • Code is clean and adheres to project conventions.
  • Updated relevant documentation (README, comments, etc.).
  • Ran pylint, black, or equivalent formatting tools.
  • Confirmed backward compatibility.

Metrics and Monitoring

Prometheus:

  • Added/Updated metrics:
    • Metric name: request_processing_time
    • Description: Tracks the time taken to process a request.

Logging:

  • Logs are structured with loguru.
  • Verified logging covers edge cases.

Additional Information

  • Notes for the reviewer:
    • This PR introduces several new components; a detailed review of the allegro_serve.py script is recommended.
    • Assumptions were made about S3 configuration being available and accessible in the deployment environment.

- Introduced `allegro_serve.py` to implement the Allegro API using LitServe.
- Added Prometheus metrics for tracking request processing times.
- Created `AllegroRequest` model for input validation and `AllegroAPI` class for handling inference requests.
- Implemented error handling and logging for improved traceability.
- Set up a temporary directory for video output and integrated S3 upload functionality.
- Added an error log file for capturing runtime errors.
@VikramxD VikramxD merged commit ac3dd79 into main Dec 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant