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

Filter out zap frames from stack traces to reduce noise #488

Closed
prashantv opened this issue Aug 11, 2017 · 0 comments
Closed

Filter out zap frames from stack traces to reduce noise #488

prashantv opened this issue Aug 11, 2017 · 0 comments
Assignees

Comments

@prashantv
Copy link
Collaborator

Zap currently only filters our runtime stack frames and the last takeStacktrace function, but not the other zap frames. This leads to stack traces like:

From #308 (comment)

2017-05-02T22:03:11.186-0700	ERROR	config/postgres.go:32	Unable to connect to postgres database{error 25 0  dial tcp [::1]:5432: getsockopt: connection refused} {config 2 0  postgresql://gecko_admin:devpass@localhost:%!d(string=5433)}	{"app_name": "ProjectGecko", "version": "0.1.0"}
go.uber.org/zap.Stack
	/Users/matt/Programming/GoDevel/src/go.uber.org/zap/field.go:209
go.uber.org/zap.(*Logger).check
	/Users/matt/Programming/GoDevel/src/go.uber.org/zap/logger.go:273
go.uber.org/zap.(*Logger).Check
	/Users/matt/Programming/GoDevel/src/go.uber.org/zap/logger.go:146
go.uber.org/zap.(*SugaredLogger).log
	/Users/matt/Programming/GoDevel/src/go.uber.org/zap/sugar.go:223
go.uber.org/zap.(*SugaredLogger).Error
	/Users/matt/Programming/GoDevel/src/go.uber.org/zap/sugar.go:102
gecko/config.SetupPostgres
	/Users/matt/Programming/ProjectGecko/src/api/src/gecko/config/postgres.go:32
main.main
	/Users/matt/Programming/ProjectGecko/src/api/server.go:40

Or if the package is installed through a vendor directory:

Error message
github.com/prashantv/test/vendor/go.uber.org/zap.Stack
	github.com/prashantv/test/vendor/go.uber.org/zap/field.go:191
github.com/prashantv/test/vendor/go.uber.org/zap.(*Logger).check
	github.com/prashantv/test/vendor/go.uber.org/zap/logger.go:301
github.com/prashantv/test/vendor/go.uber.org/zap.(*Logger).Check
	github.com/prashantv/test/vendor/go.uber.org/zap/logger.go:172
github.com/prashantv/test/vendor/go.uber.org/zap.(*SugaredLogger).log
	github.com/prashantv/test/vendor/go.uber.org/zap/sugar.go:233
github.com/prashantv/test/vendor/go.uber.org/zap.(*SugaredLogger).Errorf
	github.com/prashantv/test/vendor/go.uber.org/zap/sugar.go:148
github.com/prashantv/test/[...]

The Errorf etc don't really provide much value, so we should remove zap stack frames, even when they're in vendor.

@prashantv prashantv self-assigned this Aug 11, 2017
prashantv added a commit that referenced this issue Aug 16, 2017
Currently, zap only filters out runtime stackframes, which leaves a lot
of noise from zap (Error, log, check, etc). This modifies the stacktrace
to filter out all zap frames at the beginning of the stack. It will not
filter out zap stacks in between non-zap frames.

Fixes #488.
prashantv added a commit that referenced this issue Aug 17, 2017
Currently, zap only filters out runtime stackframes, which leaves a lot
of noise from zap (Error, log, check, etc). This modifies the stacktrace
to filter out all zap frames at the beginning of the stack. It will not
filter out zap stacks in between non-zap frames.

Fixes #488.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant