Skip to content

Commit

Permalink
[SLO-3499] Remove hardcoded slo-reporter timestamps (#2660)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Aug 29, 2024
1 parent f7ce1b5 commit 2d033ad
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 22 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.6.6",
"regenerated": "2024-08-28 20:30:25.450400",
"spec_repo_commit": "6b2f00dd"
"regenerated": "2024-08-29 20:02:09.349484",
"spec_repo_commit": "518ca9df"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-28 20:30:25.468006",
"spec_repo_commit": "6b2f00dd"
"regenerated": "2024-08-29 20:02:09.367553",
"spec_repo_commit": "518ca9df"
}
}
}
5 changes: 3 additions & 2 deletions examples/v2/service-level-objectives/CreateSLOReportJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"os"
"time"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
Expand All @@ -16,8 +17,8 @@ func main() {
body := datadogV2.SloReportCreateRequest{
Data: datadogV2.SloReportCreateRequestData{
Attributes: datadogV2.SloReportCreateRequestAttributes{
FromTs: 1690901870,
ToTs: 1706803070,
FromTs: time.Now().AddDate(0, 0, -40).Unix(),
ToTs: time.Now().Unix(),
Query: `slo_type:metric "SLO Reporting Test"`,
Interval: datadogV2.SLOREPORTINTERVAL_MONTHLY.Ptr(),
Timezone: datadog.PtrString("America/New_York"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:43.575Z
2024-08-29T19:53:50.818Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from_ts":1690901870,"interval":"bad-interval","query":"slo_type:metric \"SLO Reporting Test\"","to_ts":1706803070}}}
{"data":{"attributes":{"from_ts":1721505230,"interval":"bad-interval","query":"slo_type:metric \"SLO Reporting Test\"","to_ts":1724961230}}}
form: {}
headers:
Accept:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:43.729Z
2024-08-29T19:53:50.962Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from_ts":1690901870,"interval":"monthly","query":"slo_type:metric \"SLO Reporting Test\"","timezone":"America/New_York","to_ts":1706803070}}}
{"data":{"attributes":{"from_ts":1721505230,"interval":"monthly","query":"slo_type:metric \"SLO Reporting Test\"","timezone":"America/New_York","to_ts":1724961230}}}
form: {}
headers:
Accept:
Expand All @@ -12,7 +12,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/slo/report
response:
body: '{"data":{"id":"98c67bea-fdbf-11ee-8a01-bfd37432018b","type":"report_id"}}'
body: '{"data":{"id":"69cfaa02-6640-11ef-8501-33b2b403f044","type":"report_id"}}'
code: 200
duration: 0ms
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:43.887Z
2024-08-29T19:53:51.070Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:43.972Z
2024-08-29T19:53:51.158Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:44.063Z
2024-08-29T19:53:51.260Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:44.147Z
2024-08-29T19:53:51.364Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-18T20:09:44.243Z
2024-08-29T19:53:51.486Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from_ts":1711656584,"interval":"monthly","query":"slo_type:metric \"SLO Reporting Test\"","to_ts":1713470984}}}
{"data":{"attributes":{"from_ts":1723146831,"interval":"monthly","query":"slo_type:metric \"SLO Reporting Test\"","to_ts":1724961231}}}
form: {}
headers:
Accept:
Expand All @@ -12,7 +12,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/slo/report
response:
body: '{"data":{"id":"990d70d6-fdbf-11ee-99ae-1f9640631fbf","type":"report_id"}}'
body: '{"data":{"id":"6a25239c-6640-11ef-943f-83644ac57ee3","type":"report_id"}}'
code: 200
duration: 0ms
headers:
Expand All @@ -27,9 +27,9 @@ interactions:
- application/json
id: 1
method: GET
url: https://api.datadoghq.com/api/v2/slo/report/990d70d6-fdbf-11ee-99ae-1f9640631fbf/status
url: https://api.datadoghq.com/api/v2/slo/report/6a25239c-6640-11ef-943f-83644ac57ee3/status
response:
body: '{"data":{"id":"990d70d6-fdbf-11ee-99ae-1f9640631fbf","type":"report_id","attributes":{"status":"in_progress"}}}'
body: '{"data":{"id":"6a25239c-6640-11ef-943f-83644ac57ee3","type":"report_id","attributes":{"status":"in_progress"}}}'
code: 200
duration: 0ms
headers:
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/features/v2/service_level_objectives.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Feature: Service Level Objectives
Scenario: Create a new SLO report returns "Bad Request" response
Given operation "CreateSLOReportJob" enabled
And new "CreateSLOReportJob" request
And body with value {"data": {"attributes": {"from_ts": 1690901870, "to_ts": 1706803070, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "bad-interval"}}}
And body with value {"data": {"attributes": {"from_ts": {{ timestamp('now - 40d') }}, "to_ts": {{ timestamp('now') }}, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "bad-interval"}}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/slo-app
Scenario: Create a new SLO report returns "OK" response
Given operation "CreateSLOReportJob" enabled
And new "CreateSLOReportJob" request
And body with value {"data": {"attributes": {"from_ts": 1690901870, "to_ts": 1706803070, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "monthly", "timezone": "America/New_York"}}}
And body with value {"data": {"attributes": {"from_ts": {{ timestamp('now - 40d') }}, "to_ts": {{ timestamp('now') }}, "query": "slo_type:metric \"SLO Reporting Test\"", "interval": "monthly", "timezone": "America/New_York"}}}
When the request is sent
Then the response status is 200 OK
And the response "data.type" is equal to "report_id"
Expand Down

0 comments on commit 2d033ad

Please sign in to comment.