Skip to content

Commit

Permalink
Handle null in query metrics unit (#870)
Browse files Browse the repository at this point in the history
* Add cassettes

* Update cassettes

* Regenerate client from commit 3efd10d of spec repo

Co-authored-by: Thomas Hervé <thomas.herve@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
3 people authored Jun 17, 2021
1 parent cece899 commit c7823fb
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev8",
"regenerated": "2021-06-17 09:51:20.812519",
"spec_repo_commit": "4951cff"
"regenerated": "2021-06-17 12:47:01.781018",
"spec_repo_commit": "3efd10d"
},
"v2": {
"apigentools_version": "1.4.1.dev8",
"regenerated": "2021-06-17 09:52:08.479532",
"spec_repo_commit": "4951cff"
"regenerated": "2021-06-17 12:47:51.691967",
"spec_repo_commit": "3efd10d"
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15606,6 +15606,7 @@ components:
short_name: min
family: time
scale_factor: 60.0
nullable: true
properties:
family:
description: Unit family, allows for conversion between units of the same
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-06-17T12:31:26.650464Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[{
"id" : "23a27b0f-f695-40eb-99b8-13301fcf74b4",
"httpRequest" : {
"method" : "GET",
"path" : "/api/v1/query",
"queryStringParameters" : {
"from" : [ "1623846686" ],
"to" : [ "1623933086" ],
"query" : [ "system.cpu.idle{*}" ]
},
"headers" : {
"Accept" : [ "application/json" ],
"JAVA-TEST-NAME" : [ "Query_timeseries_points_returns_OK_response" ],
"DD-OPERATION-ID" : [ "queryMetrics" ],
"content-length" : [ "0" ]
},
"keepAlive" : false,
"secure" : true
},
"times" : {
"remainingTimes" : 1
},
"timeToLive" : {
"unlimited" : true
},
"httpResponse" : {
"statusCode" : 200,
"reasonPhrase" : "OK",
"headers" : {
"Date" : [ "Thu, 17 Jun 2021 12:31:29 GMT" ],
"Content-Type" : [ "application/json" ],
"Connection" : [ "keep-alive" ],
"vary" : [ "Accept-Encoding" ],
"pragma" : [ "no-cache" ],
"cache-control" : [ "no-cache" ],
"x-dd-version" : [ "35.4771804" ],
"x-ratelimit-limit" : [ "1600" ],
"x-ratelimit-period" : [ "3600" ],
"x-ratelimit-reset" : [ "1711" ],
"x-ratelimit-remaining" : [ "1586" ],
"x-dd-debug" : [ "9XxH7zIwQSYjIWICsZFts8Sbg1nFT12z4aOMX9WnPiMfolYWdBLa67EXjFm3ZOXE" ],
"x-content-type-options" : [ "nosniff" ],
"strict-transport-security" : [ "max-age=15724800;" ],
"content-security-policy" : [ "frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report" ],
"x-frame-options" : [ "SAMEORIGIN" ],
"content-length" : [ "10887" ]
},
"body" : "{\"status\":\"ok\",\"resp_version\":1,\"series\":[{\"end\":1623933299000,\"attributes\":{},\"metric\":\"system.cpu.idle\",\"interval\":300,\"tag_set\":[],\"start\":1623846900000,\"length\":288,\"query_index\":0,\"aggr\":null,\"scope\":\"*\",\"pointlist\":[[1623846900000.0,94.4046950785319],[1623847200000.0,94.35738808949789],[1623847500000.0,94.17893098195394],[1623847800000.0,94.34093508402506],[1623848100000.0,94.29256163914998],[1623848400000.0,94.03804006512533],[1623848700000.0,94.27855958874594],[1623849000000.0,94.33526972316255],[1623849300000.0,94.09744590759277],[1623849600000.0,94.32324359893799],[1623849900000.0,94.40179920196533],[1623850200000.0,94.1748648707072],[1623850500000.0,94.52754140062397],[1623850800000.0,94.36830055236817],[1623851100000.0,94.2119448598226],[1623851400000.0,94.36511219024658],[1623851700000.0,94.35972500487462],[1623852000000.0,94.06399770100911],[1623852300000.0,94.29985329945882],[1623852600000.0,94.29853783925374],[1623852900000.0,94.17387667338053],[1623853200000.0,94.35710093180339],[1623853500000.0,94.35805742899576],[1623853800000.0,94.02639024734498],[1623854100000.0,94.16592568715413],[1623854400000.0,94.23056527455648],[1623854700000.0,94.24061380386352],[1623855000000.0,94.04629380544027],[1623855300000.0,94.21177349090576],[1623855600000.0,94.16407065073649],[1623855900000.0,93.9486852645874],[1623856200000.0,94.1130823135376],[1623856500000.0,94.16792790201687],[1623856800000.0,93.99095708091787],[1623857100000.0,94.25867341828827],[1623857400000.0,94.28241032918294],[1623857700000.0,94.27643909070316],[1623858000000.0,94.36977339426676],[1623858300000.0,94.3729804250218],[1623858600000.0,94.05878798166911],[1623858900000.0,94.28030249277751],[1623859200000.0,94.17109025319418],[1623859500000.0,94.05995407360513],[1623859800000.0,94.20914758771858],[1623860100000.0,94.2461280182704],[1623860400000.0,94.10998262495002],[1623860700000.0,94.29276784261067],[1623861000000.0,94.27950551350911],[1623861300000.0,94.21320861457978],[1623861600000.0,94.26144748687744],[1623861900000.0,94.40172280629476],[1623862200000.0,94.25324991861979],[1623862500000.0,94.36743039449055],[1623862800000.0,94.18058907425643],[1623863100000.0,93.99401157379151],[1623863400000.0,94.05296615600587],[1623863700000.0,94.15695520695424],[1623864000000.0,93.93648077646891],[1623864300000.0,94.26371964772542],[1623864600000.0,94.22024447758993],[1623864900000.0,94.10219878514607],[1623865200000.0,94.14777052561442],[1623865500000.0,94.33818173649335],[1623865800000.0,94.31697408040364],[1623866100000.0,94.08382157007853],[1623866400000.0,94.2492446899414],[1623866700000.0,94.30422984441121],[1623867000000.0,94.21979529148824],[1623867300000.0,94.24461205800374],[1623867600000.0,94.43322153727213],[1623867900000.0,94.15973848978679],[1623868200000.0,94.33895337422689],[1623868500000.0,94.40046736399333],[1623868800000.0,94.2389435224085],[1623869100000.0,94.32721993764241],[1623869400000.0,94.3508288828532],[1623869700000.0,94.14252742767334],[1623870000000.0,94.28366316084893],[1623870300000.0,94.31050734202067],[1623870600000.0,94.14639614105225],[1623870900000.0,94.3005459912618],[1623871200000.0,94.41598416646322],[1623871500000.0,94.18233656565349],[1623871800000.0,94.36356315612792],[1623872100000.0,94.43176766209955],[1623872400000.0,94.19166080474854],[1623872700000.0,94.36443223317464],[1623873000000.0,94.42112018585205],[1623873300000.0,94.33831025450021],[1623873600000.0,94.37364487359987],[1623873900000.0,94.42441306225831],[1623874200000.0,94.18838465253646],[1623874500000.0,94.34970545450847],[1623874800000.0,94.4449802907308],[1623875100000.0,94.2949413617452],[1623875400000.0,94.11424650828043],[1623875700000.0,94.27610595703125],[1623876000000.0,94.14398871885764],[1623876300000.0,94.09812484105429],[1623876600000.0,94.35391348520915],[1623876900000.0,94.27922543843587],[1623877200000.0,94.1145646794637],[1623877500000.0,94.32709356454703],[1623877800000.0,94.32082298278809],[1623878100000.0,94.19310417175294],[1623878400000.0,94.33750626535127],[1623878700000.0,94.34198415359394],[1623879000000.0,94.0506581433614],[1623879300000.0,94.29625204086304],[1623879600000.0,94.27802866617839],[1623879900000.0,94.16620981613262],[1623880200000.0,94.34035986582438],[1623880500000.0,94.37216737111409],[1623880800000.0,94.05245679855346],[1623881100000.0,94.23369439442952],[1623881400000.0,94.24165336608887],[1623881700000.0,94.16686095167327],[1623882000000.0,94.27219255927469],[1623882300000.0,94.3730626042684],[1623882600000.0,94.25983543395996],[1623882900000.0,94.3453071085612],[1623883200000.0,94.44994069417318],[1623883500000.0,94.38896854400635],[1623883800000.0,94.30229868570963],[1623884100000.0,94.45541966756186],[1623884400000.0,94.36187302907308],[1623884700000.0,94.27135032653808],[1623885000000.0,94.39716217501852],[1623885300000.0,94.27100122695],[1623885600000.0,94.21088296254476],[1623885900000.0,94.44903594970702],[1623886200000.0,94.39826824188232],[1623886500000.0,94.20001522064209],[1623886800000.0,94.36438892364502],[1623887100000.0,94.3752403386434],[1623887400000.0,94.24102806091308],[1623887700000.0,94.29724079767863],[1623888000000.0,94.23487069229486],[1623888300000.0,94.1487372080485],[1623888600000.0,94.35736078881101],[1623888900000.0,94.34373240152995],[1623889200000.0,94.21016432444254],[1623889500000.0,94.37867757436392],[1623889800000.0,94.33859759012859],[1623890100000.0,94.1791399637858],[1623890400000.0,94.40380252838135],[1623890700000.0,94.50061541239421],[1623891000000.0,94.25317300886115],[1623891300000.0,94.47551717122396],[1623891600000.0,94.31777587993032],[1623891900000.0,94.21529953615322],[1623892200000.0,94.38654054177773],[1623892500000.0,94.41259727606902],[1623892800000.0,94.28156335194906],[1623893100000.0,94.48686656951904],[1623893400000.0,94.339449005639],[1623893700000.0,94.22276838938396],[1623894000000.0,94.43507940928141],[1623894300000.0,94.45232626597087],[1623894600000.0,94.30455932617187],[1623894900000.0,94.48911952332362],[1623895200000.0,94.41036918640137],[1623895500000.0,94.3110847345988],[1623895800000.0,94.27284472147623],[1623896100000.0,94.32893074035644],[1623896400000.0,94.41158559163411],[1623896700000.0,94.17794792175293],[1623897000000.0,94.34521076202392],[1623897300000.0,94.38363756815592],[1623897600000.0,94.26033354441324],[1623897900000.0,94.41796394348144],[1623898200000.0,94.48645998636881],[1623898500000.0,94.34723129272462],[1623898800000.0,94.4526489384969],[1623899100000.0,94.46199638366699],[1623899400000.0,94.27360125223795],[1623899700000.0,94.4080659495104],[1623900000000.0,94.46369030634563],[1623900300000.0,94.3288056564331],[1623900600000.0,94.45803213439532],[1623900900000.0,94.29137265523275],[1623901200000.0,94.0988517634074],[1623901500000.0,94.49501426696777],[1623901800000.0,94.56866507212321],[1623902100000.0,94.52331228892008],[1623902400000.0,94.64503334836418],[1623902700000.0,94.49523577482805],[1623903000000.0,94.41092567061102],[1623903300000.0,94.45875755310058],[1623903600000.0,94.34200249989827],[1623903900000.0,94.61150515238444],[1623904200000.0,94.6309378195129],[1623904500000.0,94.41283129374186],[1623904800000.0,94.39460473378499],[1623905100000.0,94.34934783299764],[1623905400000.0,94.32610783894857],[1623905700000.0,94.55975140889485],[1623906000000.0,94.47066971439644],[1623906300000.0,94.37222422281901],[1623906600000.0,94.52117613474528],[1623906900000.0,94.47455447152157],[1623907200000.0,94.30163917541503],[1623907500000.0,94.51686365012354],[1623907800000.0,94.29386847178141],[1623908100000.0,94.36338904062907],[1623908400000.0,94.3208127501827],[1623908700000.0,94.51840098592258],[1623909000000.0,94.39603494477753],[1623909300000.0,94.23649799982707],[1623909600000.0,94.5373394473287],[1623909900000.0,94.35295319239299],[1623910200000.0,94.19280316917394],[1623910500000.0,94.36507839484503],[1623910800000.0,94.36906294041255],[1623911100000.0,94.26027191162109],[1623911400000.0,94.4638401645942],[1623911700000.0,94.50759446461996],[1623912000000.0,94.31630519866944],[1623912300000.0,94.43344365437825],[1623912600000.0,94.52085611979167],[1623912900000.0,94.35591361999512],[1623913200000.0,94.39941404978434],[1623913500000.0,94.46733722686767],[1623913800000.0,94.28032783508301],[1623914100000.0,94.2931264813741],[1623914400000.0,94.28256490071614],[1623914700000.0,94.16993530909221],[1623915000000.0,94.2654824256897],[1623915300000.0,94.33220536916848],[1623915600000.0,94.31619961629778],[1623915900000.0,94.48886497497558],[1623916200000.0,94.36434368133546],[1623916500000.0,94.18731355031332],[1623916800000.0,94.39322714487712],[1623917100000.0,94.46944444656373],[1623917400000.0,94.31644697637365],[1623917700000.0,94.3591490427653],[1623918000000.0,94.43575879414877],[1623918300000.0,94.39397987365723],[1623918600000.0,94.19277284622193],[1623918900000.0,94.22981351852417],[1623919200000.0,94.29297682444255],[1623919500000.0,94.08905066172282],[1623919800000.0,94.29232213974],[1623920100000.0,94.35612355942695],[1623920400000.0,94.1572514988432],[1623920700000.0,94.40784078636426],[1623921000000.0,94.3970731608073],[1623921300000.0,94.09434546152751],[1623921600000.0,94.35458845438367],[1623921900000.0,94.35418638656769],[1623922200000.0,94.21412586847941],[1623922500000.0,94.46934327443441],[1623922800000.0,94.43678258260091],[1623923100000.0,94.30344609578451],[1623923400000.0,94.45953206380209],[1623923700000.0,94.4266118427251],[1623924000000.0,94.18508584340414],[1623924300000.0,94.3886344576842],[1623924600000.0,94.42836934407552],[1623924900000.0,94.18459754943848],[1623925200000.0,94.35064104715983],[1623925500000.0,94.39295129140218],[1623925800000.0,94.24012000401815],[1623926100000.0,94.29117450714111],[1623926400000.0,94.36060046513876],[1623926700000.0,94.34173113505045],[1623927000000.0,94.19355119069418],[1623927300000.0,94.36439844131469],[1623927600000.0,94.30302044529243],[1623927900000.0,94.17660111745198],[1623928200000.0,94.32612105051676],[1623928500000.0,94.36346105281139],[1623928800000.0,94.19108596801757],[1623929100000.0,94.32324120839436],[1623929400000.0,94.28945358276367],[1623929700000.0,94.25032540639242],[1623930000000.0,94.36026226679483],[1623930300000.0,94.41217316945394],[1623930600000.0,94.21631778717041],[1623930900000.0,94.41641944885254],[1623931200000.0,94.43647775014242],[1623931500000.0,94.21881745656331],[1623931800000.0,94.39774803161622],[1623932100000.0,94.34899172465006],[1623932400000.0,94.16956403096516],[1623932700000.0,94.3935768254598],[1623933000000.0,94.68895298601633]],\"expression\":\"system.cpu.idle{*}\",\"unit\":[{\"family\":\"percentage\",\"scale_factor\":1.0,\"name\":\"percent\",\"short_name\":\"%\",\"plural\":\"percent\",\"id\":17},null],\"display_name\":\"system.cpu.idle\"}],\"to_date\":1623933086000,\"query\":\"system.cpu.idle{*}\",\"message\":\"\",\"res_type\":\"time_series\",\"times\":[],\"from_date\":1623846686000,\"group_by\":[],\"values\":[]}"
}
}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021-04-10T19:42:45.583946Z
2021-06-17T12:31:30.082811Z
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[{
"id" : "5d333bac-e083-4794-839c-58d11d8d5f9a",
"id" : "7ee971fc-586d-43c1-94e1-0bb1f2b52021",
"httpRequest" : {
"method" : "POST",
"path" : "/api/v1/series",
Expand All @@ -13,7 +13,7 @@
"secure" : true,
"body" : {
"type" : "JSON",
"json" : "{\"series\":[{\"metric\":\"system.load.1\",\"points\":[[1.6003486E9,1.1]],\"tags\":[\"test:TestSubmitmetricsreturnsPayloadacceptedresponse1618083765\"],\"type\":\"gauge\"}]}"
"json" : "{\"series\":[{\"metric\":\"system.load.1\",\"points\":[[1.62393309E9,1.1]],\"tags\":[\"test:TestSubmitmetricsreturnsPayloadacceptedresponse1623933090\"],\"type\":\"gauge\"}]}"
}
},
"times" : {
Expand All @@ -26,7 +26,7 @@
"statusCode" : 202,
"reasonPhrase" : "Accepted",
"headers" : {
"Date" : [ "Sat, 10 Apr 2021 19:42:46 GMT" ],
"Date" : [ "Thu, 17 Jun 2021 12:31:30 GMT" ],
"Content-Type" : [ "text/json" ],
"Content-Length" : [ "16" ],
"Connection" : [ "keep-alive" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ Feature: Metrics
When the request is sent
Then the response status is 400 Bad Request

@generated @skip
@skip-python
Scenario: Query timeseries points returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "QueryMetrics" request
And request contains "from" parameter with value {{ timestamp("now - 1d") }}
And request contains "to" parameter with value {{ timestamp("now") }}
And request contains "query" parameter with value "system.cpu.idle{*}"
When the request is sent
Then the response status is 200 OK

Expand All @@ -107,7 +110,7 @@ Feature: Metrics

Scenario: Submit metrics returns "Payload accepted" response
Given new "SubmitMetrics" request
And body with value {"series": [{"metric": "system.load.1", "type": "gauge", "points": [[1600348600, 1.1]], "tags": ["test:{{ unique_alnum }}"]}]}
And body with value {"series": [{"metric": "system.load.1", "type": "gauge", "points": [[{{ timestamp("now") }}, 1.1]], "tags": ["test:{{ unique_alnum }}"]}]}
When the request is sent
Then the response status is 202 Payload accepted

Expand Down

0 comments on commit c7823fb

Please sign in to comment.