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

[dashboards] Formula and Function support for Toplist Widgets in Dashboard resource #951

Merged
merged 66 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
464e9d1
WIP
therve Dec 17, 2020
bf9f27b
Finish formula and function metric_query
DrkSephy Feb 1, 2021
0ec7a29
Implement most of FormulaAndFunctionProcessQuery
DrkSephy Feb 1, 2021
75f1de9
Update client
therve Feb 1, 2021
2f51a14
Ues new fields
therve Feb 1, 2021
51b1049
Fix compute building
therve Feb 1, 2021
9ab4f01
Implement a few more fields for formulas and functions event query
DrkSephy Feb 1, 2021
bde5b11
Add reading part
therve Feb 1, 2021
e386865
Persist data_source, compute, name and indexes to terraform state
DrkSephy Feb 2, 2021
4a4c4cd
Push changes for supporting search in formula and function event queries
DrkSephy Feb 2, 2021
488903b
Retrieve the query
therve Feb 2, 2021
cb83300
Test skeleton
therve Feb 2, 2021
6c88a33
Implement more queries, tests
therve Feb 2, 2021
732fd5d
WIP group_by for EventQuery
DrkSephy Feb 2, 2021
062bc74
Start working on adding formulas and event_query group_by
DrkSephy Feb 3, 2021
adf40b4
Update client
therve Feb 3, 2021
7247756
Fix formula support
therve Feb 3, 2021
aa32679
Implement limit
therve Feb 3, 2021
527f2f7
Implement group_by schema for formula and function event query
DrkSephy Feb 3, 2021
d0fdb00
Extend test suite for dashboard formula and functions
DrkSephy Feb 3, 2021
2a74110
Merge with master
DrkSephy Feb 3, 2021
25062ce
Add descriptions to all schema values for formulas and functions
DrkSephy Feb 3, 2021
ef06dd9
Sync go.mod and go.sum with master
DrkSephy Feb 4, 2021
433ca74
Fix missing comma
DrkSephy Feb 4, 2021
8d438d0
More linting
DrkSephy Feb 4, 2021
595ba3b
Fix missing comma
DrkSephy Feb 4, 2021
6fd5a00
Sync changes
DrkSephy Feb 4, 2021
923856f
Add missing functions
DrkSephy Feb 4, 2021
450c051
Update client
DrkSephy Feb 4, 2021
99233c4
Update go.mod and go.sum
DrkSephy Feb 9, 2021
9c851b6
Exclude empty searches, update client
therve Feb 10, 2021
7884f05
Add default to sort for matching SDK behavior
therve Feb 10, 2021
272a204
Merge with master
DrkSephy Feb 10, 2021
f4fec07
[screenboard] Fix outdated description (#904)
phillip-dd Feb 9, 2021
1168d6a
Add security-monitoring team to codeowners (#869)
skarimo Feb 10, 2021
4ed0e66
Stop using read handler in create/update (#905)
zippolyte Feb 10, 2021
dbdd5a7
Merge remote-tracking branch 'origin/master' into therve/test-formulas
DrkSephy Feb 10, 2021
9da0157
Merge remote-tracking branch 'origin/master' into therve/test-formulas
DrkSephy Feb 10, 2021
7dc2cf2
Address PR review comments from Nick
DrkSephy Feb 16, 2021
02e2211
Rebase with master
nmuesch Feb 17, 2021
3a06d88
Move new cassettes to test folder
nmuesch Feb 17, 2021
bde5a39
Merge remote-tracking branch 'origin/master' into therve/test-formulas
DrkSephy Feb 19, 2021
5c22cd7
Code cleanup and doc generation
DrkSephy Feb 19, 2021
c866f17
Revert doc changes for other resources
DrkSephy Feb 19, 2021
5fffe08
Revert last doc change
DrkSephy Feb 19, 2021
5d5ca86
Merge with master
DrkSephy Feb 24, 2021
3808d8d
Replace timeseries formula and function methods with new generic names
DrkSephy Feb 24, 2021
37b270a
Merge with master, remove references to TimeSeries specific formula a…
DrkSephy Feb 24, 2021
6b56dd9
Merge with master, remove references to TimeSeries specific formula a…
DrkSephy Feb 24, 2021
8ad69da
Modify test names for dashboard formulas and functions, regenerate ca…
DrkSephy Feb 24, 2021
da0a456
Remove tests with old names
DrkSephy Feb 24, 2021
44e6fcc
Regenerate dashboard doc
DrkSephy Feb 24, 2021
690b8c7
Implement ability to create toplists with formulas and functions
DrkSephy Feb 25, 2021
1e7bce4
Implement tests for toplist formulas and functions
DrkSephy Feb 25, 2021
328fd2f
Prevent crashes when search.query is an empty string
DrkSephy Feb 25, 2021
34f9c62
Fix search.query empty strings causing perpetual diffs
DrkSephy Feb 26, 2021
a3b25c3
Implement validator for search.query
DrkSephy Feb 27, 2021
185cece
Pull out terraform search
DrkSephy Feb 27, 2021
36eeaaf
Merge with master
DrkSephy Apr 16, 2021
02813c5
Formatting
DrkSephy Apr 16, 2021
2d3c259
Remove duplicate declarations in tests
DrkSephy Apr 16, 2021
ebb89af
Remove duplicate datadogDashboardFormulaConfig
DrkSephy Apr 16, 2021
07c6e86
Update toplist test for new search.query syntax
DrkSephy Apr 16, 2021
57951c2
Update toplist test for new search.query syntax
DrkSephy Apr 16, 2021
b6546d2
Record new cassettes for formulas and functions toplist
DrkSephy Apr 16, 2021
0163c6d
Record new cassettes for classic toplist
DrkSephy Apr 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
619 changes: 619 additions & 0 deletions datadog/resource_datadog_dashboard.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-02-24T11:27:37.338898-05:00
310 changes: 310 additions & 0 deletions datadog/tests/cassettes/TestAccDatadogDashboardFormula.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-02-24T11:27:37.338907-05:00
354 changes: 354 additions & 0 deletions datadog/tests/cassettes/TestAccDatadogDashboardFormula_import.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-02-24T19:56:31.872142-05:00
256 changes: 256 additions & 0 deletions datadog/tests/cassettes/TestAccDatadogDashboardTopListFormula.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
---
version: 1
interactions:
- request:
body: |
{"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopListFormula-local-1614214591","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}],"response_format":"scalar"}],"type":"toplist"}},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","indexes":["*"],"name":"query1"}],"response_format":"scalar"}],"type":"toplist"}}]}
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
Dd-Operation-Id:
- CreateDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard
method: POST
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"b3n-6ak-egd","title":"tf-TestAccDatadogDashboardTopListFormula-local-1614214591","url":"/dashboard/b3n-6ak-egd/tf-testaccdatadogdashboardtoplistformula-local-1614214591","created_at":"2021-02-25T00:56:32.687462+00:00","modified_at":"2021-02-25T00:56:32.687462+00:00","author_handle":"[email protected]","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":8387004671614955},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":1616813061154054}],"layout_type":"ordered"}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:35 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- SY1h8ScsWq+kYmtbh63ltMLFAZsQjqfrgvdfAoRX+9TzT1sgMBRYaFRwfWWRRe9a
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/b3n-6ak-egd
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"b3n-6ak-egd","title":"tf-TestAccDatadogDashboardTopListFormula-local-1614214591","url":"/dashboard/b3n-6ak-egd/tf-testaccdatadogdashboardtoplistformula-local-1614214591","created_at":"2021-02-25T00:56:32.687462+00:00","modified_at":"2021-02-25T00:56:32.687462+00:00","author_handle":"[email protected]","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":8387004671614955},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":1616813061154054}],"layout_type":"ordered"}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- l4HFlaRP3QwYSqoGKhzbYfv7zgkK63HIRR7YkyVYZspq0lGjjTBwoK8V/alf+XYt
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/b3n-6ak-egd
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"b3n-6ak-egd","title":"tf-TestAccDatadogDashboardTopListFormula-local-1614214591","url":"/dashboard/b3n-6ak-egd/tf-testaccdatadogdashboardtoplistformula-local-1614214591","created_at":"2021-02-25T00:56:32.687462+00:00","modified_at":"2021-02-25T00:56:32.687462+00:00","author_handle":"[email protected]","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":8387004671614955},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":1616813061154054}],"layout_type":"ordered"}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/b3n-6ak-egd
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"b3n-6ak-egd","title":"tf-TestAccDatadogDashboardTopListFormula-local-1614214591","url":"/dashboard/b3n-6ak-egd/tf-testaccdatadogdashboardtoplistformula-local-1614214591","created_at":"2021-02-25T00:56:32.687462+00:00","modified_at":"2021-02-25T00:56:32.687462+00:00","author_handle":"[email protected]","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1 + query2","limit":{"count":10,"order":"asc"}}],"response_format":"scalar","queries":[{"aggregator":"sum","data_source":"metrics","name":"query1","query":"avg:system.cpu.system{*} by {datacenter}"},{"aggregator":"sum","data_source":"metrics","name":"query2","query":"avg:system.load.1{*} by {datacenter}"}]}],"type":"toplist"},"id":8387004671614955},{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":25,"order":"desc"}}],"response_format":"scalar","queries":[{"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"]}]}],"type":"toplist"},"id":1616813061154054}],"layout_type":"ordered"}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- dCmL/3rURV6BPeaqeP3Rxigq41m5CAb17XjrRE42uZ01zpr07HVhbL5/3TWMkvgu
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Dd-Operation-Id:
- DeleteDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/b3n-6ak-egd
method: DELETE
response:
body: '{"deleted_dashboard_id":"b3n-6ak-egd"}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- gYZcaADwbKcv7Hm19HJx6WsLoKuOijDWAt2viPeCfWqUgyKY+9e1xZdmMJeXV3YV
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Accept:
- application/json
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 1.16.0; terraform-cli 0.12.7-sdk) datadog-api-client-go/1.0.0-beta.16+dev (go go1.15.6; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/b3n-6ak-egd
method: GET
response:
body: '{"errors": ["Dashboard with ID b3n-6ak-egd not found"]}'
headers:
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Security-Policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
Content-Type:
- application/json
Date:
- Thu, 25 Feb 2021 00:56:36 GMT
Pragma:
- no-cache
Strict-Transport-Security:
- max-age=15724800;
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Version:
- "35.3978196"
X-Frame-Options:
- SAMEORIGIN
status: 404 Not Found
code: 404
duration: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-02-24T19:56:31.872182-05:00
Loading