-
Notifications
You must be signed in to change notification settings - Fork 261
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
[dd-agent] add multiple enpoints/api_keys conf #317
Conversation
3be5a56
to
de05ec0
Compare
) do |node| | ||
node.set['datadog'] = { | ||
'api_key' => 'somethingnotnil', | ||
'other_dd_urls' => ['app.example.com', 'app.datadoghq.com'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick since it's not really what's tested here: it'd be better to use the full urls with the protocol, i.e. https://app.example.com
Added a few nitpicks but this is👌 Let's merge it for |
de05ec0
to
d96d7ea
Compare
Pass multiple keys to the handler.
d5f7759
to
777a72e
Compare
:api_key => node['datadog']['api_key'], | ||
:dd_url => node['datadog']['url'] | ||
:api_key => api_keys, | ||
:dd_url => dd_urls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to update the var names too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. 🎆
Added some comments, let me know when the tests are updated ;) Overall it looks way better now compared to the first draft 🚀 |
@@ -21,9 +21,11 @@ | |||
# The Datadog api key to associate your agent's data with your organization. | |||
# Can be found here: | |||
# https://app.datadoghq.com/account/settings | |||
# This can be a list of api keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just to be more explicit, I'd explain here what a list of api keys does, i.e. that it configures the Agent and the handler to send data to multiple accounts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's not clear enough. I also changed list for array, as a list could be understood as a string "apikey1, apikey2"
.
777a72e
to
c633cb7
Compare
💚 CI finally, ready for final review ! |
@@ -21,9 +21,13 @@ | |||
# The Datadog api key to associate your agent's data with your organization. | |||
# Can be found here: | |||
# https://app.datadoghq.com/account/settings | |||
# This can be an array of api keys (to configure the agent | |||
# data to send to multiple accounts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be to send data to multiple accounts
?
Added one last comment about a comment, once that's fixed let's ! |
f489e06
to
b2e395e
Compare
As we discussed, I updated this PR to use a |
b2e395e
to
d54c9a2
Compare
extra_endpoints = [] | ||
node['datadog']['extra_endpoints'].each do |_, endpoint| | ||
next unless endpoint['enabled'] | ||
endpoint.delete('enabled') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will attempt to mutate node['datadog']['extra_endpoints']
too, which chef doesn't allow from a recipe (it'll cause a compile error).
I think we should either copy the endpoint
hash first (keeping in mind that it's not a regular hash but an ImmutableMash
if I remember correctly) or "manually" assign the interesting fields of endpoint
to a new hash.
Also, unless the resulting values of extra_endpoints
var are Mashes I think their keys need to be string literals (:url
instead of 'url'
) since that's how we access the values in the handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can disregard my comment on the Mash
thing, it's not a problem since in the handler we copy the config to a Mash
since v0.5.0 (see DataDog/chef-handler-datadog#50)
Thanks, the logic looks even nicer now :) Had 2 comments on the PR. Since the |
For backward compatibility purpose, we keep url, api_key & application_key, and add a extra_endpoints attributes to handle the other endpoints.
d54c9a2
to
02e5766
Compare
Or at least a beginning of tests, with multiple endpoints
02e5766
to
bbe7268
Compare
Comments addressed, and a few tests added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the adding these tests! 💚
No description provided.