xref: /aosp_15_r20/external/cronet/net/network_error_logging/README.md (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Network Error Logging (NEL)
2
3Network Error Logging (NEL) provides out-of-band reporting of network errors
4via the Reporting API (see `//net/reporting`). Site operators can specify a
5NEL policy that defines the Reporting endpoint(s) on which they wish to receive
6reports about client-side errors encountered while connecting to the site. The
7draft spec can be found [here](https://w3c.github.io/network-error-logging/).
8
9This directory contains the core implementation of NEL.
10
11## Implementation overview
12
13Most of the action takes place in
14[`NetworkErrorLoggingService`](https://source.chromium.org/chromium/chromium/src/+/main:net/network_error_logging/network_error_logging_service.h;l=42;drc=a9e9d6cbb3e5920f9207118cf9501ff0745bb536),
15which handles receiving/processing `NEL:` response headers and
16generating/queueing reports about network requests. The
17`NetworkErrorLoggingService` is owned by the `URLRequestContext`.
18
19Information about network requests comes directly from
20[`HttpNetworkTransaction`](https://source.chromium.org/chromium/chromium/src/+/main:net/http/http_network_transaction.cc;l=1364;drc=a9e9d6cbb3e5920f9207118cf9501ff0745bb536),
21which informs `NetworkErrorLoggingService` of the details of the request such
22as the remote IP address and outcome (a `net::Error` code).
23
24The `NetworkErrorLoggingService` finds a NEL policy applicable to the request
25(previously set by a `NEL` header), and if one exists, potentially queues a
26NEL report to be uploaded out-of-band to the policy's specified Reporting
27endpoint via the
28[`ReportingService`](https://source.chromium.org/chromium/chromium/src/+/main:net/reporting/reporting_service.h;l=56;drc=c3305c04ac6800d488bfc8b2f3249fd13186984a).
29
30Received NEL policies are persisted to disk by a `PersistentNelStore`, whose
31main implementation is the
32[`SqlitePersistentReportingAndNelStore`](https://source.chromium.org/chromium/chromium/src/+/main:net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.h;l=30;drc=456596a0b27623349d38e49d0e9812b24d47d5d8).
33