Skip to content

Commit

Permalink
replace label point with string and remove short circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
srjames90 committed Jun 24, 2024
1 parent 2173d00 commit 56baf3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions client/metric_dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ type Threshold struct {
Operator string `json:"operator"`
Value float64 `json:"value"`
// An alpha hex color
Color string `json:"color"`
Label *string `json:"label"`
Color string `json:"color"`
Label string `json:"label"`
}

type YAxis struct {
Expand Down
8 changes: 2 additions & 6 deletions lightstep/resource_metric_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,7 @@ func buildChartThresholds(thresholdsIn []interface{}) ([]client.Threshold, error
return []client.Threshold{}, fmt.Errorf("missing required attribute 'operator' for threshold")
}

label, ok := threshold["label"].(string)

if !ok {
return []client.Threshold{}, fmt.Errorf("missing required attribute 'label' for threshold")
}
label := threshold["label"].(string)

value, ok := threshold["value"].(float64)

Expand All @@ -643,7 +639,7 @@ func buildChartThresholds(thresholdsIn []interface{}) ([]client.Threshold, error

thresholds = append(thresholds, client.Threshold{
Color: color,
Label: &label,
Label: label,
Operator: operator,
Value: value,
})
Expand Down

0 comments on commit 56baf3b

Please sign in to comment.