examples/v2/metrics/QueryScalarData.rb in datadog_api_client-2.6.0 vs examples/v2/metrics/QueryScalarData.rb in datadog_api_client-2.7.0
- old
+ new
@@ -1,6 +1,6 @@
-# Scalar cross product query returns "OK" response
+# Query scalar data across multiple products returns "OK" response
require "datadog_api_client"
DatadogAPIClient::V2.configure do |config|
config.unstable_operations["v2.query_scalar_data".to_sym] = true
end
@@ -9,26 +9,25 @@
body = DatadogAPIClient::V2::ScalarFormulaQueryRequest.new({
data: DatadogAPIClient::V2::ScalarFormulaRequest.new({
attributes: DatadogAPIClient::V2::ScalarFormulaRequestAttributes.new({
formulas: [
DatadogAPIClient::V2::QueryFormula.new({
- formula: "a",
+ formula: "a+b",
limit: DatadogAPIClient::V2::FormulaLimit.new({
count: 10,
order: DatadogAPIClient::V2::QuerySortOrder::DESC,
}),
}),
],
- from: 1671612804000,
+ from: 1568899800000,
queries: [
DatadogAPIClient::V2::MetricsScalarQuery.new({
aggregator: DatadogAPIClient::V2::MetricsAggregator::AVG,
data_source: DatadogAPIClient::V2::MetricsDataSource::METRICS,
- query: "avg:system.cpu.user{*}",
- name: "a",
+ query: "avg:system.cpu.user{*} by {env}",
}),
],
- to: 1671620004000,
+ to: 1568923200000,
}),
type: DatadogAPIClient::V2::ScalarFormulaRequestType::SCALAR_REQUEST,
}),
})
p api_instance.query_scalar_data(body)