Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support incident_analytics enum in dashboard widget FormulaAndFunctionEventsDataSource data sources #1918

Merged
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.6",
"regenerated": "2024-07-22 20:03:25.582227",
"spec_repo_commit": "cd020fa6"
"regenerated": "2024-07-23 15:33:49.227905",
"spec_repo_commit": "015355f6"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-22 20:03:25.600268",
"spec_repo_commit": "cd020fa6"
"regenerated": "2024-07-23 15:33:49.249113",
"spec_repo_commit": "015355f6"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2867,6 +2867,7 @@ components:
- events
- ci_tests
- ci_pipelines
- incident_analytics
example: logs
type: string
x-enum-varnames:
Expand All @@ -2880,6 +2881,7 @@ components:
- EVENTS
- CI_TESTS
- CI_PIPELINES
- INCIDENT_ANALYTICS
FormulaAndFunctionMetricAggregation:
description: The aggregation methods available for metrics queries.
enum:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-07-23T14:59:59.215Z

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

61 changes: 61 additions & 0 deletions examples/v1/dashboards/CreateDashboard_985012506.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Create a new timeseries widget with incident_analytics data source

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

body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Dashboard with incident_analytics datasource",
widgets: [
DatadogAPIClient::V1::Widget.new({
definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({
title: "",
show_legend: true,
legend_layout: DatadogAPIClient::V1::TimeseriesWidgetLegendLayout::AUTO,
legend_columns: [
DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::AVG,
DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::MIN,
DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::MAX,
DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE,
DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM,
],
time: DatadogAPIClient::V1::WidgetTime.new({}),
type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES,
requests: [
DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
formulas: [
DatadogAPIClient::V1::WidgetFormula.new({
formula: "query1",
}),
],
queries: [
DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinition.new({
data_source: DatadogAPIClient::V1::FormulaAndFunctionEventsDataSource::INCIDENT_ANALYTICS,
name: "query1",
search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({
query: "test_level:test",
}),
indexes: [
"*",
],
compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({
aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT,
}),
group_by: [],
}),
],
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
style: DatadogAPIClient::V1::WidgetRequestStyle.new({
palette: "dog_classic",
line_type: DatadogAPIClient::V1::WidgetLineType::SOLID,
line_width: DatadogAPIClient::V1::WidgetLineWidth::NORMAL,
}),
display_type: DatadogAPIClient::V1::WidgetDisplayType::LINE,
}),
],
}),
}),
],
layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
reflow_type: DatadogAPIClient::V1::DashboardReflowType::AUTO,
})
p api_instance.create_dashboard(body)
9 changes: 9 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,15 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_tests"
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"

@team:DataDog/dashboards-backend
Scenario: Create a new timeseries widget with incident_analytics data source
Given new "CreateDashboard" request
And body with value {"title":"{{ unique }} with incident_analytics datasource","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"incident_analytics","name":"query1","search":{"query":"test_level:test"},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[]}],"response_format":"timeseries","style":{"palette":"dog_classic","line_type":"solid","line_width":"normal"},"display_type":"line"}]}}],"layout_type":"ordered","reflow_type":"auto"}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "incident_analytics"
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"

@generated @skip @team:DataDog/dashboards-backend
Scenario: Create a shared dashboard returns "Bad Request" response
Given new "CreatePublicDashboard" request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ class FormulaAndFunctionEventsDataSource
EVENTS = "events".freeze
CI_TESTS = "ci_tests".freeze
CI_PIPELINES = "ci_pipelines".freeze
INCIDENT_ANALYTICS = "incident_analytics".freeze
end
end
Loading