-
Notifications
You must be signed in to change notification settings - Fork 156
/
screen_widgets.go
283 lines (237 loc) · 10.2 KB
/
screen_widgets.go
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
package datadog
import "encoding/json"
type PrecisionT string
// UnmarshalJSON is a Custom Unmarshal for PrecisionT. The Datadog API can
// return 1 (int), "1" (number, but a string type) or something like "100%" or
// "*" (string).
func (p *PrecisionT) UnmarshalJSON(data []byte) error {
var err error
var precisionNum json.Number
if err = json.Unmarshal(data, &precisionNum); err == nil {
*p = PrecisionT(precisionNum)
return nil
}
var precisionStr string
if err = json.Unmarshal(data, &precisionStr); err == nil {
*p = PrecisionT(precisionStr)
return nil
}
var p0 PrecisionT
*p = p0
return err
}
type TileDef struct {
Events []TileDefEvent `json:"events,omitempty"`
Markers []TileDefMarker `json:"markers,omitempty"`
Requests []TileDefRequest `json:"requests,omitempty"`
Viz *string `json:"viz,omitempty"`
CustomUnit *string `json:"custom_unit,omitempty"`
Autoscale *bool `json:"autoscale,omitempty"`
Precision *PrecisionT `json:"precision,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
// For hostmap
NodeType *string `json:"nodeType,omitempty"`
Scope []*string `json:"scope,omitempty"`
Group []*string `json:"group,omitempty"`
NoGroupHosts *bool `json:"noGroupHosts,omitempty"`
NoMetricHosts *bool `json:"noMetricHosts,omitempty"`
Style *TileDefStyle `json:"style,omitempty"`
}
type TileDefEvent struct {
Query *string `json:"q"`
}
type TileDefMarker struct {
Label *string `json:"label,omitempty"`
Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
}
type TileDefRequest struct {
// For Hostmap
Type *string `json:"type,omitempty"`
// For Process
QueryType *string `json:"query_type,omitempty"`
Metric *string `json:"metric,omitempty"`
TextFilter *string `json:"text_filter,omitempty"`
TagFilters []*string `json:"tag_filters"`
Limit *int `json:"limit,omitempty"`
// A Widget can only have one of these types of query.
Query *string `json:"q,omitempty"`
LogQuery *TileDefApmOrLogQuery `json:"log_query,omitempty"`
ApmQuery *TileDefApmOrLogQuery `json:"apm_query,omitempty"`
ProcessQuery *TileDefProcessQuery `json:"process_query,omitempty"`
ConditionalFormats []ConditionalFormat `json:"conditional_formats,omitempty"`
Style *TileDefRequestStyle `json:"style,omitempty"`
Aggregator *string `json:"aggregator,omitempty"`
CompareTo *string `json:"compare_to,omitempty"`
ChangeType *string `json:"change_type,omitempty"`
OrderBy *string `json:"order_by,omitempty"`
OrderDir *string `json:"order_dir,omitempty"`
ExtraCol *string `json:"extra_col,omitempty"`
IncreaseGood *bool `json:"increase_good,omitempty"`
Metadata map[string]TileDefMetadata `json:"metadata,omitempty"`
}
// TileDefApmOrLogQuery represents an APM or a Log query
type TileDefApmOrLogQuery struct {
Index *string `json:"index"`
Compute *TileDefApmOrLogQueryCompute `json:"compute"`
Search *TileDefApmOrLogQuerySearch `json:"search,omitempty"`
GroupBy []TileDefApmOrLogQueryGroupBy `json:"groupBy,omitempty"`
}
type TileDefApmOrLogQueryCompute struct {
Aggregation *string `json:"aggregation"`
Facet *string `json:"facet,omitempty"`
Interval *string `json:"interval,omitempty"`
}
type TileDefApmOrLogQuerySearch struct {
Query *string `json:"query"`
}
type TileDefApmOrLogQueryGroupBy struct {
Facet *string `json:"facet"`
Limit *int `json:"limit,omitempty"`
Sort *TileDefApmOrLogQueryGroupBySort `json:"sort,omitempty"`
}
type TileDefApmOrLogQueryGroupBySort struct {
Aggregation *string `json:"aggregation"`
Order *string `json:"order"`
Facet *string `json:"facet,omitempty"`
}
type TileDefProcessQuery struct {
Metric *string `json:"metric"`
SearchBy *string `json:"search_by,omitempty"`
FilterBy []string `json:"filter_by,omitempty"`
Limit *int `json:"limit,omitempty"`
}
type TileDefMetadata struct {
Alias *string `json:"alias,omitempty"`
}
type ConditionalFormat struct {
Color *string `json:"custom_fg_color,omitempty"`
Palette *string `json:"palette,omitempty"`
Comparator *string `json:"comparator,omitempty"`
Invert *bool `json:"invert,omitempty"`
CustomBgColor *string `json:"custom_bg_color,omitempty"`
Value *string `json:"value,omitempty"`
ImageURL *string `json:"image_url,omitempty"`
}
type TileDefRequestStyle struct {
Palette *string `json:"palette,omitempty"`
Type *string `json:"type,omitempty"`
Width *string `json:"width,omitempty"`
}
type TileDefStyle struct {
Palette *string `json:"palette,omitempty"`
PaletteFlip *string `json:"paletteFlip,omitempty"`
FillMin *json.Number `json:"fillMin,omitempty"`
FillMax *json.Number `json:"fillMax,omitempty"`
}
type Time struct {
LiveSpan *string `json:"live_span,omitempty"`
}
type Widget struct {
// Common attributes
Type *string `json:"type,omitempty"`
Title *bool `json:"title,omitempty"`
TitleText *string `json:"title_text,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *int `json:"title_size,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
// For Timeseries, TopList, EventTimeline, EvenStream, AlertGraph, CheckStatus, ServiceSummary, LogStream widgets
Time *Time `json:"time,omitempty"`
// For Timeseries, QueryValue, QueryTable, HostMap, Change, Toplist, Process widgets
TileDef *TileDef `json:"tile_def,omitempty"`
// For FreeText widget
Text *string `json:"text,omitempty"`
Color *string `json:"color,omitempty"`
// For AlertValue widget
TextSize *string `json:"text_size,omitempty"`
Unit *string `json:"unit,omitempty"`
Precision *PrecisionT `json:"precision,omitempty"`
// AlertGraph widget
VizType *string `json:"viz_type,omitempty"`
// For AlertValue, QueryValue, QueryTable, FreeText, Note widgets
TextAlign *string `json:"text_align,omitempty"`
// For FreeText, Note widgets
FontSize *string `json:"font_size,omitempty"`
// For AlertValue, AlertGraph widgets
AlertID *int `json:"alert_id,omitempty"`
AutoRefresh *bool `json:"auto_refresh,omitempty"`
// For Timeseries, QueryValue, QueryTable, Toplist widgets
Legend *bool `json:"legend,omitempty"`
LegendSize *string `json:"legend_size,omitempty"`
// For EventTimeline, EventStream, Hostmap, LogStream widgets
Query *string `json:"query,omitempty"`
// For EventTimeline, EventStream
TagsExecution *string `json:"tags_execution,omitempty"`
// For Image, IFrame widgets
URL *string `json:"url,omitempty"`
// For CheckStatus widget
Tags []*string `json:"tags,omitempty"`
Check *string `json:"check,omitempty"`
Grouping *string `json:"grouping,omitempty"`
GroupBy []*string `json:"group_by,omitempty"`
Group *string `json:"group,omitempty"`
// Note widget
TickPos *string `json:"tick_pos,omitempty"`
TickEdge *string `json:"tick_edge,omitempty"`
HTML *string `json:"html,omitempty"`
Tick *bool `json:"tick,omitempty"`
Bgcolor *string `json:"bgcolor,omitempty"`
// EventStream widget
EventSize *string `json:"event_size,omitempty"`
// Image widget
Sizing *string `json:"sizing,omitempty"`
Margin *string `json:"margin,omitempty"`
// For ServiceSummary (trace_service) widget
Env *string `json:"env,omitempty"`
ServiceService *string `json:"serviceService,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
SizeVersion *string `json:"sizeVersion,omitempty"`
LayoutVersion *string `json:"layoutVersion,omitempty"`
MustShowHits *bool `json:"mustShowHits,omitempty"`
MustShowErrors *bool `json:"mustShowErrors,omitempty"`
MustShowLatency *bool `json:"mustShowLatency,omitempty"`
MustShowBreakdown *bool `json:"mustShowBreakdown,omitempty"`
MustShowDistribution *bool `json:"mustShowDistribution,omitempty"`
MustShowResourceList *bool `json:"mustShowResourceList,omitempty"`
// For MonitorSummary (manage_status) widget
DisplayFormat *string `json:"displayFormat,omitempty"`
ColorPreference *string `json:"colorPreference,omitempty"`
HideZeroCounts *bool `json:"hideZeroCounts,omitempty"`
ManageStatusShowTitle *bool `json:"showTitle,omitempty"`
ManageStatusTitleText *string `json:"titleText,omitempty"`
ManageStatusTitleSize *string `json:"titleSize,omitempty"`
ManageStatusTitleAlign *string `json:"titleAlign,omitempty"`
Params *Params `json:"params,omitempty"`
ShowLastTriggered *bool `json:"show_last_triggered,omitempty"`
SummaryType *string `json:"summary_type,omitempty"`
// For LogStream widget
Columns *string `json:"columns,omitempty"`
Logset *string `json:"logset,omitempty"`
Indexes []*string `json:"indexes,omitempty"`
ShowDateColumn *bool `json:"show_date_column,omitempty"`
ShowMessageColumn *bool `json:"show_message_column,omitempty"`
MessageDisplay *string `json:"message_display,omitempty"`
Sort *WidgetFieldSort `json:"sort,omitempty"`
// For Uptime
// Widget is undocumented, subject to breaking API changes, and without customer support
Timeframes []*string `json:"timeframes,omitempty"`
Rules map[string]*Rule `json:"rules,omitempty"`
Monitor *ScreenboardMonitor `json:"monitor,omitempty"`
}
type Params struct {
Sort *string `json:"sort,omitempty"`
Text *string `json:"text,omitempty"`
Count *string `json:"count,omitempty"`
Start *string `json:"start,omitempty"`
}
type Rule struct {
Threshold *json.Number `json:"threshold,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Color *string `json:"color,omitempty"`
}
type ScreenboardMonitor struct {
Id *int `json:"id,omitempty"`
}