Skip to content

Commit

Permalink
Remove redundant alert name assignment
Browse files Browse the repository at this point in the history
Removed the redundant line where alert name was being assigned with the Builder title in both graph.go and timeseries.go. Also updated the alert creation test in alert_test.go to reflect this change.
  • Loading branch information
lueurxax committed Apr 30, 2024
1 parent eda0f96 commit 2e021d1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion decoder/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestDecodingSimpleAlert(t *testing.T) {
opts, err := alertDef.toOptions()
req.NoError(err)

alertBuilder := alert.New("", opts...)
alertBuilder := alert.New("", "", opts...)
rule := alertBuilder.Builder.Rules[0]

req.Equal("description", rule.Annotations["description"])
Expand Down
1 change: 0 additions & 1 deletion graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ func XAxis(opts ...axis.Option) Option {
func Alert(name string, opts ...alert.Option) Option {
return func(graph *Graph) error {
al := alert.New(name, graph.Builder.Title, opts...)
al.Builder.Name = graph.Builder.Title
graph.Alerts = append(graph.Alerts, al)

return nil
Expand Down
1 change: 0 additions & 1 deletion timeseries/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ func Transparent() Option {
func Alert(name string, opts ...alert.Option) Option {
return func(timeseries *TimeSeries) error {
al := alert.New(name, timeseries.Builder.Title, opts...)
al.Builder.Name = timeseries.Builder.Title
timeseries.Alerts = append(timeseries.Alerts, al)

return nil
Expand Down

0 comments on commit 2e021d1

Please sign in to comment.