-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for formula and function in monitors (#719)
* Regenerate client from commit f7a8bd6 of spec repo * pre-commit fixes Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
bbce811
commit 764ba66
Showing
16 changed files
with
1,782 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...eatures/v1/monitors/Create-a-RUM-formula-and-functions-monitor-returns-OK-response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022-02-02T21:04:10.597Z |
38 changes: 38 additions & 0 deletions
38
...s/features/v1/monitors/Create-a-RUM-formula-and-functions-monitor-returns-OK-response.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
lib/datadog_api_client/v1/models/monitor_formula_and_function_event_aggregation.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: support@datadoghq.com | ||
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 |
Oops, something went wrong.