Skip to content

Commit 75c9c60

Browse files
author
Jannes Timm
committed
Add L4 stats docs for Rulesets and Workers
1 parent e592ab4 commit 75c9c60

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

src/content/docs/workers/runtime-apis/request.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ All plans have access to:
227227

228228
* If Cloudflare replaces the value of the `Accept-Encoding` header, the original value is stored in the `clientAcceptEncoding` property, for example, `"gzip, deflate, br"`.
229229

230+
* `clientQuicRtt` number | undefined
231+
232+
* The smoothed round-trip time (RTT) between Cloudflare and the client for QUIC connections, in milliseconds. Only present when the client connected over QUIC (HTTP/3). For example, `42`.
233+
234+
* `clientTcpRtt` number | undefined
235+
236+
* The smoothed round-trip time (RTT) between the client and Cloudflare for TCP connections, in milliseconds. Only present when the client connected over TCP (HTTP/1 and HTTP/2). For example, `22`.
237+
230238
* `colo` string
231239

232240
* The three-letter [`IATA`](https://en.wikipedia.org/wiki/IATA_airport_code) airport code of the data center that the request hit, for example, `"DFW"`.
@@ -235,6 +243,12 @@ All plans have access to:
235243

236244
* Country of the incoming request. The two-letter country code in the request. This is the same value as that provided in the `CF-IPCountry` header, for example, `"US"`.
237245

246+
* `edgeL4` Object | undefined
247+
248+
* Layer 4 transport statistics for the connection between the client and Cloudflare. Contains the following property:
249+
* `deliveryRate` number - The most recent data delivery rate estimate for the connection, in bytes per second. For example, `123456`.
250+
251+
238252
* `isEUCountry` string | null
239253

240254
* If the country of the incoming request is in the EU, this will return `"1"`. Otherwise, this property is either omitted or `false`.
@@ -454,4 +468,4 @@ Incoming `Request` objects passed to the [`fetch()` handler](/workers/runtime-ap
454468
* [Examples: Modify request property](/workers/examples/modify-request-property/)
455469
* [Examples: Accessing the `cf` object](/workers/examples/accessing-the-cloudflare-object/)
456470
* [Reference: `Response`](/workers/runtime-apis/response/)
457-
* Write your Worker code in [ES modules syntax](/workers/reference/migrate-to-module-workers/) for an optimized experience.
471+
* Write your Worker code in [ES modules syntax](/workers/reference/migrate-to-module-workers/) for an optimized experience.

src/content/fields/index.yaml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,13 +898,47 @@ entries:
898898
example_value: |-
899899
true
900900
901+
- name: cf.edge.l4.delivery_rate
902+
data_type: Integer
903+
categories: [Request]
904+
keywords:
905+
[request, l4, delivery rate, bandwidth, network, performance, transport]
906+
summary: The most recent data delivery rate estimate for the client connection, in bytes per second.
907+
description: |-
908+
This metric reflects the rate at which data is being successfully delivered over the connection.
909+
910+
Returns `0` when L4 statistics are not available for the request.
911+
example_value: |-
912+
123456
913+
example_block: |-
914+
# Match requests where the delivery rate is below 100 KB/s
915+
cf.edge.l4.delivery_rate < 100000
916+
901917
- name: cf.timings.client_tcp_rtt_msec
902918
data_type: Number
903919
categories: [Request]
904920
keywords: [request, timing, tcp, rtt, performance, latency]
905-
summary: The smoothed TCP round-trip time (RTT) from client to Cloudflare in milliseconds.
921+
summary: The smoothed TCP round-trip time (RTT) between Cloudflare and the client in milliseconds.
922+
description: |-
923+
This field is only populated for TCP (HTTP/1, HTTP/2) connections. For QUIC connections, the value is `0`.
906924
example_value: |-
907925
20
926+
example_block: |-
927+
# Match requests over TCP where the RTT exceeds 200 ms
928+
cf.timings.client_quic_rtt_msec > 200
929+
930+
- name: cf.timings.client_quic_rtt_msec
931+
data_type: Integer
932+
categories: [Request]
933+
keywords: [request, timing, quic, rtt, performance, latency, http3]
934+
summary: The smoothed QUIC round-trip time (RTT) between Cloudflare and the client in milliseconds.
935+
description: |-
936+
This field is only populated for QUIC (HTTP/3) connections. For TCP connections, the value is `0`.
937+
example_value: |-
938+
42
939+
example_block: |-
940+
# Match requests over QUIC where the RTT exceeds 200 ms
941+
cf.timings.client_quic_rtt_msec > 200
908942
909943
- name: cf.timings.edge_msec
910944
data_type: Integer
@@ -2205,4 +2239,4 @@ entries:
22052239
22062240
You can use this field to customize the response for a specific type of error (for example, all 1XXX errors or all WAF block actions).
22072241
2208-
**Note**: This field is only available in [Response Header Transform Rules](/rules/transform/response-header-modification/) and [Custom Errors](/rules/custom-errors/).
2242+
**Note**: This field is only available in [Response Header Transform Rules](/rules/transform/response-header-modification/) and [Custom Errors](/rules/custom-errors/).

0 commit comments

Comments
 (0)