Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.5",
"regenerated": "2023-07-04 16:12:19.448693",
"spec_repo_commit": "dcb95a4a"
"regenerated": "2023-07-05 21:53:53.460695",
"spec_repo_commit": "aee1c6e4"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-07-04 16:12:19.462256",
"spec_repo_commit": "dcb95a4a"
"regenerated": "2023-07-05 21:53:53.481740",
"spec_repo_commit": "aee1c6e4"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2782,13 +2782,18 @@ components:
FormulaAndFunctionSLOQueryDefinition:
description: A formula and functions metrics query.
example:
additional_query_filters: '*'
data_source: slo
group_mode: overall
measure: good_events
name: my_slo
slo_id: '12345678910'
slo_query_type: metric
properties:
additional_query_filters:
description: Additional filters applied to the SLO query.
example: host:host_a,env:prod
type: string
data_source:
$ref: '#/components/schemas/FormulaAndFunctionSLODataSource'
group_mode:
Expand Down
3 changes: 2 additions & 1 deletion examples/v1/dashboards/CreateDashboard_3562282606.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public static void main(String[] args) {
.OVERALL)
.sloQueryType(
FormulaAndFunctionSLOQueryType
.METRIC))))
.METRIC)
.additionalQueryFilters("*"))))
.responseFormat(
FormulaAndFunctionResponseFormat.SCALAR)
.orderBy(WidgetOrderBy.CHANGE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/** A formula and functions metrics query. */
@JsonPropertyOrder({
FormulaAndFunctionSLOQueryDefinition.JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS,
FormulaAndFunctionSLOQueryDefinition.JSON_PROPERTY_DATA_SOURCE,
FormulaAndFunctionSLOQueryDefinition.JSON_PROPERTY_GROUP_MODE,
FormulaAndFunctionSLOQueryDefinition.JSON_PROPERTY_MEASURE,
Expand All @@ -30,6 +31,9 @@
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class FormulaAndFunctionSLOQueryDefinition {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS = "additional_query_filters";
private String additionalQueryFilters;

public static final String JSON_PROPERTY_DATA_SOURCE = "data_source";
private FormulaAndFunctionSLODataSource dataSource;

Expand Down Expand Up @@ -64,6 +68,28 @@ public FormulaAndFunctionSLOQueryDefinition(
this.sloId = sloId;
}

public FormulaAndFunctionSLOQueryDefinition additionalQueryFilters(
String additionalQueryFilters) {
this.additionalQueryFilters = additionalQueryFilters;
return this;
}

/**
* Additional filters applied to the SLO query.
*
* @return additionalQueryFilters
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getAdditionalQueryFilters() {
return additionalQueryFilters;
}

public void setAdditionalQueryFilters(String additionalQueryFilters) {
this.additionalQueryFilters = additionalQueryFilters;
}

public FormulaAndFunctionSLOQueryDefinition dataSource(
FormulaAndFunctionSLODataSource dataSource) {
this.dataSource = dataSource;
Expand Down Expand Up @@ -262,7 +288,10 @@ public boolean equals(Object o) {
}
FormulaAndFunctionSLOQueryDefinition formulaAndFunctionSloQueryDefinition =
(FormulaAndFunctionSLOQueryDefinition) o;
return Objects.equals(this.dataSource, formulaAndFunctionSloQueryDefinition.dataSource)
return Objects.equals(
this.additionalQueryFilters,
formulaAndFunctionSloQueryDefinition.additionalQueryFilters)
&& Objects.equals(this.dataSource, formulaAndFunctionSloQueryDefinition.dataSource)
&& Objects.equals(this.groupMode, formulaAndFunctionSloQueryDefinition.groupMode)
&& Objects.equals(this.measure, formulaAndFunctionSloQueryDefinition.measure)
&& Objects.equals(this.name, formulaAndFunctionSloQueryDefinition.name)
Expand All @@ -275,13 +304,23 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hash(
dataSource, groupMode, measure, name, sloId, sloQueryType, additionalProperties);
additionalQueryFilters,
dataSource,
groupMode,
measure,
name,
sloId,
sloQueryType,
additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FormulaAndFunctionSLOQueryDefinition {\n");
sb.append(" additionalQueryFilters: ")
.append(toIndentedString(additionalQueryFilters))
.append("\n");
sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n");
sb.append(" groupMode: ").append(toIndentedString(groupMode)).append("\n");
sb.append(" measure: ").append(toIndentedString(measure)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-05-16T22:06:53.853Z
2023-07-03T20:01:23.941Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"name\": \"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1684274813\", \"query\": {\"denominator\": \"sum:httpservice.hits{!code:3xx}.as_count()\", \"numerator\": \"sum:httpservice.hits{code:2xx}.as_count()\"}, \"thresholds\": [{\"target\": 95.0, \"timeframe\": \"7d\", \"warning\": 98.0}], \"type\": \"metric\"}"
"json": "{\"name\": \"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1688414483\", \"query\": {\"denominator\": \"sum:httpservice.hits{!code:3xx}.as_count()\", \"numerator\": \"sum:httpservice.hits{code:2xx}.as_count()\"}, \"thresholds\": [{\"target\": 95.0, \"timeframe\": \"7d\", \"warning\": 98.0}], \"type\": \"metric\"}"
},
"headers": {},
"method": "POST",
Expand All @@ -12,7 +12,7 @@
"secure": true
},
"httpResponse": {
"body": "{\"data\":[{\"id\":\"1c7cc520f98356d6b79adb1f8dbdef60\",\"name\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1684274813\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":95.0,\"target_display\":\"95.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":95,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1684274814,\"modified_at\":1684274814}],\"error\":null}\n",
"body": "{\"data\":[{\"id\":\"1973fea2b6975337b3c26626e42c34e4\",\"name\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1688414483\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":95.0,\"target_display\":\"95.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":95,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1688414484,\"modified_at\":1688414484}],\"error\":null}\n",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -27,13 +27,13 @@
"timeToLive": {
"unlimited": true
},
"id": "561c5e1d-53e3-cde4-dbbb-ed6e66af81d3"
"id": "2286beeb-66c2-edf3-66d7-b0be87dfab77"
},
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1684274813\",\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"asc\",\"queries\":[{\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"query1\",\"slo_id\":\"1c7cc520f98356d6b79adb1f8dbdef60\",\"slo_query_type\":\"metric\"}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":2,\"width\":4,\"x\":0,\"y\":0}}]}"
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1688414483\",\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"asc\",\"queries\":[{\"additional_query_filters\":\"*\",\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"query1\",\"slo_id\":\"1973fea2b6975337b3c26626e42c34e4\",\"slo_query_type\":\"metric\"}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":2,\"width\":4,\"x\":0,\"y\":0}}]}"
},
"headers": {},
"method": "POST",
Expand All @@ -42,7 +42,7 @@
"secure": true
},
"httpResponse": {
"body": "{\"id\":\"8kt-y74-2i3\",\"title\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1684274813\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/8kt-y74-2i3/test-createanewdashboardwithachangewidgetusingformulasandfunctionssloquery-16842\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"asc\",\"queries\":[{\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"query1\",\"slo_id\":\"1c7cc520f98356d6b79adb1f8dbdef60\",\"slo_query_type\":\"metric\"}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":2,\"width\":4,\"x\":0,\"y\":0},\"id\":8047848064178828}],\"notify_list\":null,\"created_at\":\"2023-05-16T22:06:54.344881+00:00\",\"modified_at\":\"2023-05-16T22:06:54.344881+00:00\",\"restricted_roles\":[]}\n",
"body": "{\"id\":\"9u7-4vb-5ag\",\"title\":\"Test-Create_a_new_dashboard_with_a_change_widget_using_formulas_and_functions_slo_query-1688414483\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/9u7-4vb-5ag/test-createanewdashboardwithachangewidgetusingformulasandfunctionssloquery-16884\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"asc\",\"queries\":[{\"additional_query_filters\":\"*\",\"data_source\":\"slo\",\"group_mode\":\"overall\",\"measure\":\"slo_status\",\"name\":\"query1\",\"slo_id\":\"1973fea2b6975337b3c26626e42c34e4\",\"slo_query_type\":\"metric\"}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":2,\"width\":4,\"x\":0,\"y\":0},\"id\":6457792410139351}],\"notify_list\":null,\"created_at\":\"2023-07-03T20:01:24.547325+00:00\",\"modified_at\":\"2023-07-03T20:01:24.547325+00:00\",\"restricted_roles\":[]}\n",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -57,18 +57,18 @@
"timeToLive": {
"unlimited": true
},
"id": "ccbdcca4-ee0e-571d-3ed5-20f17d875ff4"
"id": "45718eaa-c5be-20af-f21b-f6255b3761b0"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/dashboard/8kt-y74-2i3",
"path": "/api/v1/dashboard/9u7-4vb-5ag",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"8kt-y74-2i3\"}\n",
"body": "{\"deleted_dashboard_id\":\"9u7-4vb-5ag\"}\n",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -83,18 +83,18 @@
"timeToLive": {
"unlimited": true
},
"id": "5734ef8d-c2b0-db9c-9381-810e619f85cd"
"id": "c66c77bf-5276-3972-4d27-00bafa0c01f6"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/slo/1c7cc520f98356d6b79adb1f8dbdef60",
"path": "/api/v1/slo/1973fea2b6975337b3c26626e42c34e4",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"data\":[\"1c7cc520f98356d6b79adb1f8dbdef60\"],\"error\":null}\n",
"body": "{\"data\":[\"1973fea2b6975337b3c26626e42c34e4\"],\"error\":null}\n",
"headers": {
"Content-Type": [
"application/json"
Expand All @@ -109,6 +109,6 @@
"timeToLive": {
"unlimited": true
},
"id": "9fef3929-95a3-e903-5947-add8232beaaa"
"id": "34698370-3a23-788c-ddf1-9527a816f8b3"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Feature: Dashboards
Scenario: Create a new dashboard with a change widget using formulas and functions slo query
Given there is a valid "slo" in the system
And new "CreateDashboard" request
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": {"title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ {"formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ {"name": "query1", "data_source": "slo", "slo_id": "{{ slo.data[0].id }}", "measure": "slo_status", "group_mode": "overall", "slo_query_type": "metric" } ], "response_format": "scalar", "order_by": "change", "change_type": "absolute", "increase_good": true, "order_dir": "asc" } ] }, "layout": { "x":0, "y": 0, "width": 4, "height": 2 } } ], "layout_type": "ordered" }
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": {"title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ {"formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ {"name": "query1", "data_source": "slo", "slo_id": "{{ slo.data[0].id }}", "measure": "slo_status", "group_mode": "overall", "slo_query_type": "metric", "additional_query_filters": "*" } ], "response_format": "scalar", "order_by": "change", "change_type": "absolute", "increase_good": true, "order_dir": "asc" } ] }, "layout": { "x":0, "y": 0, "width": 4, "height": 2 } } ], "layout_type": "ordered" }
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar"
Expand All @@ -99,6 +99,7 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].queries[0].measure" is equal to "slo_status"
And the response "widgets[0].definition.requests[0].queries[0].slo_query_type" is equal to "metric"
And the response "widgets[0].definition.requests[0].queries[0].slo_id" has the same value as "slo.data[0].id"
And the response "widgets[0].definition.requests[0].queries[0].additional_query_filters" is equal to "*"
And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "hour_before(query1)"
And the response "widgets[0].definition.requests[0].formulas[1].formula" is equal to "query1"

Expand Down