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.2",
"regenerated": "2022-02-02 15:54:29.881972",
"spec_repo_commit": "3b52f9a"
"regenerated": "2022-02-03 09:45:15.707262",
"spec_repo_commit": "f7a8bd6"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-02-02 15:54:29.901827",
"spec_repo_commit": "3b52f9a"
"regenerated": "2022-02-03 09:45:15.730129",
"spec_repo_commit": "f7a8bd6"
}
}
}
141 changes: 141 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5692,6 +5692,141 @@ components:
- FIREFOX_LAPTOP_LARGE
- FIREFOX_TABLET
- FIREFOX_MOBILE_SMALL
MonitorFormulaAndFunctionEventAggregation:
description: Aggregation methods for event platform queries.
enum:
- count
- cardinality
- median
- pc75
- pc90
- pc95
- pc98
- pc99
- sum
- min
- max
- avg
example: avg
type: string
x-enum-varnames:
- COUNT
- CARDINALITY
- MEDIAN
- PC75
- PC90
- PC95
- PC98
- PC99
- SUM
- MIN
- MAX
- AVG
MonitorFormulaAndFunctionEventQueryDefinition:
description: A formula and functions events query.
properties:
compute:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinitionCompute'
data_source:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventsDataSource'
group_by:
description: Group by options.
items:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryGroupBy'
type: array
indexes:
description: An array of index names to query in the stream. Omit or use
`[]` to query all indexes at once.
example:
- days-3
- days-7
items:
description: A log index set up for your organization. For additional
indexes, see the [multiple indexes](https://docs.datadoghq.com/logs/indexes/#multiple-indexes)
documentation.
type: string
type: array
name:
description: Name of the query for use in formulas.
example: query_errors
type: string
search:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinitionSearch'
required:
- data_source
- compute
- name
type: object
MonitorFormulaAndFunctionEventQueryDefinitionCompute:
description: Compute options.
properties:
aggregation:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventAggregation'
interval:
description: A time interval in milliseconds.
example: 60000
format: int64
type: integer
metric:
description: Measurable attribute to compute.
example: '@duration'
type: string
required:
- aggregation
type: object
MonitorFormulaAndFunctionEventQueryDefinitionSearch:
description: Search options.
properties:
query:
description: Events search string.
example: service:query
type: string
required:
- query
type: object
MonitorFormulaAndFunctionEventQueryGroupBy:
description: List of objects used to group by.
properties:
facet:
description: Event facet.
example: status
type: string
limit:
description: Number of groups to return.
example: 10
format: int64
type: integer
sort:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryGroupBySort'
required:
- facet
type: object
MonitorFormulaAndFunctionEventQueryGroupBySort:
description: Options for sorting group by results.
properties:
aggregation:
$ref: '#/components/schemas/MonitorFormulaAndFunctionEventAggregation'
metric:
description: Metric used for sorting group by results.
type: string
order:
$ref: '#/components/schemas/QuerySortOrder'
required:
- aggregation
type: object
MonitorFormulaAndFunctionEventsDataSource:
description: Data source for event platform-based queries.
enum:
- rum
example: rum
type: string
x-enum-varnames:
- RUM
MonitorFormulaAndFunctionQueryDefinition:
description: A formula and function query.
oneOf:
- $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition'
type: object
MonitorGroupSearchResponse:
description: The response of a monitor group search.
example:
Expand Down Expand Up @@ -5976,6 +6111,12 @@ components:
format: int64
nullable: true
type: integer
variables:
description: List of requests that can be used in the monitor query. **This
feature is currently in beta.**
items:
$ref: '#/components/schemas/MonitorFormulaAndFunctionQueryDefinition'
type: array
type: object
MonitorOverallStates:
description: The different states your monitor can be in.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2022-02-02T21:04:10.597Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions examples/v1/monitors/CreateMonitor_3883669300.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Create a RUM formula and functions monitor returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::MonitorsAPI.new

body = DatadogAPIClient::V1::Monitor.new({
name: "Example-Create_a_RUM_formula_and_functions_monitor_returns_OK_response",
type: DatadogAPIClient::V1::MonitorType::RUM_ALERT,
query: 'formula("query2 / query1 * 100").last("15m") >= 0.8',
message: "some message Notify: @hipchat-channel",
tags: [
"test:examplecreatearumformulaandfunctionsmonitorreturnsokresponse",
"env:ci",
],
priority: 3,
options: DatadogAPIClient::V1::MonitorOptions.new({
thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
critical: 0.8,
}),
variables: [
DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::RUM,
name: "query2",
search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
query: "",
}),
indexes: [
"*",
],
compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
}),
group_by: [],
}),
DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::RUM,
name: "query1",
search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
query: "status:error",
}),
indexes: [
"*",
],
compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
}),
group_by: [],
}),
],
}),
})
p api_instance.create_monitor(body)
9 changes: 8 additions & 1 deletion features/v1/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Feature: Monitors
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a RUM formula and functions monitor returns "OK" response
Given new "CreateMonitor" request
And body with value {"name": "{{ unique }}","type": "rum alert","query": "formula(\"query2 / query1 * 100\").last(\"15m\") >= 0.8","message": "some message Notify: @hipchat-channel", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"],"priority": 3,"options":{"thresholds":{"critical":0.8},"variables":[{"data_source": "rum","name": "query2","search": {"query": ""},"indexes": ["*"],"compute": {"aggregation": "count"},"group_by": []}, {"data_source": "rum","name": "query1","search": {"query": "status:error"},"indexes": ["*"],"compute": {"aggregation": "count"},"group_by": []}]}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a ci-pipelines monitor returns "OK" response
Given new "CreateMonitor" request
Expand Down Expand Up @@ -78,7 +85,7 @@ Feature: Monitors
Scenario: Edit a monitor returns "Bad Request" response
Given new "UpdateMonitor" request
And request contains "monitor_id" parameter from "REPLACE.ME"
And body with value {"message": null, "name": null, "options": {"enable_logs_sample": null, "escalation_message": "none", "evaluation_delay": null, "groupby_simple_monitor": null, "include_tags": true, "locked": null, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_no_data": false, "renotify_interval": "none", "renotify_occurrences": null, "renotify_statuses": ["alert"], "require_full_window": null, "silenced": null, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical": null, "critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": "none"}, "priority": null, "query": null, "restricted_roles": [null], "tags": [null], "type": "query alert"}
And body with value {"message": null, "name": null, "options": {"enable_logs_sample": null, "escalation_message": "none", "evaluation_delay": null, "groupby_simple_monitor": null, "include_tags": true, "locked": null, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_no_data": false, "renotify_interval": "none", "renotify_occurrences": null, "renotify_statuses": ["alert"], "require_full_window": null, "silenced": null, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical": null, "critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": "none", "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "metric": null, "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "query": null, "restricted_roles": [null], "tags": [null], "type": "query alert"}
When the request is sent
Then the response status is 400 Bad Request

Expand Down
8 changes: 8 additions & 0 deletions lib/datadog_api_client/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@
require 'datadog_api_client/v1/models/metrics_query_unit'
require 'datadog_api_client/v1/models/monitor'
require 'datadog_api_client/v1/models/monitor_device_id'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_aggregation'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_compute'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_query_definition_search'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_query_group_by'
require 'datadog_api_client/v1/models/monitor_formula_and_function_event_query_group_by_sort'
require 'datadog_api_client/v1/models/monitor_formula_and_function_events_data_source'
require 'datadog_api_client/v1/models/monitor_formula_and_function_query_definition'
require 'datadog_api_client/v1/models/monitor_group_search_response'
require 'datadog_api_client/v1/models/monitor_group_search_response_counts'
require 'datadog_api_client/v1/models/monitor_group_search_result'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
=begin
#Datadog API V1 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: [email protected]
Generated by: https://openapi-generator.tech

Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.

=end

require 'date'
require 'time'

module DatadogAPIClient::V1
class MonitorFormulaAndFunctionEventAggregation
COUNT = "count".freeze
CARDINALITY = "cardinality".freeze
MEDIAN = "median".freeze
PC75 = "pc75".freeze
PC90 = "pc90".freeze
PC95 = "pc95".freeze
PC98 = "pc98".freeze
PC99 = "pc99".freeze
SUM = "sum".freeze
MIN = "min".freeze
MAX = "max".freeze
AVG = "avg".freeze

# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end

# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def build_from_hash(value)
constantValues = MonitorFormulaAndFunctionEventAggregation.constants.select { |c| MonitorFormulaAndFunctionEventAggregation::const_get(c) == value }
constantValues.empty? ? DatadogAPIClient::V1::UnparsedObject.new(value) : value
end
end
end
Loading