Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.1: Fix panic in monitor/level_collector #137

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
)

const VERSION = "1.2.0"
const VERSION = "1.2.1"

var SHA = ""

Expand Down
5 changes: 5 additions & 0 deletions docs/content/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func(metrics []*blip.Metrics) error {

2. If using an integration that works with Blip events, see [event/list.go](https://github.com/cashapp/blip/blob/main/event/list.go) for the new event names.

### v1.2.1 (19 Jul 2024)

* Fixed bug (panic) in `monitor/level_collector` when plan has no levels.
* Added `plan/default.None`.

### v1.2.0 (2 Jul 2024)

* Rewrote monitor.Engine ("engine v2") and some of level collector (LCO)
Expand Down
4 changes: 3 additions & 1 deletion monitor/level_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ func (c *lco) changePlan(ctx context.Context, doneChan chan struct{}, newState,
c.state = newState
c.plan = newPlan
c.levels = levels
c.emr = blip.TimeLimit(0.1, levels[0].Freq, time.Second) // interval minus 10% (max 1s)
if len(levels) > 0 { // there can be 0 levels, e.g. plan/default.None
c.emr = blip.TimeLimit(0.1, levels[0].Freq, time.Second) // interval minus 10% (max 1s)
}

// Changing state/plan always resumes (if paused); in fact, it's the
// only way to resume after Pause is called
Expand Down
14 changes: 14 additions & 0 deletions plan/default/none.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2024 Block, Inc.

package default_plan

import "github.com/cashapp/blip"

// None returns an empty plan usual for standby instances of Blip.
func None() blip.Plan {
return blip.Plan{
Name: "default-none",
Source: "blip",
Levels: map[string]blip.Level{},
}
}
12 changes: 12 additions & 0 deletions plan/sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/cashapp/blip"
"github.com/cashapp/blip/plan"
defaultPlan "github.com/cashapp/blip/plan/default"
)

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -471,3 +472,14 @@ func TestSortComplex(t *testing.T) {
t.Error(diff)
}
}

func TestSortDefault_None(t *testing.T) {
p := defaultPlan.None()
gotLevels := plan.Sort(&p)
if gotLevels == nil {
t.Errorf("got nil sorted levels, execpted non-nil return value")
}
if len(gotLevels) != 0 {
t.Errorf("got %d levels from default.None plan, expected 0", len(gotLevels))
}
}
Loading