Skip to content

Commit 513f7da

Browse files
committed
feat(config): compress speedscope service request
1 parent ab37262 commit 513f7da

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

config/MWCProfiling.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,22 @@ private function doLogToSpeedscopeService(
119119
$data['memory_peak_allocated_bytes'] = memory_get_peak_usage( true );
120120

121121
$client = new Client();
122+
$body = json_encode( [
123+
'id' => $id,
124+
'wiki' => $wgDBname ?? 'unknown',
125+
'url' => $requestUri,
126+
'cfRay' => $requestContext->getRequest()->getHeader( 'Cf-Ray' ) ?: 'unknown',
127+
'forced' => $forced,
128+
'speedscopeData' => json_encode( $data ),
129+
'parserReport' => $parserReport ? json_encode( $parserReport ) : null,
130+
'environment' => $environment,
131+
] );
122132
$options = [
123-
RequestOptions::JSON => [
124-
'id' => $id,
125-
'wiki' => $wgDBname ?? 'unknown',
126-
'url' => $requestUri,
127-
'cfRay' => $requestContext->getRequest()->getHeader( 'Cf-Ray' ) ?: 'unknown',
128-
'forced' => $forced,
129-
'speedscopeData' => json_encode( $data ),
130-
'parserReport' => $parserReport ? json_encode( $parserReport ) : null,
131-
'environment' => $environment,
132-
],
133+
RequestOptions::BODY => gzencode( $body ),
133134
RequestOptions::HEADERS => [
134135
'Authorization' => 'Bearer ' . $token,
136+
'Content-Encoding' => 'gzip',
137+
'Content-Type' => 'application/json',
135138
],
136139
];
137140
try {

0 commit comments

Comments
 (0)