dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Fix unhandled rejections in kafka instrumentation

Open Gilbert142 opened this issue 1 year ago • 1 comments

What does this PR do?

Fixes #4039 by adding a no-op rejection handler.

Motivation

Right now, we have to choose between disabling kafka instrumentation and suffering unhandled rejection events on our producer. Both aren't ideal, and this seems like a no-risk solution to me. Adding a no-op rejection handler here doesn't prevent the promise's rejection from being handled downstream.

Additional Notes

I've tested using kafka instrumentation with this edit locally, but can't find any existing tests that cover this file.

Security

Datadog employees:

  • [ ] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • [ ] This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

Gilbert142 avatar Feb 22 '24 13:02 Gilbert142

Hello, I've cherry-picked your commit and opened #4112 to get CI to run.

I've also added a test, which isn't reproducing the issue when I run it, although I'm reproducing the expected non-retryable upstream error. Could you take a look and see if it's close to what you're doing to reproduce the issue?

jbertran avatar Feb 27 '24 12:02 jbertran