-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
provider/datadog: Upgrade to Datadog API v2 #12098
provider/datadog: Upgrade to Datadog API v2 #12098
Conversation
See zorkian/go-datadog-api#56 for context. * Fixes bug in backoff implementation that decreased performance significantly. * Uses pointers for field types, providing support of distinguishing between if a value is set, or the default value for that type is effective.
@@ -373,9 +371,9 @@ func appendRequests(datadogGraph *datadog.Graph, terraformRequests *[]interface{ | |||
func appendEvents(datadogGraph *datadog.Graph, terraformEvents *[]interface{}) { | |||
for _, t_ := range *terraformEvents { |
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.
One of the Graph nested structs that would be nicer to use if it would be broken apart. Have raised zorkian/go-datadog-api#98 to do this.
if autoscale, ok := t["autoscale"]; ok { | ||
d.Definition.Autoscale = autoscale.(bool) | ||
if v, ok := t["autoscale"]; ok { | ||
d.Definition.Autoscale = datadog.Bool(v.(bool)) |
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.
Don't think variables that live no longer than 2 lines are worth it. Apart from that I find this easier to parse.
if palette_, ok := s["palette"]; ok { | ||
palette := palette_.(string) | ||
if v, ok := s["palette"]; ok { | ||
palette := v.(string) | ||
style.Palette = &palette |
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.
When the Graph struct has been broken up in zorkian/go-datadog-api#98 we'll have generated Setters that do this tedious and error prone work for us.
Nice one @ojongerius :) Does this get rid of the need for #12086? |
This LGTM :)
|
* provider/datadog: Pulls v2 and removes v1 of library go-datadog-api. See zorkian/go-datadog-api#56 for context. * Fixes bug in backoff implementation that decreased performance significantly. * Uses pointers for field types, providing support of distinguishing between if a value is set, or the default value for that type is effective. * provider/datadog: Convert provider to use v2 of go-datadog-api. * provider/datadog: Update vendored library. * provider/datadog: Update dashboard resource to reflect API updates.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This pulls in v2 of https://github.com/zorkian/go-datadog-api. I suspect this will allow us to fix some bugs in the provider as we can now distinguish between set and unset options. See this zorkian/go-datadog-api#56 for discussion of why and how we did this.
This PR covers switching to v2, and updating the provider to use it, as it contained breaking API changes. I've done the minimal amount of work possible, the core benefits of this work are:
Before changes,
TestAccDatadogMonitor_BasicNoTreshold
took 92.38s. Afterwards the sum of all tests took 65.189s.Before:
After:
See the README of v2 for usage of the API.
@bedwards and @nyanshak you've done the work on
resourceDatadogTimeboard
. Are you able to test this? I just ran the acceptance tests and things look ok.I do plan on refactoring the Graph struct in the library by breaking it apart. We now generate the accessors, but only for top level structs. This is a deliberate choice and I think the library would benefit from that work. If that is done I, or someone else, could simplify the dashboard resource a little.