Skip to main content

Django middleware for AIssue error monitoring

Project description

AIssue Django Middleware

Easy Django error monitoring with AIssue. Automatically capture and send all unhandled exceptions to your AIssue dashboard for AI-powered analysis and resolution suggestions.

Installation

pip install aissue-django

Quick Setup

  1. Add to your Django settings:
# settings.py
MIDDLEWARE = [
    # ... your existing middleware
    'aissue_django.middleware.AIssueMiddleware',
]

# Required: Your AIssue API key
AISSUE_API_KEY = 'your-api-key-here'
  1. Get your API key from your AIssue dashboard

That's it! The middleware will now automatically capture all unhandled exceptions and send them to AIssue.

Configuration Options

All configuration is optional except for AISSUE_API_KEY:

# Required
AISSUE_API_KEY = 'your-api-key-here'

# Optional settings with defaults
AISSUE_BASE_URL = 'https://app.aissue.com'  # Your AIssue instance URL
AISSUE_TIMEOUT = 5  # API request timeout in seconds
AISSUE_ENABLED = True  # Enable/disable error logging
AISSUE_LOG_IN_DEBUG = False  # Log errors even when DEBUG = True

Debug Mode Behavior

By default, the middleware only logs errors when DEBUG = False (production mode). This prevents development errors from cluttering your production error logs.

To also log errors in development (when DEBUG = True), set:

AISSUE_LOG_IN_DEBUG = True

Features

  • Automatic Error Capture: Catches all unhandled Django exceptions
  • Rich Context: Captures request data, user info, headers, and full traceback
  • Non-Intrusive: Won't break your app if AIssue is unreachable
  • Debug-Aware: Respects Django's DEBUG setting
  • Configurable: Easy to enable/disable and customize
  • User Context: Automatically includes authenticated user information

What Gets Captured

For each error, the middleware sends:

  • Error Details: Exception type, message, and full traceback
  • Request Info: URL path, HTTP method, GET/POST data, request body
  • User Context: Email and ID (if user is authenticated)
  • Headers: All HTTP headers
  • Timestamp: When the error occurred

Example Error Data

{
  "error_code": 500,
  "path": "/api/users/123/",
  "method": "POST",
  "user_email": "user@example.com",
  "user_id": "456",
  "traceback": "Traceback (most recent call last)...",
  "request_data": {
    "GET": {},
    "POST": {"name": "John"},
    "body": "{\"age\": 30}"
  },
  "headers": {
    "User-Agent": "Mozilla/5.0...",
    "Content-Type": "application/json"
  }
}

Security

  • API Key: Transmitted securely via X-API-Key header
  • Sensitive Data: Be mindful of sensitive data in request bodies/headers
  • User Privacy: User emails/IDs are only sent if users are authenticated

Troubleshooting

"AISSUE_API_KEY setting is required"

Make sure you've added your API key to Django settings:

AISSUE_API_KEY = 'your-actual-api-key'

Not seeing errors in AIssue?

  1. Check that DEBUG = False or set AISSUE_LOG_IN_DEBUG = True
  2. Verify your API key is correct
  3. Check Django logs for AIssue connection errors
  4. Ensure the middleware is added to MIDDLEWARE setting

Temporarily disable logging

AISSUE_ENABLED = False

Support

License

MIT License - see LICENSE file for details.

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

aissue-1.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

aissue-1.0.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file aissue-1.0.0.tar.gz.

File metadata

  • Download URL: aissue-1.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for aissue-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8ec855646207c47354ca837e1c40df36ffe85d31c83a6176a0b10a69d7632c40
MD5 64c7dec2cd953f473e9bc1cddeb0afe4
BLAKE2b-256 658cc7ee300589435ce8d43c36ff8f87661a8572c7e1d0a3d9c372715551b993

See more details on using hashes here.

File details

Details for the file aissue-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aissue-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for aissue-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9354adb7349cab15aec0b150cb95698edd6f9eae43cbbdd0a9e59fb67aa9f8d1
MD5 0b7de0ae20913874c28ed9b4eeae2d05
BLAKE2b-256 1f56cc1524d4cfc254efd07fee6b0e6c93e821cf54cef2477bc93467f8115ca0

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