You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/functionality.rst
+70-10Lines changed: 70 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,16 +186,76 @@ and standard deviation, and also total execution time.
186
186
187
187
188
188
2. Exception Monitoring
189
-
~~~~~~~~~~~~~~~~~~~~
190
-
Flask-MonitoringDashboard automatically logs unhandled exceptions with full stack traces, showing where and why errors occur, if you have monitoring level 1 or above.
191
-
192
-
To capture handled exceptions manually and save them for displaying in the exception dashboard:
193
-
```python
194
-
try:
195
-
# Your code
196
-
except Exception as e:
197
-
dashboard.capture(e) # Logs exception with stack trace for debugging
198
-
```
189
+
~~~~~~~~~~~~~~~~~~~~~~~~
190
+
191
+
Flask-MonitoringDashboard provides comprehensive exception monitoring to help you track
192
+
and debug errors in your application. Exception monitoring is automatically enabled for
193
+
all endpoints with monitoring level 1 or above.
194
+
195
+
Automatic Exception Capture
196
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
197
+
198
+
All unhandled exceptions are automatically captured with:
199
+
200
+
- Full stack traces showing the exact line where the error occurred
201
+
- Exception type and message
202
+
- Request context (endpoint, method, parameters)
203
+
- Timestamp and occurrence count
204
+
- Function code context with syntax highlighting
205
+
206
+
The captured exceptions are grouped by their stack trace signature, making it easy to
207
+
identify recurring issues.
208
+
209
+
Manual Exception Capture
210
+
^^^^^^^^^^^^^^^^^^^^^^^^^
211
+
212
+
You can also manually capture exceptions for better debugging:
213
+
214
+
.. code-block:: python
215
+
216
+
from flask_monitoringdashboard import capture_exception
217
+
218
+
try:
219
+
# Your code that might raise an exception
220
+
result = risky_operation()
221
+
exceptValueErroras e:
222
+
capture_exception(e) # Manually capture with stack trace
223
+
# Handle the error gracefully
224
+
return"An error occurred", 400
225
+
226
+
This is useful when you want to track handled exceptions or add additional context
227
+
to error reporting.
228
+
229
+
Viewing Exceptions in the Dashboard
230
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
231
+
232
+
To view captured exceptions:
233
+
234
+
1. **Application-wide view:** Go to http://localhost:5000/dashboard/exceptions
235
+
236
+
This shows all exceptions across all endpoints, with:
237
+
238
+
- Exception count by type
239
+
- Most recent occurrences
240
+
- Affected endpoints
241
+
- Filtering by exception type, endpoint, or time period
242
+
243
+
2. **Endpoint-specific view:** Click on any endpoint in the Overview, then navigate to
244
+
the Exceptions tab: http://localhost:5000/dashboard/endpoint/:endpoint_id:/exceptions
245
+
246
+
This shows exceptions specific to that endpoint with:
247
+
248
+
- Stack trace visualization with syntax-highlighted code
249
+
- Line numbers and function names
250
+
- Ability to expand/collapse stack frames
251
+
- Full file paths on hover
252
+
253
+
Exception Data Management
254
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
255
+
256
+
Exception data is automatically cleaned up as part of the database pruning schedule
257
+
(see section 5 below). When you run database pruning, old exception occurrences
258
+
are removed along with orphaned exception types and messages.
0 commit comments