node-datadog-metrics icon indicating copy to clipboard operation
node-datadog-metrics copied to clipboard

Drop the official Datadog client

Open Mr0grog opened this issue 11 months ago • 3 comments

This is a first pass, and is a bit speculative. This PR drops the official Datadog client as a runtime dependency since it is huge (15 MB!) and imposes a lot of runtime costs and some logging confusion (e.g. #133).

The implementation here basically swaps out @datadog/datadog-api-client for cross-fetch, which is what @datadog/datadog-api-client was using, so the potential issues should be pretty minimal here.

I was hoping to fix the punycode deprecation warning, but was not able to do so because the dependencies causing the issue require newer versions of Node.js than we currently do (Node.js 12.0). We can upgrade cross-fetch (requires Node.js 14.0) or switch directly to node-fetch (requires Node.js 12.20, but cuts off the tacit-but-not-guaranteed-compatibility we have with React Native and with Browsers). Either one of these is probably OK (Node.js maintenance only extends back to v18 these days anyway, and our biggest dependee, datadog-ci, only requires Node.js 14). Something to think through before landing this.

Mr0grog avatar Jan 02 '25 22:01 Mr0grog

Thanks for this, I appreciate the thought behind this!

jonathanstiansen avatar Apr 08 '25 20:04 jonathanstiansen

@jonathanstiansen do need support for Node.js < 12?

Would you be interested in testing a pre-release version of this?

Mr0grog avatar Apr 13 '25 16:04 Mr0grog

Nope!

On Sun, Apr 13, 2025 at 10:59 AM Rob Brackett @.***> wrote:

@jonathanstiansen https://github.com/jonathanstiansen do need support for Node.js < 12?

Would you be interested in testing a pre-release version of this?

— Reply to this email directly, view it on GitHub https://github.com/dbader/node-datadog-metrics/pull/144#issuecomment-2800032645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7T2EL6DJESUAO2YU2YL32ZKJXJAVCNFSM6AAAAABUQWABPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBQGAZTENRUGU . You are receiving this because you were mentioned.Message ID: @.***> Mr0grog left a comment (dbader/node-datadog-metrics#144) https://github.com/dbader/node-datadog-metrics/pull/144#issuecomment-2800032645

@jonathanstiansen https://github.com/jonathanstiansen do need support for Node.js < 12?

Would you be interested in testing a pre-release version of this?

— Reply to this email directly, view it on GitHub https://github.com/dbader/node-datadog-metrics/pull/144#issuecomment-2800032645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7T2EL6DJESUAO2YU2YL32ZKJXJAVCNFSM6AAAAABUQWABPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBQGAZTENRUGU . You are receiving this because you were mentioned.Message ID: @.***>

jonathanstiansen avatar Apr 13 '25 19:04 jonathanstiansen

@dbader : can we merge this please?

kroney avatar Jul 31 '25 14:07 kroney

@kroney thanks for the ping here! I think I should have some time to return to this in the next week or so.

re: the original notes here, I think I will probably update the minimum required version of Node.js (since datadog-ci has also upgraded) so this can also resolve some the other warnings. That will make this a 0.13.0 release.

Mr0grog avatar Aug 02 '25 03:08 Mr0grog

@Mr0grog any updates?

kroney avatar Aug 27 '25 08:08 kroney

@kroney this is definitely still on my radar as a high priority, but I just haven’t had the time I thought I would.

Is this especially important for you? I could push out an alpha release this weekend with what’s here so far and none of the other cleanup.

Also, what’s the oldest Node.js release you are currently using this package with? Thinking about how far to move the minimum with this update.

Mr0grog avatar Aug 27 '25 23:08 Mr0grog

We have some issues with this package and memory in AWS lambda, that's why it would be nice to see if it works. We're running at least node 20 everywhere

kroney avatar Aug 28 '25 05:08 kroney

OK, this should be good to go as far as a pre-release (v0.13.0-pre.1), which I will publish shortly. It will be version 0.13.0-pre.1 on the next channel, so you can get it by depending on either of those in your package.json.

Things I want to make sure I cover before a final v0.13.0:

  • Make sure proxy support works.
  • Consider code organization between the DatadogReporter and Http classes.
  • Consider moving to newer Node.js than 14. (Current datadog-ci versions require v18+, v20 is the oldest maintained release.) I try to keep it conservative here, but we are currently still in ultra-conservative territory.
  • Consider switching to ESM. We probably want to require at least Node v16 for that, though.

Mr0grog avatar Sep 01 '25 04:09 Mr0grog

@kroney (and anyone else here interested), this is now available on NPM and you can install it by setting the datadog-metrics version in your package.json to either:

  • 0.13.0-pre.1
  • next

Please post issues if you run into problems! And sorry this has been so slow coming.

Mr0grog avatar Sep 01 '25 05:09 Mr0grog