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
39 changes: 35 additions & 4 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2962,10 +2962,7 @@ components:
data_source:
$ref: '#/components/schemas/FormulaAndFunctionEventsDataSource'
group_by:
description: Group by options.
items:
$ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBy'
type: array
$ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByConfig'
indexes:
description: An array of index names to query in the stream. Omit or use
`[]` to query all indexes at once.
Expand Down Expand Up @@ -3037,6 +3034,40 @@ components:
required:
- facet
type: object
FormulaAndFunctionEventQueryGroupByConfig:
description: Group by configuration for a formula and functions events query.
Accepts either a list of facet objects or a flat object that specifies a list
of facet fields.
oneOf:
- $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByList'
- $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByFields'
FormulaAndFunctionEventQueryGroupByFields:
description: Flat group by configuration using multiple event facet fields.
properties:
fields:
description: List of event facets to group by.
example:
- hostname
- service
items:
description: Event facet.
type: string
type: array
limit:
description: Number of groups to return.
example: 10
format: int64
type: integer
sort:
$ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBySort'
required:
- fields
type: object
FormulaAndFunctionEventQueryGroupByList:
description: List of objects used to group by.
items:
$ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBy'
type: array
FormulaAndFunctionEventQueryGroupBySort:
description: Options for sorting group by results.
properties:
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_1024858348.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::LOGS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_1307120899.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::CI_TESTS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
28 changes: 16 additions & 12 deletions examples/v1_dashboards_CreateDashboard_1617893815.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupBy;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupByConfig;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupBySort;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
Expand Down Expand Up @@ -49,19 +50,22 @@ async fn main() {
"query1".to_string(),
)
.group_by(
vec![
FormulaAndFunctionEventQueryGroupBy::new(
"service".to_string(),
)
.limit(1000)
.sort(
FormulaAndFunctionEventQueryGroupBySort
::new(
FormulaAndFunctionEventAggregation
::COUNT,
).order(QuerySortOrder::DESC),
FormulaAndFunctionEventQueryGroupByConfig
::FormulaAndFunctionEventQueryGroupByList(
vec![
FormulaAndFunctionEventQueryGroupBy::new(
"service".to_string(),
)
],
.limit(1000)
.sort(
FormulaAndFunctionEventQueryGroupBySort
::new(
FormulaAndFunctionEventAggregation
::COUNT,
).order(QuerySortOrder::DESC),
)
],
),
)
.indexes(vec!["*".to_string()])
.search(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_2064651578.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::LOGS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_2490110261.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::AUDIT,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_2800096921.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::CI_PIPELINES,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_3066042014.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::CI_PIPELINES,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_3451918078.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::CI_PIPELINES,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_3669695268.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::LOGS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(FormulaAndFunctionEventQueryDefinitionSearch::new(
"".to_string(),
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_3882428227.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::EVENTS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
87 changes: 87 additions & 0 deletions examples/v1_dashboards_CreateDashboard_4018282928.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Create a new dashboard with formulas and functions events query using flat
// group by fields
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupByConfig;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryGroupByFields;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinition;
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinitionType;
use datadog_api_client::datadogV1::model::TimeseriesWidgetRequest;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;

#[tokio::main]
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard with events flat group_by fields".to_string(),
vec![
Widget::new(
WidgetDefinition::TimeseriesWidgetDefinition(
Box::new(
TimeseriesWidgetDefinition::new(
vec![
TimeseriesWidgetRequest::new()
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionEventQueryDefinition(
Box::new(
FormulaAndFunctionEventQueryDefinition::new(
FormulaAndFunctionEventQueryDefinitionCompute::new(
FormulaAndFunctionEventAggregation::COUNT,
),
FormulaAndFunctionEventsDataSource::EVENTS,
"query1".to_string(),
)
.group_by(
FormulaAndFunctionEventQueryGroupByConfig
::FormulaAndFunctionEventQueryGroupByFields(
Box::new(
FormulaAndFunctionEventQueryGroupByFields::new(
vec![
"service".to_string(),
"host".to_string()
],
).limit(10),
),
),
)
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
"".to_string(),
),
),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
],
TimeseriesWidgetDefinitionType::TIMESERIES,
),
),
),
).layout(WidgetLayout::new(2, 4, 0, 0))
],
);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_4262729673.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::CI_PIPELINES,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_578885732.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::LOGS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
1 change: 0 additions & 1 deletion examples/v1_dashboards_CreateDashboard_607525069.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async fn main() {
FormulaAndFunctionEventsDataSource::PRODUCT_ANALYTICS,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
Expand Down
Loading