Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into event_queries_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterSquishy committed Mar 6, 2024
2 parents eb9912f + 7860db1 commit b90afbf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docs/resources/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Optional:

Optional:

- `is_donut` (Boolean)
- `sort_by` (String)
- `sort_direction` (String)
- `y_axis_log_base` (Number)
Expand Down Expand Up @@ -273,6 +274,7 @@ Optional:

Optional:

- `is_donut` (Boolean)
- `sort_by` (String)
- `sort_direction` (String)
- `y_axis_log_base` (Number)
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Optional:

Optional:

- `is_donut` (Boolean)
- `sort_by` (String)
- `sort_direction` (String)
- `y_axis_log_base` (Number)
Expand Down Expand Up @@ -280,6 +281,7 @@ Optional:

Optional:

- `is_donut` (Boolean)
- `sort_by` (String)
- `sort_direction` (String)
- `y_axis_log_base` (Number)
Expand Down
5 changes: 5 additions & 0 deletions lightstep/resource_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func getUnifiedQuerySchemaMap() map[string]*schema.Schema {
"big_number_v2",
"scatter_plot",
"ordered_list",
"pie",
"table",
"traces_list",
}, false),
Expand Down Expand Up @@ -74,6 +75,10 @@ func getUnifiedQuerySchemaMap() map[string]*schema.Schema {
Type: schema.TypeFloat,
Optional: true,
},
"is_donut": {
Type: schema.TypeBool,
Optional: true,
},
},
},
Description: "Applicable options vary depending on the display type. Please see the Lightstep documentation for a full description.",
Expand Down
23 changes: 13 additions & 10 deletions lightstep/resource_dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,19 @@ func TestDisplayTypeOptions(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display_type_options.0.sort_direction", "asc"),
),
},
{
Config: makeDisplayTypeConfig("pie", strings.TrimSpace(`
display_type_options {
is_donut = true
}
`)),
Check: resource.ComposeTestCheckFunc(
testAccCheckMetricDashboardExists(resourceName, &dashboard),
resource.TestCheckResourceAttr(resourceName, "dashboard_name", "test display_type_options"),
resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display", "pie"),
resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display_type_options.0.is_donut", "true"),
),
},
{
Config: makeDisplayTypeConfig("table", strings.TrimSpace(`
display_type_options {
Expand Down Expand Up @@ -1376,16 +1389,6 @@ group {
resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.subtitle", ""),
),
},
{
// subtitle too long, this should be a chart-level description or something
Config: fmt.Sprintf(configTemplate, `subtitle = "this number represents the percentage of CPU cycles available to us that we have actually used"`),
Check: resource.ComposeTestCheckFunc(
testAccCheckMetricDashboardExists(resourceName, &dashboard),
resource.TestCheckResourceAttr(resourceName, "group.#", "1"),
resource.TestCheckResourceAttr(resourceName, "group.0.chart.#", "1"),
),
ExpectError: regexp.MustCompile("expected length of group.0.chart.0.subtitle to be in the range \\(0 - 37\\).*"),
},
{
// normal subtitle
Config: fmt.Sprintf(configTemplate, `subtitle = "percent"`),
Expand Down
2 changes: 1 addition & 1 deletion lightstep/resource_metric_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func getChartSchema(chartSchemaType ChartSchemaType) map[string]*schema.Schema {
Type: schema.TypeString,
Description: "Subtitle to show beneath big number, unused in other chart types",
Optional: true,
ValidateFunc: validation.StringLenBetween(0, 37),
ValidateFunc: validation.StringLenBetween(0, 256),
},
},
)
Expand Down

0 comments on commit b90afbf

Please sign in to comment.