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

StatsdMetricsHandler: Delegate to NoOpStatsHandler when configuring invalid UDP endpoint #49

Merged
merged 5 commits into from
Sep 2, 2022

Conversation

hamvocke
Copy link
Contributor

@hamvocke hamvocke commented Sep 2, 2022

A more sophisticated attempt at solving the issue outlined in #48.

Similarly to the SignalFxMetricHandler, this PR changes the StatsdMetricHandler to wrap an internal _activeHandler property that either points to an actual BufferedStatsdMetricHandler (which is effectively the former StatsdMetricHandler) or a NoOpMetricHandler if the UDP host/port configuration suggests that we're not pointing to anything reasonable.

This allows users to deactivate the StatsdMetricHandler by passing null/0 as host and port properties, and to activate it by passing a valid UDP endpoint.

Copy link
Collaborator

@deanward81 deanward81 left a comment

Choose a reason for hiding this comment

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

Few minor tweaks, but changes lgtm, thanks for tweaking!

Copy link
Collaborator

@deanward81 deanward81 left a comment

Choose a reason for hiding this comment

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

👍 ship it!

@deanward81 deanward81 merged commit f1ee3aa into StackExchange:main Sep 2, 2022
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.

2 participants