Skip to content

Commit

Permalink
Merge pull request #2031 from authzed/integrate-updates-to-cobrautil
Browse files Browse the repository at this point in the history
Integrate updates to cobrautil
  • Loading branch information
tstirrat15 authored Aug 19, 2024
2 parents 4c86039 + 0c3ad1f commit 7e19001
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ require (
github.com/jackc/pgx-zerolog v0.0.0-20230315001418-f978528409eb
github.com/jackc/pgx/v5 v5.6.0
github.com/johannesboyne/gofakes3 v0.0.0-20230914150226-f005f5cc03aa
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240816002907-ef0e64d7f25b
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240819150235-f7fe73942d0f
github.com/jzelinskie/persistent v0.0.0-20230816160542-1205ef8f0e15
github.com/jzelinskie/stringz v0.0.3
github.com/lthibault/jitterbug v2.0.0+incompatible
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,8 @@ github.com/jzelinskie/cobrautil/v2 v2.0.0-20240813173937-98b79ae0b499 h1:dXbwn1p
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240813173937-98b79ae0b499/go.mod h1:jsl6cEF6BT3UeQoSLreA7G0sZXemoI5XNqyxzWCohbE=
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240816002907-ef0e64d7f25b h1:dUjc3twJXVQ7FILS1+KhHilbM7LQwIvVgH4E7h0AwTA=
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240816002907-ef0e64d7f25b/go.mod h1:jsl6cEF6BT3UeQoSLreA7G0sZXemoI5XNqyxzWCohbE=
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240819150235-f7fe73942d0f h1:+WgAZQQXj+X8lcJdwcrQpD89Zd9ekdauOK3hWl3FkPU=
github.com/jzelinskie/cobrautil/v2 v2.0.0-20240819150235-f7fe73942d0f/go.mod h1:jsl6cEF6BT3UeQoSLreA7G0sZXemoI5XNqyxzWCohbE=
github.com/jzelinskie/persistent v0.0.0-20230816160542-1205ef8f0e15 h1:lFr5Krrc4LESaXK9yW15IQMZ4p2bZGw/+71Z1dV6tuk=
github.com/jzelinskie/persistent v0.0.0-20230816160542-1205ef8f0e15/go.mod h1:gGiXKQUcSfUdRciTcDSuLGLZLLFSIjt1xNTE90WHDSI=
github.com/jzelinskie/stringz v0.0.3 h1:0GhG3lVMYrYtIvRbxvQI6zqRTT1P1xyQlpa0FhfUXas=
Expand Down
8 changes: 7 additions & 1 deletion pkg/cmd/server/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"
"time"

"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/fatih/color"
"github.com/go-logr/zerologr"
grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus"
Expand Down Expand Up @@ -72,7 +73,12 @@ func DefaultPreRunE(programName string) cobrautil.CobraRunFunc {
logging.SetGlobalLogger(logger)
}),
).RunE(),
cobraproclimits.SetMemLimitRunE(),
// NOTE: These need to be declared after the logger to access
// the logging context.
// NOTE: The default memlimit is 0.9. Our assumption is that SpiceDB
// will be the only thing consuming memory in its context, and if
// this needs to be configurable we can do that as a future step.
cobraproclimits.SetMemLimitRunE(memlimit.WithRatio(1.0)),
cobraproclimits.SetProcLimitRunE(),
cobraotel.New("spicedb",
cobraotel.WithLogger(zerologr.New(&logging.Logger)),
Expand Down

0 comments on commit 7e19001

Please sign in to comment.