Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/reporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const { fetch } = require('cross-fetch');
const { AuthorizationError, DatadogMetricsError, HttpError } = require('./errors');
const { logDebug, logDeprecation } = require('./logging');
const {gzip} = require("pako");

Check failure on line 5 in lib/reporters.js

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

Check failure on line 5 in lib/reporters.js

View workflow job for this annotation

GitHub Actions / lint

A space is required before '}'

Check failure on line 5 in lib/reporters.js

View workflow job for this annotation

GitHub Actions / lint

A space is required after '{'

const RETRYABLE_ERROR_CODES = new Set([
'ECONNREFUSED',
Expand Down Expand Up @@ -274,9 +275,10 @@
method: 'POST',
headers: {
'DD-API-KEY': datadogApiKeys.get(this),
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Content-Encoding': 'gzip'
},
body: JSON.stringify(options.body)
body: gzip(JSON.stringify(options.body))
};
return await this.httpApi.send(url, fetchOptions);
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
},
"dependencies": {
"cross-fetch": "^4.0.0",
"debug": "^4.1.0"
"debug": "^4.1.0",
"pako": "^2.1.0"
},
"engines": {
"node": ">=14.0.0"
Expand Down
Loading