# 500s — Error Tracking

> Catch errors before your users report them

500s automatically groups exceptions from your applications using smart fingerprinting. The lightweight Django SDK captures errors in the background — zero performance impact.

## Features

- **Smart grouping**: SHA256 algorithm combines exception type with app-frame filenames and functions. Line number changes don't create new groups — the fingerprint is stable.
- **Full error context**: Stacktrace, request data (URL, method, headers), environment variables — all stored in PostgreSQL JSONB.
- **Occurrence counter**: Denormalized event_count on each issue. See which errors occur most often — no expensive COUNT queries.
- **Convert to Scrum ticket**: One click to create a backlog ticket with auto-filled description: stacktrace, request URL, and environment.
- **SDK that never crashes your app**: Every public SDK function is wrapped in try/except. Background sending via ThreadPoolExecutor — zero impact on response time.
- **Resolved/unresolved status**: Mark errors as resolved. Filter the list to focus on active problems.

## How it works

1. **Install the SDK**: pip install monolynx-sdk and add middleware to Django settings.py. Configuration is 3 lines.
2. **Your app sends errors automatically**: Middleware catches every unhandled exception and sends it in the background to the Monolynx API.
3. **Fingerprint and grouping**: System computes a fingerprint (SHA256) and assigns the event to an existing issue or creates a new one.
4. **Analyze in the dashboard**: Issue list sorted by last occurrence. Click to see full stacktrace and context.
5. **Fix and close**: Mark the issue as resolved or create a Scrum ticket for sprint work.

## AI and MCP

Your AI agent can browse errors, analyze stacktraces, manually report bugs, and create tickets from them — 5 MCP tools.

- `list_issues`: List errors with status filtering and text search
- `get_issue`: Full details: stacktrace, request data, event history
- `update_issue_status`: Mark error as resolved or reopen
- `create_ticket_from_issue`: Create a Scrum ticket with auto-filled error description
- `create_issue`: Manually report a bug without generating a real exception

## Technical details

- **Fingerprinting**: SHA256(exception_type + app_frame_filenames:functions). Ignores line numbers and library frames (site-packages, stdlib).
- **Storage**: PostgreSQL JSONB for exception, request, and environment data. UUID primary keys.
- **SDK**: Django middleware, zero external dependencies. ThreadPoolExecutor(max_workers=2) for background sending.
- **API**: POST /api/v1/events with X-Monolynx-Key header. Response includes issue_id for tracking.
