docs: complete CSP metrics API documentation

- Add missing offset parameter to query parameters table
- Document 10,000 violation entries hard cap for memory management
- Ensure documentation matches all code examples
- Clarify both time-based and count-based memory constraints

Resolves inconsistency between examples and parameter documentation
This commit is contained in:
2025-07-13 17:03:30 +02:00
parent 76880f9c42
commit 5fb491214a

View File

@ -64,6 +64,7 @@ GET /api/csp-metrics
| `format` | string | Response format | `json` | `?format=csv` | | `format` | string | Response format | `json` | `?format=csv` |
| `groupBy` | string | Group results by field | `hour` | `?groupBy=directive` | | `groupBy` | string | Group results by field | `hour` | `?groupBy=directive` |
| `includeDetails` | boolean | Include violation details | `false` | `?includeDetails=true` | | `includeDetails` | boolean | Include violation details | `false` | `?includeDetails=true` |
| `offset` | string | Shift the queried time-window backwards by the given duration (for comparisons) | `0` | `?offset=24h` |
#### Time Range Options #### Time Range Options
@ -412,6 +413,7 @@ CSP_ALERT_THRESHOLD=5 # violations per 10 minutes
### Memory Management ### Memory Management
- **Violation buffer** limited to 7 days of data in memory - **Violation buffer** limited to 7 days of data in memory
- **Hard cap** of 10,000 violation entries to prevent memory exhaustion
- **Automatic cleanup** runs every 100 requests (1% probability) - **Automatic cleanup** runs every 100 requests (1% probability)
- **Efficient storage** using Map data structures - **Efficient storage** using Map data structures