A lightweight Flask middleware that captures and reports errors to Apollo, a centralized error tracking system.
Project description
Apollo Tracker
Apollo Tracker is a lightweight Flask middleware for tracking and reporting errors to Apollo, an internal error tracking system similar to Sentry.
Features
- 🛠 Automatic Error Tracking: Captures and reports all unhandled exceptions.
- 🚀 Flask Integration: Works seamlessly with Flask applications.
- 📡 Send Errors to Apollo: Forwards error logs to an Apollo backend.
- 🔍 Includes Request Metadata: Logs IP address, user agent, endpoint, and method.
- 📦 Simple Installation: Just
pip install apollo-tracker.
Installation
You can install apollo-tracker using pip:
pip install apollo-tracker
Usage
1. Setup ApolloTracker in Your Flask App
To start tracking errors in your Flask app, follow these steps:
-
Import the ApolloTracker class:
from apollo_tracker.tracker import ApolloTracker
-
Initialize the tracker with your service name:
tracker = ApolloTracker(service_name="projet_uid")
-
Register the error handler:
tracker.register_error_handler(app)
2. Example Flask App Setup
from flask import Flask
from apollo_tracker.tracker import ApolloTracker # import the tracker class
app = Flask(__name__)
# Initialize ApolloTracker with your service name
tracker = ApolloTracker(service_name="my_project_id")
# Register the error handler to track errors globally
tracker.register_error_handler(app)
@app.route('/')
def home():
# Simulate an error
1 / 0 # This will raise a ZeroDivisionError
if __name__ == "__main__":
app.run(debug=True)
3. Error Handling
- The
ApolloTrackerclass automatically captures unhandled exceptions in your Flask app. - When an error occurs, it sends detailed information (like the error type, message, stack trace, request path, and user agent) to the Apollo server.
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 apollo_tracker-0.1.4.tar.gz.
File metadata
- Download URL: apollo_tracker-0.1.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64e60a14ca91bf634250eff5a375ef2dca15e1d708141c7181b9a100e212cd40
|
|
| MD5 |
118d2547109f86507f2afc6c6ffece6e
|
|
| BLAKE2b-256 |
c66ee03bf785abb87505c6c2b6d3532cd7a1c8f38fcc58088ff0578dc5c713ab
|
File details
Details for the file apollo_tracker-0.1.4-py3-none-any.whl.
File metadata
- Download URL: apollo_tracker-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff101037b35f217f3e5f469c688d09eaeebe991d1009529a1dc01f66f8cecd6e
|
|
| MD5 |
087122952378d036917f99d7603c1bd5
|
|
| BLAKE2b-256 |
2c2da1c6dc9b5db65636e8dd2b9e09bcee9cf343bb8e8eca0edfe98511c466a8
|