File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
packages/workers-shared/asset-worker/src Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cloudflare/workers-shared " : minor
3+ ---
4+
5+ chore: Add status code analytics to router-worker
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ type Data = {
1818 metalId ?: number ;
1919 // double4 - Colo tier (e.g. tier 1, tier 2, tier 3)
2020 coloTier ?: number ;
21+ // double5 - Response status code
22+ status ?: number ;
2123
2224 // -- Blobs --
2325 // blob1 - Hostname of the request
@@ -66,6 +68,7 @@ export class Analytics {
6668 this . data . coloId ?? - 1 , // double2
6769 this . data . metalId ?? - 1 , // double3
6870 this . data . coloTier ?? - 1 , // double4
71+ this . data . status ?? - 1 , // double5
6972 ] ,
7073 blobs : [
7174 this . data . hostname ?. substring ( 0 , 256 ) , // blob1 - trim to 256 bytes
Original file line number Diff line number Diff line change @@ -117,13 +117,17 @@ export default class extends WorkerEntrypoint<Env> {
117117 version : this . env . VERSION_METADATA ?. id ,
118118 } ) ;
119119
120- return handleRequest (
120+ const response = await handleRequest (
121121 request ,
122122 this . env ,
123123 config ,
124124 this . unstable_exists . bind ( this ) ,
125125 this . unstable_getByETag . bind ( this )
126126 ) ;
127+
128+ analytics . setData ( { status : response . status } ) ;
129+
130+ return response ;
127131 } ) ;
128132 } catch ( err ) {
129133 return this . handleError ( sentry , analytics , err ) ;
You can’t perform that action at this time.
0 commit comments