Skip to content

Commit c066afa

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Fix Query metrics tests (#49)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 48514ee commit c066afa

8 files changed

+19
-19
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-03-22 19:28:41.088189",
8-
"spec_repo_commit": "b8f385dc"
7+
"regenerated": "2024-03-25 19:47:36.411155",
8+
"spec_repo_commit": "f9b6a1cc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-03-22 19:28:41.109696",
13-
"spec_repo_commit": "b8f385dc"
12+
"regenerated": "2024-03-25 19:47:36.455068",
13+
"spec_repo_commit": "f9b6a1cc"
1414
}
1515
}
1616
}

examples/v2_metrics_query_scalar_data_3112571352.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use datadog_api_client::datadogV2::model::ScalarQuery;
1717
async fn main() {
1818
let body = ScalarFormulaQueryRequest::new(ScalarFormulaRequest::new(
1919
ScalarFormulaRequestAttributes::new(
20-
1671612804000,
20+
1636625471000,
2121
vec![ScalarQuery::MetricsScalarQuery(Box::new(
2222
MetricsScalarQuery::new(
2323
MetricsAggregator::AVG,
@@ -26,7 +26,7 @@ async fn main() {
2626
)
2727
.name("a".to_string()),
2828
))],
29-
1671620004000,
29+
1636629071000,
3030
)
3131
.formulas(vec![QueryFormula::new("a".to_string())
3232
.limit(FormulaLimit::new().count(10).order(QuerySortOrder::DESC))]),

examples/v2_metrics_query_timeseries_data_301142940.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ use datadog_api_client::datadogV2::model::TimeseriesQuery;
1616
async fn main() {
1717
let body = TimeseriesFormulaQueryRequest::new(TimeseriesFormulaRequest::new(
1818
TimeseriesFormulaRequestAttributes::new(
19-
1671612804000,
19+
1636625471000,
2020
vec![TimeseriesQuery::MetricsTimeseriesQuery(Box::new(
2121
MetricsTimeseriesQuery::new(
2222
MetricsDataSource::METRICS,
2323
"avg:system.cpu.user{*}".to_string(),
2424
)
2525
.name("a".to_string()),
2626
))],
27-
1671620004000,
27+
1636629071000,
2828
)
2929
.formulas(vec![QueryFormula::new("a".to_string())
3030
.limit(FormulaLimit::new().count(10).order(QuerySortOrder::DESC))])
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-12-21T11:14:01.142Z
1+
2024-03-25T19:28:00.854Z

tests/scenarios/cassettes/v2/metrics/Scalar-cross-product-query-returns-OK-response.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"request": {
55
"body": {
6-
"string": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1671612804000,\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"a\",\"query\":\"avg:system.cpu.user{*}\"}],\"to\":1671620004000},\"type\":\"scalar_request\"}}",
6+
"string": "{\"data\":{\"attributes\":{\"formulas\":[{\"formula\":\"a\",\"limit\":{\"count\":10,\"order\":\"desc\"}}],\"from\":1711391280000,\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"a\",\"query\":\"avg:system.cpu.user{*}\"}],\"to\":1711394880000},\"type\":\"scalar_request\"}}",
77
"encoding": null
88
},
99
"headers": {
@@ -19,7 +19,7 @@
1919
},
2020
"response": {
2121
"body": {
22-
"string": "{\"data\":{\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[5.173633659114822],\"type\":\"number\",\"meta\":{\"unit\":[{\"scale_factor\":1.0,\"id\":17,\"name\":\"percent\",\"plural\":\"percent\",\"family\":\"percentage\",\"short_name\":\"%\"},null]}}]}}}",
22+
"string": "{\"data\":{\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"values\":[6.368151928283307],\"name\":\"a\",\"meta\":{\"unit\":[{\"short_name\":\"%\",\"id\":17,\"plural\":\"percent\",\"name\":\"percent\",\"family\":\"percentage\",\"scale_factor\":1.0},null]},\"type\":\"number\"}]}}}",
2323
"encoding": null
2424
},
2525
"headers": {
@@ -32,7 +32,7 @@
3232
"message": "OK"
3333
}
3434
},
35-
"recorded_at": "Wed, 21 Dec 2022 11:14:01 GMT"
35+
"recorded_at": "Mon, 25 Mar 2024 19:28:00 GMT"
3636
}
3737
],
3838
"recorded_with": "VCR 6.0.0"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-12-21T11:14:01.814Z
1+
2024-03-25T19:28:01.413Z

tests/scenarios/cassettes/v2/metrics/Timeseries-cross-product-query-returns-OK-response.json

+4-4
Large diffs are not rendered by default.

tests/scenarios/features/v2/metrics.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Feature: Metrics
311311
Given a valid "appKeyAuth" key in the system
312312
And operation "QueryScalarData" enabled
313313
And new "QueryScalarData" request
314-
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": 1671612804000, "queries": [{"aggregator": "avg", "data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": 1671620004000}, "type": "scalar_request"}}
314+
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"aggregator": "avg", "data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}}
315315
When the request is sent
316316
Then the response status is 200 OK
317317
And the response "data.type" is equal to "scalar_response"
@@ -385,7 +385,7 @@ Feature: Metrics
385385
Given a valid "appKeyAuth" key in the system
386386
And operation "QueryTimeseriesData" enabled
387387
And new "QueryTimeseriesData" request
388-
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": 1671612804000, "interval": 5000, "queries": [{"data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": 1671620004000}, "type": "timeseries_request"}}
388+
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}}
389389
When the request is sent
390390
Then the response status is 200 OK
391391
And the response "data.type" is equal to "timeseries_response"

0 commit comments

Comments
 (0)