Skip to content

Conversation

@agocs
Copy link
Contributor

@agocs agocs commented Jun 7, 2022

What does this PR do?

Fixes #74
Statically initialize the ExtensionMetricWriter and the DogStatsD client to avoid leaking threads

Motivation

Testing Guidelines

Additional Notes

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Checklist

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@agocs agocs requested a review from a team as a code owner June 7, 2022 17:12
Copy link
Contributor

@IvanTopolcic IvanTopolcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!


public static ExtensionMetricWriter GetInstance(){
if (null == emw){
emw = new ExtensionMetricWriter();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to use a singleton instance!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're being perfectly honest, I got the idea from @junkfactory in the issue they opened.

Initializing MetricWriter could naively be in a static initializer but that's just me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DDLambda causes thread leak

3 participants