Skip to main content

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:

  1. Import the ApolloTracker class:

    from apollo_tracker.tracker import ApolloTracker
    
  2. Initialize the tracker with your service name:

    tracker = ApolloTracker(service_name="projet_uid")
    
  3. 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 ApolloTracker class 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

apollo_tracker-0.1.3.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

apollo_tracker-0.1.3-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file apollo_tracker-0.1.3.tar.gz.

File metadata

  • Download URL: apollo_tracker-0.1.3.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

Hashes for apollo_tracker-0.1.3.tar.gz
Algorithm Hash digest
SHA256 274f4a31bb83b93972656e554ff3599f5d8288861bf7b20f6198c345d4f9bb0f
MD5 42542693362354b1367c301a18e2425d
BLAKE2b-256 a8dc4cee7f3ab3ca9942cb75b5ca480e9a8bde693a26b977e5c2f9da0f53547c

See more details on using hashes here.

File details

Details for the file apollo_tracker-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: apollo_tracker-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for apollo_tracker-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11f55d2f3d1fdb3c565f75e7184634657b36912a31f14983853fd5f96a891eef
MD5 a50e91e87e2788910cc773299bcd8262
BLAKE2b-256 481257e14a85d2ad8b9763fc32b3c34294fc05a36e929bed5065d0e303d05a67

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