Skip to content

Commit d6f341c

Browse files
committed
improve the workers observability errors documentation
1 parent b23c233 commit d6f341c

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/content/docs/workers/observability/errors.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,37 @@ To review whether your application is experiencing any downtime or returning any
244244

245245
A `responseStreamDisconnected` event `outcome` occurs when one end of the connection hangs up during the deferred proxying stage of a Worker request flow. This is regarded as an error for request metrics, and presents in logs as a non-error log entry. It commonly appears for longer lived connections such as WebSockets.
246246

247-
## Debug exceptions
247+
### Worker Errors
248248

249-
After you have identified your Workers application is returning exceptions, use `wrangler tail` to inspect and fix the exceptions.
249+
The `Errors by invocation status` chart shows the number of errors that occurred. This graph is chart down into the following categories:
250250

251-
{/* <!-- TODO: include example --> */}
251+
| Error | Meaning |
252+
| -------------------------------- | ------------------------------------------------------------------------------------------ |
253+
| `Uncaught Exception` | Your Worker code threw a JavaScript exception during execution. |
254+
| `Exceeded CPU Time Limits` | Worker exceeded CPU time limit or other resource constraints. |
255+
| `Exceeded Memory` | Worker exceeded the memory limit during execution. |
256+
| `Internal` | An internal error occurred in the Workers runtime. |
257+
258+
The `Client disconnected by type` chart shows the number of client disconnect errors that occurred. This graph is chart down into the following categories:
259+
260+
| Client Disconnects | Meaning |
261+
| -------------------------------- | ------------------------------------------------------------------------------------------ |
262+
| `Response Stream Disconnected` | Connection was terminated while streaming the response (common with WebSockets). |
263+
| `Cancelled` | The Client disconnected before the Worker completed its response. |
264+
265+
## Debug exceptions with Workers Logs
266+
267+
[Workers Logs](/workers/observability/logs/workers-logs) is a powerful tool for debugging your Workers. It allows you to see the logs generated by your Worker, including any uncaught exceptions that occur during execution.
268+
269+
To find all your errors in Workers Logs, you can use the following filter: `$metadata.error EXISTS`. This will show you all the logs that have an error associated with them. You can also filter by `$workers.outcome` to find the requests that resulted in an error. For example, you can filter by `$workers.outcome = "exception"` to find all the requests that resulted in an uncaught exception. All the possible outcome values can be found in the [Workers Trace Events](logs/reference/log-fields/account/workers_trace_events/#outcome) Reference.
270+
271+
## Debug exceptions from `Wrangler`
272+
273+
To debug your worker via wrangler use `wrangler tail` to inspect and fix the exceptions.
252274

253275
Exceptions will show up under the `exceptions` field in the JSON returned by `wrangler tail`. After you have identified the exception that is causing errors, redeploy your code with a fix, and continue tailing the logs to confirm that it is fixed.
254276

255-
## Set up a logging service
277+
## Set up a 3rd party logging service
256278

257279
A Worker can make HTTP requests to any HTTP service on the public Internet. You can use a service like [Sentry](https://sentry.io) to collect error logs from your Worker, by making an HTTP request to the service to report the error. Refer to your service’s API documentation for details on what kind of request to make.
258280

0 commit comments

Comments
 (0)