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

Post metrics to datadog after rotation #276

Merged
merged 3 commits into from
Oct 28, 2020
Merged

Post metrics to datadog after rotation #276

merged 3 commits into from
Oct 28, 2020

Conversation

enicholson125
Copy link
Contributor

@enicholson125 enicholson125 commented Oct 28, 2020

This adds code to post metrics to datadog after rotation.

It also logs errors from posting metrics in non-rotation mode. I'm on the fence about whether this is a good idea, as the current behaviour will call datadog even when the user hasn't set a metric name or authenticated, so this could make some people's implementations noisier. It still seems better to let them know what's going wrong, though.

@enicholson125
Copy link
Contributor Author

This has been tested by checking that isDatadogSet returns the correct values depending on whether the datadog struct is set in the config and by checking that a key rotation with the datadog struct set results in the values being posted to datadog after the key rotation has completed.

@enicholson125 enicholson125 requested a review from eversC October 28, 2020 11:31
Copy link
Collaborator

@eversC eversC left a comment

Choose a reason for hiding this comment

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

Not necessarily requesting a change here, but just a question. The postMetric() func checks if Datadog is set using len(apiKey), could we use the same thing (and perhaps use it as well in the postMetric func)?

@enicholson125
Copy link
Contributor Author

Great point, I dunno how I managed to miss that! I've moved the API key length check into the datadog presence check and added a check in the non-rotate case.

Copy link
Collaborator

@eversC eversC left a comment

Choose a reason for hiding this comment

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

lgtm 🥑

@eversC eversC merged commit 637d1b4 into master Oct 28, 2020
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