Skip to content

Commit

Permalink
Update gocommon
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Dec 13, 2024
1 parent 9ebcca0 commit 9a27d22
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion archives/archives.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,8 @@ func ArchiveActiveOrgs(rt *runtime.Runtime) error {
{MetricName: aws.String("RunsRollupsFailed"), Value: aws.Float64(float64(totalRunsRollupsFailed)), Unit: types.StandardUnitCount},
}

if _, err := rt.CW.Client.PutMetricData(ctx, rt.CW.Prepare(metrics)); err != nil {
err = rt.CW.Send(ctx, metrics...)
if err != nil {
slog.Error("error putting metrics", "error", err)
}

Check warning on line 989 in archives/archives.go

View check run for this annotation

Codecov / codecov/patch

archives/archives.go#L988-L989

Added lines #L988 - L989 were not covered by tests

Expand Down
10 changes: 5 additions & 5 deletions archives/archives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func setup(t *testing.T) (context.Context, *runtime.Runtime) {

slog.SetDefault(slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug})))

CW, err := cwatch.NewService(config.AWSAccessKeyID, config.AWSSecretAccessKey, config.AWSRegion, config.CloudwatchNamespace, config.DeploymentID)
CW, err := cwatch.NewService(config.AWSAccessKeyID, config.AWSSecretAccessKey, config.AWSRegion, config.CloudwatchNamespace, "test")
require.NoError(t, err)

return ctx, &runtime.Runtime{Config: config, DB: db, S3: s3Client, CW: CW}
Expand Down Expand Up @@ -501,10 +501,10 @@ func TestArchiveActiveOrgs(t *testing.T) {

assert.Equal(t, 0, rt.CW.Client.(*cwatch.DevClient).CallCount())

_, err := rt.CW.Client.PutMetricData(ctx, rt.CW.Prepare([]types.MetricDatum{
{MetricName: aws.String("NumGoats"), Value: aws.Float64(10), Unit: types.StandardUnitCount},
{MetricName: aws.String("NumSheep"), Dimensions: []types.Dimension{{Name: aws.String("Host"), Value: aws.String("foo1")}}, Value: aws.Float64(20), Unit: types.StandardUnitCount},
}))
err := rt.CW.Send(ctx,
types.MetricDatum{MetricName: aws.String("NumGoats"), Value: aws.Float64(10), Unit: types.StandardUnitCount},
types.MetricDatum{MetricName: aws.String("NumSheep"), Dimensions: []types.Dimension{{Name: aws.String("Host"), Value: aws.String("foo1")}}, Value: aws.Float64(20), Unit: types.StandardUnitCount},
)

assert.NoError(t, err)
assert.Equal(t, 1, rt.CW.Client.(*cwatch.DevClient).CallCount())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/jmoiron/sqlx v1.4.0
github.com/lib/pq v1.10.9
github.com/nyaruka/ezconf v0.3.0
github.com/nyaruka/gocommon v1.60.2
github.com/nyaruka/gocommon v1.60.3
github.com/samber/slog-multi v1.2.0
github.com/samber/slog-sentry v1.2.2
github.com/stretchr/testify v1.10.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ github.com/nyaruka/gocommon v1.60.2-0.20241213113333-112a0bc4c3ee h1:MH7kxmPa53X
github.com/nyaruka/gocommon v1.60.2-0.20241213113333-112a0bc4c3ee/go.mod h1:kFJuOq8COneV7ssfK6xgCMJ8gP8fQifLQnNXBnE4YL0=
github.com/nyaruka/gocommon v1.60.2 h1:AvvSSAV70SV49ocNtvjpdb9NlcdiA2OQAL4NYVUcuV0=
github.com/nyaruka/gocommon v1.60.2/go.mod h1:kFJuOq8COneV7ssfK6xgCMJ8gP8fQifLQnNXBnE4YL0=
github.com/nyaruka/gocommon v1.60.3 h1:fPQ9t6NX+mu7JQ7nXefgpBs8paqGvGXq3eA7VscsAVo=
github.com/nyaruka/gocommon v1.60.3/go.mod h1:kFJuOq8COneV7ssfK6xgCMJ8gP8fQifLQnNXBnE4YL0=
github.com/nyaruka/librato v1.1.1 h1:0nTYtJLl3Sn7lX3CuHsLf+nXy1k/tGV0OjVxLy3Et4s=
github.com/nyaruka/librato v1.1.1/go.mod h1:fme1Fu1PT2qvkaBZyw8WW+SrnFe2qeeCWpvqmAaKAKE=
github.com/nyaruka/null/v2 v2.0.3 h1:rdmMRQyVzrOF3Jff/gpU/7BDR9mQX0lcLl4yImsA3kw=
Expand Down

0 comments on commit 9a27d22

Please sign in to comment.