-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCreateDashboard_1307120899.rb
More file actions
60 lines (58 loc) · 2.55 KB
/
CreateDashboard_1307120899.rb
File metadata and controls
60 lines (58 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Create a new timeseries widget with ci_tests data source
require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Dashboard with ci_tests 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::WidgetLegacyLiveSpan.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_TESTS,
name: "query1",
search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({
query: "test_level:test",
}),
indexes: [
"*",
],
compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({
aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT,
}),
}),
],
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
style: DatadogAPIClient::V1::TimeseriesRequestStyle.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)