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

Optional variables for apm_query cause crash or error when excluded #316

Closed
entscheidungsproblem opened this issue Sep 12, 2019 · 6 comments

Comments

@entscheidungsproblem
Copy link

Hi there,

Terraform Version

Terraform v0.12.1

  • provider.datadog v2.4.0

Affected Resource(s)

Please list the resources as a list, for example:

  • datadog_dashboard

Terraform Configuration Files

resource "datadog_dashboard" "application_overview" {
  title        = "APM Test"
  is_read_only = false
  layout_type  = "ordered"

  widget {
    group_definition {
      layout_type = "ordered"
      title       = "Duration"

      widget {
        timeseries_definition {
          title = "Duration timeseries"
          request {
            apm_query {
              index = "trace-search"
              compute = {
                aggregation = "avg"
                facet       = "@duration"
                interval    = "auto"    #a) Comment out
              }
              search = {
                query = "status:ok"
              }
              group_by {    #d) Comment out
                facet = "resource_name"    #c) Comment out
                limit = 5
                sort = {
                  facet       = "@duration"    #b) Comment out
                  aggregation = "avg"
                  order       = "desc"
                }
              }
            }
            display_type = "line"
          }
        }
      }
    }
  }
}

Debug Output

a) timeseries_definition:request:apm_query:compute:interval excluded
debug
crash
b) timeseries_definition:request:apm_query:group_by:sort:facet excluded
debug
crash
c) timeseries_definition:request:apm_query:group_by:facet excluded
debug
d) timeseries_definition:request:apm_query:group_by excluded
debug

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.
a) timeseries_definition:request:apm_query:compute:interval excluded
crash
b) timeseries_definition:request:apm_query:group_by:sort:facet excluded
crash

Expected Behavior

Create dashboard with a timeseries_definition with apm_query using the arguments as directed in the wiki, specifically working correctly when excluding optional arguments. Comments in the code above shows what lines are excluded for each case.
a) This case excludes timeseries_definition:request:apm_query:compute:interval
b) This case excludes timeseries_definition:request:apm_query:group_by:sort:facet
c) This case excludes timeseries_definition:request:apm_query:group_by:facet
d) This case excludes timeseries_definition:request:apm_query:group_by

Actual Behavior

a) Terraform crashes when timeseries_definition:request:apm_query:compute:interval is not set.
b) Terraform crashes when timeseries_definition:request:apm_query:group_by:sort:facet is not set.
c) Terraform errors when timeseries_definition:request:apm_query:group_by:facet is not set.
d) No data is shown on the Datadog dashboard when group_by is not set.
This is the json of the widget (for d)):

{
  "viz": "timeseries",
  "requests": [
    {
      "apm_query": {
        "index": "trace-search",
        "search": {
          "query": "status:ok"
        },
        "compute": {
          "facet": "@duration",
          "aggregation": "avg"
        }
      },
      "type": "line",
      "conditional_formats": [],
      "aggregator": "avg"
    }
  ],
  "autoscale": true
}

It works when changed to:

{
  "viz": "timeseries",
  "requests": [
    {
      "apm_query": {
        "index": "trace-search",
        "search": {
          "query": "status:ok"
        },
        "groupBy":[],    #This line is needed
        "compute": {
          "facet": "@duration",
          "aggregation": "avg"
        }
      },
      "type": "line",
      "conditional_formats": [],
      "aggregator": "avg"
    }
  ],
  "autoscale": true
}

Steps to Reproduce

  1. a) Remove timeseries_definition:request:apm_query:compute:interval
  2. b) Remove timeseries_definition:request:apm_query:group_by:sort:facet
  3. c) Remove timeseries_definition:request:apm_query:group_by:facet
  4. d) Remove timeseries_definition:request:apm_query:group_by
  5. terraform apply
@bkabrda
Copy link
Contributor

bkabrda commented Sep 25, 2019

Hey, thanks for the report! I fixed a) in #322 and b) and c) is waiting for review in #325. For d), we'll need some insight into the web app itself, so tagging @enbashi here to get help.

@entscheidungsproblem
Copy link
Author

Thanks for your help! Let me know if I can provide any other info.

@bkabrda
Copy link
Contributor

bkabrda commented Feb 4, 2020

Ping @enbashi could you take a look at the issue d) from the original report and see if there's something we can do about that? Thanks!

@enbashi
Copy link
Contributor

enbashi commented Feb 4, 2020

Ping @enbashi could you take a look at the issue d) from the original report and see if there's something we can do about that? Thanks!

Sure, I will take a look. Apologies for the delay, I missed the previous ping.

@jbenais
Copy link
Contributor

jbenais commented Feb 11, 2020

Apologies also for the delay, the issue d) was fixed few weeks ago. The group_by attribute should now be fully optional and can be omitted in the terraform configuration. Please let us know if you see any other issue! Thanks a lot for your patience

@bkabrda
Copy link
Contributor

bkabrda commented Feb 12, 2020

So it looks like all 4 problems from the original issue report are now fixed. I'm going to close this. @entscheidungsproblem feel free to open a new issue if you have more problems. Thanks everyone involved!

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

No branches or pull requests

4 participants