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

Add ci_pipelines enum to FormulaAndFunctionEventsDataSource #1267

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.4",
"regenerated": "2023-03-02 15:38:19.580195",
"spec_repo_commit": "0ec7fe9d"
"regenerated": "2023-03-02 16:19:55.137036",
"spec_repo_commit": "e71b6cea"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-02 15:38:19.596522",
"spec_repo_commit": "0ec7fe9d"
"regenerated": "2023-03-02 16:19:55.153760",
"spec_repo_commit": "e71b6cea"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,7 @@ components:
- audit
- events
- ci_tests
- ci_pipelines
example: logs
type: string
x-enum-varnames:
Expand All @@ -2530,6 +2531,7 @@ components:
- AUDIT
- EVENTS
- CI_TESTS
- CI_PIPELINES
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 @@
2023-03-02T15:41:16.500Z

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

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

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

body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Create_a_new_timeseries_widget_with_ci_pipelines_data_source with ci_pipelines 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::CI_PIPELINES,
name: "query1",
search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({
query: "ci_level:job",
}),
indexes: [
"*",
],
compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({
aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT,
metric: "@ci.queue_time",
}),
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 @@ -620,6 +620,15 @@ Feature: Dashboards
And the response "widgets[0].definition.type" is equal to "trace_service"
And the response "widgets[0].definition.env" is equal to "none"

@team:DataDog/dashboards
Scenario: Create a new timeseries widget with ci_pipelines data source
Given new "CreateDashboard" request
And body with value {"title":"{{ unique }} with ci_pipelines 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":"ci_pipelines","name":"query1","search":{"query":"ci_level:job"},"indexes":["*"],"compute":{"aggregation":"count", "metric": "@ci.queue_time"},"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 "ci_pipelines"
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "ci_level:job"

@team:DataDog/dashboards
Scenario: Create a new timeseries widget with ci_tests data source
Given new "CreateDashboard" request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ class FormulaAndFunctionEventsDataSource
AUDIT = "audit".freeze
EVENTS = "events".freeze
CI_TESTS = "ci_tests".freeze
CI_PIPELINES = "ci_pipelines".freeze
end
end