uber-go/zap

Add an option to override stacktrace collection logic

Open

#514 opened on Oct 12, 2017

View on GitHub
 (5 comments) (6 reactions) (0 assignees)Go (22,391 stars) (1,448 forks)batch import
help wanted

Description

Stacktrace collection

While trying to implement an encoder that is compatible with GCP Stackdriver logging and also for GCP Stackdriver Error Reporting, I suspected that it's not working properly because the generated stacktrace is not compatible with what Error Reporting is expected.

The documentation says (https://cloud.google.com/error-reporting/docs/formatting-error-messages): Go: Must be the return value of runtime.Stack()

The code in go sources (cloud.google.com/go/errors/errors.go) shows that cloud.google.com/go/errors.(*Client).logInternal indeed calls runtime.Stack.

Unfortunately, the stack is grabbed by trackStacktrace in stracktrace.go, and there is apparently no other way around to provide the stracktrace.

Unless I'm missing something, we cannot provide the way the stacktrace is grabbed by zap

Contributor guide