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

timeboard resource missing support for some field names in "marker" block #50

Closed
robinbowes opened this issue Feb 19, 2018 · 4 comments
Closed

Comments

@robinbowes
Copy link

I'm attempting to create DataDog timeboards from terraform.

I'm exporting the definitions using the DataDog API and parsing the output to generate terraform config.

It seems that the markers section in the graph definition block supports some field names that are not included in terraform, eg:

            "markers": [
              {
                "max": null,
                "min": 1,
                "type": "error solid",
                "value": "y > 1.0",
                "dim": "y"
              },
              {
                "max": 1,
                "min": 0.8,
                "type": "warning solid",
                "value": "0.8 < y < 1.0",
                "dim": "y"
              },
              {
                "max": 0.8,
                "min": 0,
                "type": "ok dashed",
                "value": "0 < y < 0.8",
                "dim": "y"
              }
            ]

Is this just a case of the provider not keeping up with changes in DataDog capabilities?

@tmack8001
Copy link

I'm also seeing similar when not specifying label values in the Datadog UI which then breaks our CI/CD pipelines for terraform changes.

* module.main-timeboard.datadog_timeboard.main-dashboard: datadog_timeboard.main-dashboard: json: cannot unmarshal bool into Go struct field GraphDefinitionMarker.label of type string

here is the example marker block as defined in the Datadog API for the graph that breaks terraform builds:

"markers": [
    {
      "val": "250000000",
      "value": "y = 250000000",
      "type": "error dashed",
      "label": true
    },
    {
      "val": "200000000",
      "value": "y = 200000000",
      "type": "warning dashed",
      "label": true
    }
  ]

This "label: true" is the syntax for when a string isn't provided in the "label" field in the UI / API. I'm guessing the go http library used by this provider is expecting this to always be a string and sometimes (when no text label is provided) breaks unmarshalling with the expected struct.

@masci
Copy link
Contributor

masci commented Jul 10, 2018

@robinbowes setting dim, min and max explicitly is not actually needed, to set a range between 0.8 and 1.0 on y, all you have to do is the following

    marker {
      label = "High Latency"
      type  = "error solid"
      value = "0.8 > y > 0"
    }

@masci
Copy link
Contributor

masci commented Jul 10, 2018

@tmack8001 correct, the label is expected to be a string here https://github.com/zorkian/go-datadog-api/blob/master/dashboards.go#L44 but this is the case only when the checkmark on the UI is set AND the input type contains some text, otherwise the API returns true, meaning the label is set but it contains the marker definition value (which is whatever is in the value JSON field).

The correct behaviour IMO would be having another, boolean JSON field in the response representing whether the label checkmark was set or not and always return a string for label but this is something that needs to be addressed on the Datadog side, in the meantime I can't think about any workaround other than leaving a note on the docs.

@masci
Copy link
Contributor

masci commented Jul 12, 2018

Closing this as the first issue seems invalid and the second one was fixed adding a note to the docs (literally the only thing I can do at this moment).

@masci masci closed this as completed Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants