-
Notifications
You must be signed in to change notification settings - Fork 389
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
[datadog_metric_metadata] correct consistency of type #2222
Conversation
Motivation --------- It appears that metric API has enable the distribution type on metric metadata but the result between the `PUT` and the `GET` method is not consistent: ```bash export metric_name=name_of_metric_distribution curl -X PUT "https://api.datadoghq.com/api/v1/metrics/${metric_name}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ***" \ -H "DD-APPLICATION-KEY: ***" \ -d @- << EOF {"type":"gauge"} EOF {"description":null,"short_name":null,"type":"gauge","unit":null,"per_unit":null,"statsd_interval":null,"integration":null} and then the get: $ curl -X GET "https://api.datadoghq.com/api/v1/metrics/${metric_name}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ***" \ -H "DD-APPLICATION-KEY: ***" \ {"description":null,"short_name":null,"type":"distribution","unit":null,"per_unit":null,"statsd_interval":null,"integration":null} ``` this make metric type always being marked has a diff: ``` terraform plan ~ resource "datadog_metric_metadata" "metric_name" { id = "metric_name" ~ type = "distribution" -> "gauge" # (5 unchanged attributes hidden) } ``` Scope ---- Set metric type to gauge in terraform state when type return by API is distribution Test ---- Test no diff locally ```bash make build cd terraformdir terraform plan ... No changes. Your infrastructure matches the configuration. ```
1755dbc
to
99b3209
Compare
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.
A couple of small suggestions and a request!
docs/resources/metric_metadata.md
Outdated
@@ -36,7 +36,7 @@ resource "datadog_metric_metadata" "request_time" { | |||
- `per_unit` (String) Per unit of the metric such as `second` in `bytes per second`. | |||
- `short_name` (String) A short name of the metric. | |||
- `statsd_interval` (Number) If applicable, statsd flush interval in seconds for the metric. | |||
- `type` (String) Metric type such as `gauge` or `rate`. | |||
- `type` (String) Metric type such as `count`, `gauge`, or `rate`. Updating a metric of type `distribution` is not supported. If you would like to see the `distribution` type returned, please contact Datadog support. |
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.
- `type` (String) Metric type such as `count`, `gauge`, or `rate`. Updating a metric of type `distribution` is not supported. If you would like to see the `distribution` type returned, please contact Datadog support. | |
- `type` (String) Metric type such as `count`, `gauge`, or `rate`. Updating a metric of type `distribution` is not supported. If you would like to see the `distribution` type returned, contact Datadog support. |
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.
It might be helpful to link "Datadog support" to https://docs.datadoghq.com/help/.
Also, since you mention contacting support, could you also add an entry to this doc so Support knows how to handle the request? https://datadoghq.atlassian.net/wiki/spaces/TS/pages/328404964/The+Public+Docs+say+Contact+Support
Motivation
It appears that metric API has enable the distribution type on metric metadata but the result between the
PUT
and theGET
method is not consistent:this make metric type always being marked has a diff:
Scope
Set metric type to gauge in terraform state when type return by API is distribution
Test
Test no diff locally
make build cd terraformdir terraform plan ... No changes. Your infrastructure matches the configuration.