Skip to content

Commit

Permalink
feat(native fetch): Handle Node.js fetch errors (#1252)
Browse files Browse the repository at this point in the history
* handle fetch errors based on Undici

* document error codes

---------

Co-authored-by: Denny Pradipta <[email protected]>
  • Loading branch information
syamsudotdev and dennypradipta authored Mar 15, 2024
1 parent 11a8d6a commit ab0f741
Show file tree
Hide file tree
Showing 4 changed files with 384 additions and 112 deletions.
2 changes: 1 addition & 1 deletion dev/prometheus/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
image: prom/prometheus
container_name: monika_prometheus
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
network_mode: host
4 changes: 2 additions & 2 deletions dev/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ global:
scrape_interval: 1s

scrape_configs:
- job_name: "monika"
- job_name: 'monika'

static_configs:
- targets: ["localhost:3001"]
- targets: ['localhost:3001']
45 changes: 27 additions & 18 deletions docs/src/pages/guides/probes.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,33 @@ Probe response data could be used for [Request Chaining](https://hyperjumptech.g

To make it easier to troubleshoot HTTP requests, we have mapped low-level errors returned by the HTTP library to numbers between 0 and 99. These custom errors are returned as the HTTP status code and can be used to trigger alerts in the same way as regular HTTP status codes.

| Code | Error |
| :--- | -------------------- |
| 0 | Connection not found |
| 1 | Connection reset |
| 2 | Connection refused |
| 3 | Too many redirects |
| 4 | Bad option value |
| 5 | Bad option |
| 6 | Timed out |
| 7 | Network error |
| 8 | Deprecated |
| 9 | Bad response |
| 11 | Bad request |
| 12 | Canceled |
| 13 | Not Supported |
| 14 | Invalid URL |
| 99 | Others |
| 599 | Connection aborted |
| Code | Error |
| :--- | ----------------------------------------------------------------- |
| 0 | Connection not found |
| 1 | Connection reset |
| 2 | Connection refused |
| 3 | Too many redirects |
| 4 | Bad option value |
| 5 | Bad option |
| 6 | Timed out |
| 7 | Network error |
| 8 | Deprecated |
| 9 | Bad response |
| 11 | Bad request |
| 12 | Canceled |
| 13 | Not Supported |
| 14 | Invalid URL |
| 18 | Header / response size limit exceeded |
| 19 | HTTP status code returns >= 400 |
| 20 | Invalid HTTP arguments |
| 21 | Unexpected HTTP response to handle |
| 22 | Connection closed unexpectedly |
| 23 | Unsupported HTTP functionality |
| 24 | Request / response size mismatch with Content-Length header value |
| 25 | Missing HTTP client pool |
| 26 | Expected error, exact reason is shown on runtime |
| 99 | Others |
| 599 | Connection aborted |

## Execution order

Expand Down
Loading

0 comments on commit ab0f741

Please sign in to comment.