-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCreateDashboard_3066042014.rb
More file actions
66 lines (64 loc) · 2.8 KB
/
CreateDashboard_3066042014.rb
File metadata and controls
66 lines (64 loc) · 2.8 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
61
62
63
64
65
66
# Create a new timeseries widget with new live span time format
require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Dashboard with new live span time",
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::WidgetNewLiveSpan.new({
type: DatadogAPIClient::V1::WidgetNewLiveSpanType::LIVE,
unit: DatadogAPIClient::V1::WidgetLiveSpanUnit::MINUTE,
value: 8,
hide_incomplete_cost_data: true,
}),
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",
}),
}),
],
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)