Skip to content

Commit

Permalink
Wire klog with a filter to show only client- or server-side throttling
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
  • Loading branch information
sttts committed Feb 27, 2024
1 parent e053b68 commit eb9fe61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cmd/crossplane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (d debugFlag) BeforeApply(ctx *kong.Context) error { //nolint:unparam // Be
// *very* verbose even at info level, so we only provide it a real
// logger when we're running in debug mode.
ctrl.SetLogger(zl)
logging.SetFilteredKlogLogger(zl)
return nil
}

Expand All @@ -79,11 +80,14 @@ func (v versionFlag) BeforeApply(app *kong.Kong) error { //nolint:unparam // Bef

func main() {
zl := zap.New().WithName("crossplane")
logging.SetFilteredKlogLogger(zl)

// Setting the controller-runtime logger to a no-op logger by default,
// unless debug mode is enabled. This is because the controller-runtime
// logger is *very* verbose even at info level. This is not really needed,
// but otherwise we get a warning from the controller-runtime.
ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard)))

// Note that the controller managers scheme must be a superset of the
// package manager's object scheme; it must contain all object types that
// may appear in a Crossplane package. This is because the package manager
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/alecthomas/kong v0.8.1
github.com/bufbuild/buf v1.27.2
github.com/crossplane/crossplane-runtime v1.16.0-rc.1
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240226223305-2c81cc6326e5
github.com/docker/docker v25.0.2+incompatible
github.com/docker/go-connections v0.5.0
github.com/emicklei/dot v1.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1 h1:wBvfaEgDdYa47qovPWYc80IGTBw17B3zw3yf2Q2NNkQ=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1/go.mod h1:kRcJjJQmBFrR2n/KhwL8wYS7xNfq3D8eK4JliEScOHI=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240226223305-2c81cc6326e5 h1:Jiqj9j43gUX/goitNa86/ociah8G74C3pIGwIPSZsks=
github.com/crossplane/crossplane-runtime v1.16.0-rc.1.0.20240226223305-2c81cc6326e5/go.mod h1:rG/KJwyA4iGMCubZ1EXs39Ow7XvOcWEfb1u3jkNekfw=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
Expand Down

0 comments on commit eb9fe61

Please sign in to comment.