Add ability to disable statsd via new disable_statsd parameter in initialize #910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #778.
Requirements for Contributing to this repository
What does this PR do?
This merge request makes it possible to disable emitting statsd metrics when calling the
initialize()function orDogstatsdconstructor instead of just theDD_DOGSTATSD_DISABLEenvironment variable.I was inspired to make this change because I am working on project that uses Pydantic Settings to manage configuration settings - not just environment variables. This is a purer way to disable statsd with that dependency, as environment variables are only one of several ways to manage configuration. I noticed a similar concern from another engineer in #778.
Description of the Change
READMEso that it accurately describes the existing behavior ofDD_DOGSTATSD_DISABLEand includes this new behavior.Alternate Designs
No alternative designs were considered.
Possible Drawbacks
No obvious ones. This is a minor additive change to existing functionality.
Verification Process
I wrote unit tests to verify the new behavior via the constructor. I did not see a great way to write unit tests over this case when invoked via
initialize().Additional Notes
N/A
Release Notes
I think the PR description and CHANGELOG updates are self-sufficient.
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.