Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 413 from Datadog when sending metrics #491

Closed
aaleksandrov opened this issue Feb 27, 2024 · 3 comments
Closed

Getting 413 from Datadog when sending metrics #491

aaleksandrov opened this issue Feb 27, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@aaleksandrov
Copy link

aaleksandrov commented Feb 27, 2024

Expected Behavior

We send metrics from lambda to Datadog using sendDistributionMetricWithDate (it could be 10k metrics within one invocation). We expect to see metrics on Datadog

Actual Behavior

We receive 413
message | datadog:failed attempt to send metrics to Datadog. HTTP error code: 413

I see a similar issue was raised for the python library and it was fixed by implementing compression. is it possible to do the same?

Steps to Reproduce the Problem

Send too many metrics

Specifications

  • We are not using layer, we use this library directly, version 7.104.0
  • Node version: latest node20 supported by lambda

Stacktrace

......:/aws/lambda/anomaly-detection-prod
2024/02/27/[$LATEST]3bcabca478e6484eba931ad8693a0dfb
2024-02-27T14:13:49.022Z	5bfee822-85f3-4b9c-a480-ca79831b8afe	ERROR	[dd.trace_id=763581508228917774 dd.span_id=4987919669838945685] {"status":"error","message":"Failed to send metrics to Datadog","name":"Error","stack":"Error: Failed to send metrics to Datadog\n    at Processor.<anonymous> (/var/task/node_modules/datadog-lambda-js/src/metrics/processor.ts:96:13)\n    at step (/var/task/node_modules/datadog-lambda-js/dist/metrics/processor.js:33:23)\n    at Object.throw (/var/task/node_modules/datadog-lambda-js/dist/metrics/processor.js:14:53)\n    at rejected (/var/task/node_modules/datadog-lambda-js/dist/metrics/processor.js:6:65)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)"}
.js:6:65)    at processTicksAndRejections (node:internal/process/task_queues:95:5)
error

@aaleksandrov aaleksandrov changed the title Getting 413 from Datadog whensending metrics Getting 413 from Datadog when sending metrics Feb 27, 2024
@astuyve
Copy link
Contributor

astuyve commented Feb 27, 2024

Hey @aaleksandrov, thanks for this note. We can definitely enable compression, metrics should compress well.

For anyone who may find this ticket and want to work on it, I believe we'd simply need to gzip the payload and set the Content-Encoding: deflate header, as per this pr.

Thanks!

@astuyve astuyve added the enhancement New feature or request label Feb 27, 2024
nagydaoudt added a commit to nagydaoudt/datadog-lambda-js that referenced this issue Feb 29, 2024
@aaleksandrov
Copy link
Author

@astuyve Could you check the related PR please? #492

astuyve pushed a commit that referenced this issue Feb 29, 2024
* #491: adding compression to metrics API

* Compressing by default

* removing DD_COMPRESS_METRIC_PAYLOAD env var

* removing compression boolean from configuration

* linting
@astuyve
Copy link
Contributor

astuyve commented Mar 8, 2024

This is out in v8.107.0.

Thanks again for the contribution!

@astuyve astuyve closed this as completed Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants