Skip to content

Commit b8697e8

Browse files
feat(boards): Add flexible board resource
1 parent cd6d5df commit b8697e8

File tree

8 files changed

+1608
-2
lines changed

8 files changed

+1608
-2
lines changed

client/board.go

-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ type BoardQueryPanel struct {
9797
QueryAnnotationID string `json:"query_annotation_id,omitempty"`
9898
VisualizationSettings *BoardQueryVisualizationSettings `json:"visualization_settings,omitempty"`
9999
Style BoardQueryStyle `json:"query_style,omitempty"`
100-
Dataset string `json:"dataset,omitempty"`
101100
}
102101

103102
type BoardQueryVisualizationSettings struct {

client/board_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,4 @@ func TestFlexibleBoards(t *testing.T) {
247247

248248
assert.Equal(t, *board, *flexibleBoard)
249249
})
250-
251250
}

docs/resources/flexible_board.md

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Resource: honeycombio_flexible_board
2+
3+
Creates a flexible board. For more information about boards, check out [Create Custom Boards](https://docs.honeycomb.io/observe/boards).
4+
5+
## Example Usage
6+
7+
### Simple Flexible Board
8+
9+
```hcl
10+
variable "dataset" {
11+
type = string
12+
}
13+
14+
data "honeycombio_query_specification" "latency_by_userid" {
15+
time_range = 86400
16+
breakdowns = ["app.user_id"]
17+
18+
calculation {
19+
op = "HEATMAP"
20+
column = "duration_ms"
21+
}
22+
23+
calculation {
24+
op = "P99"
25+
column = "duration_ms"
26+
}
27+
28+
filter {
29+
column = "trace.parent_id"
30+
op = "does-not-exist"
31+
}
32+
33+
order {
34+
column = "duration_ms"
35+
op = "P99"
36+
order = "descending"
37+
}
38+
39+
}
40+
41+
resource "honeycombio_query" "latency_by_userid" {
42+
dataset = var.dataset
43+
query_json = data.honeycombio_query_specification.latency_by_userid.json
44+
}
45+
46+
resource "honeycombio_query_annotation" "latency_by_userid" {
47+
dataset = var.dataset
48+
query_id = honeycombio_query.latency_by_userid.id
49+
name = "Latency by User"
50+
description = "A breakdown of trace latency by User over the last 24 hours"
51+
}
52+
53+
resource "honeycombio_derived_column" "request_latency_sli" {
54+
alias = "sli.request_latency"
55+
description = "SLI: request latency less than 300ms"
56+
dataset = var.dataset
57+
58+
# heredoc also works
59+
expression = file("../sli/sli.request_latency.honeycomb")
60+
61+
lifecycle {
62+
# in order to avoid potential conflicts with renaming the derived column
63+
# while in use by the SLO, we set create_before_destroy to true
64+
create_before_destroy = true
65+
}
66+
}
67+
68+
resource "honeycombio_slo" "slo" {
69+
name = "Latency SLO"
70+
description = "example SLO"
71+
dataset = var.dataset
72+
sli = honeycombio_derived_column.request_latency_sli.alias
73+
target_percentage = 99.9
74+
time_period = 30
75+
76+
tags = {
77+
team = "web"
78+
}
79+
}
80+
81+
resource "honeycombio_flexible_board" "overview" {
82+
name = "Service Overview"
83+
description = "My flexible baord description"
84+
85+
panel {
86+
type = "query"
87+
88+
position {
89+
x_coordinate = 0
90+
y_coordinate = 0
91+
width = 6
92+
height = 6
93+
}
94+
95+
query_panel {
96+
query_id = honeycombio_query.latency_by_userid.id
97+
query_annotation_id = honeycombio_query_annotation.latency_by_userid.id
98+
query_style = "combo"
99+
visualization_settings {
100+
use_utc_xaxis = true
101+
chart {
102+
chart_type = "line"
103+
chart_index = 0
104+
omit_missing_values = true
105+
use_log_scale = true
106+
}
107+
}
108+
}
109+
}
110+
111+
panel {
112+
type = "slo"
113+
slo_panel {
114+
slo_id = honeycombio_slo.slo.id
115+
}
116+
}
117+
}
118+
```
119+
120+
## Argument Reference
121+
122+
The following arguments are supported for flexible boards:
123+
124+
- `name` - (Required) Name of the board.
125+
- `description` - (Optional) Description of the board. Supports Markdown.
126+
- `panel` - (Optional) zero or more configurations blocks
127+
128+
Each board configuration may have zero or more `panel` blocks which accept the following arguments:
129+
130+
- `position` - (Optional) Single configuration block to determine position of the panel.
131+
- `slo_panel` - (Optional) This is only required for `type` slo panels. Single configuration block that contains board slo information.
132+
- `query_panel` - (Optional) This is only required for `type` query panels. Single configuration block that contains board query information.
133+
134+
Each `position` configuration accepts the following arguments:
135+
136+
- `x_coordinate` - (Optional) The x-axis origin point for placing the panel within the layout.
137+
- `y_coordinate` - (Optional) The y-axis origin point for placing the panel within the layout.
138+
- `width` - (Optional) The width of the panel in honeycomb UI columns. Defaults to 6 for queries and 3 for slos. Maximum value is 12.
139+
- `height` - (Optional) The height of the panel in rows. Defaults to 4.
140+
141+
Each `slo_panel` configuration accepts the following arguments:
142+
143+
- `slo_id` the ID of the SLO to add to the board.
144+
145+
Each `query_panel` configuration accepts the following arguments:
146+
147+
- `query_id` - (Required) The ID of the Query to show on the board.
148+
- `query_style` - (Optional) How the query should be displayed within the board, either `graph` (the default), `table` or `combo`.
149+
- `query_annotation_id` - (Required) The ID of the Query Annotation to associate with this query.
150+
- `visualization_settings` - (Optional) A configuration block to manage the query visualization and charts.
151+
152+
Each `visualization_settings` configuration accepts the following arguments:
153+
154+
- `use_utc_xaxis` - (Optional) Display UTC Time X-Axis or Localtime X-Axis.
155+
- `hide_markers` - (Optional) Hide [markers](https://docs.honeycomb.io/investigate/query/customize-results/#markers) from appearing on graph.
156+
- `hide_hovers` - (Optional) Disable Graph tooltips in the results display when hovering over a graph.
157+
- `overlaid_charts` - (Optional) Combine any visualized AVG, MIN, MAX, and PERCENTILE clauses into a single chart.
158+
- `chart` - (Optional) a configuration block to manage the query's charts.
159+
160+
Each `chart` configuration accepts the following arguments:
161+
162+
- `chart_type` - (Optional) the type of chart to render. Some example values: `line`, `tsbar`, `stacked`, `stat`, `tsbar`, `cpie`, `cbar`. Default to `default`
163+
- `chart_index` - (Optional) index of the charts this configuration corresponds to.
164+
- `omit_missing_values` - (Optional) Interpolates between points when the intervening time buckets have no matching events. Use to display a continuous line graph with no drops to zero.
165+
- `use_log_scale` - (Optional) Use logarithmic scale on Y axis. The y-axis of a Log Scale graph increases exponentially. Useful for data with an extremely large range of values.
166+
167+
## Attribute Reference
168+
169+
In addition to all arguments above, the following attributes are exported:
170+
171+
- `id` - ID of the board.
172+
- `board_url` - The URL to the board in the Honeycomb UI.
173+
174+
## Import
175+
176+
Boards can be imported using their ID, e.g.
177+
178+
```shell
179+
terraform import honeycombio_flexible_board.my_board AobW9oAZX71
180+
```
181+
182+
You can find the ID in the URL bar when visiting the board from the UI.

example/flexible_board/main.tf

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
terraform {
2+
required_providers {
3+
honeycombio = {
4+
source = "honeycombio/honeycombio"
5+
}
6+
}
7+
}
8+
9+
variable "dataset" {
10+
type = string
11+
}
12+
13+
data "honeycombio_query_specification" "latency_by_userid" {
14+
time_range = 86400
15+
breakdowns = ["app.user_id"]
16+
17+
calculation {
18+
op = "HEATMAP"
19+
column = "duration_ms"
20+
}
21+
22+
calculation {
23+
op = "P99"
24+
column = "duration_ms"
25+
}
26+
27+
filter {
28+
column = "trace.parent_id"
29+
op = "does-not-exist"
30+
}
31+
32+
order {
33+
column = "duration_ms"
34+
op = "P99"
35+
order = "descending"
36+
}
37+
}
38+
39+
resource "honeycombio_query" "latency_by_userid" {
40+
dataset = var.dataset
41+
query_json = data.honeycombio_query_specification.latency_by_userid.json
42+
}
43+
44+
resource "honeycombio_query_annotation" "latency_by_userid" {
45+
dataset = var.dataset
46+
query_id = honeycombio_query.latency_by_userid.id
47+
name = "Latency by User"
48+
description = "A breakdown of trace latency by User over the last 24 hours"
49+
}
50+
51+
resource "honeycombio_derived_column" "request_latency_sli" {
52+
alias = "sli.request_latency"
53+
description = "SLI: request latency less than 300ms"
54+
dataset = var.dataset
55+
56+
# heredoc also works
57+
expression = file("../sli/sli.request_latency.honeycomb")
58+
59+
lifecycle {
60+
# in order to avoid potential conflicts with renaming the derived column
61+
# while in use by the SLO, we set create_before_destroy to true
62+
create_before_destroy = true
63+
}
64+
}
65+
66+
resource "honeycombio_slo" "slo" {
67+
name = "Latency SLO"
68+
description = "example SLO"
69+
dataset = var.dataset
70+
sli = honeycombio_derived_column.request_latency_sli.alias
71+
target_percentage = 99.9
72+
time_period = 30
73+
74+
tags = {
75+
team = "web"
76+
}
77+
}
78+
79+
resource "honeycombio_flexible_board" "overview" {
80+
name = "Service Overview"
81+
description = "My flexible baord description"
82+
83+
panel {
84+
type = "query"
85+
86+
position {
87+
x_coordinate = 0
88+
y_coordinate = 0
89+
width = 6
90+
height = 6
91+
}
92+
93+
query_panel {
94+
query_id = honeycombio_query.latency_by_userid.id
95+
query_annotation_id = honeycombio_query_annotation.latency_by_userid.id
96+
query_style = "combo"
97+
visualization_settings {
98+
use_utc_xaxis = true
99+
chart {
100+
chart_type = "line"
101+
chart_index = 0
102+
omit_missing_values = true
103+
use_log_scale = true
104+
}
105+
}
106+
}
107+
}
108+
109+
panel {
110+
type = "slo"
111+
slo_panel {
112+
slo_id = honeycombio_slo.slo.id
113+
}
114+
}
115+
}

0 commit comments

Comments
 (0)