We'd like to send source code context into Sentry alerts along with stacktraces. This works on localhost or on machines that have the source code available on the file system.
But we don't want to ship the source code of our repository in plain text as part of the Docker image because of disk space and security reasons.
However, we still want to receive source code context in our production Sentry alerts.
Proposal
Let raven-go users define their own "storage" of the source code files.
Change the fileContext(filename string, line, context int) ([][]byte, int)stacktrace.go function to an implementation of a new interface:
We plan to embed the source code into the binary via https://github.com/shurcooL/vfsgen and implement the interface on top of http.FileSystem.
The custom loader can be built on anything that can provide source code, either if it's static files built into binaries (like vfsgen, packer etc.), or an implementation that pulls the source code directly from Github.
Rationale
We'd like to send source code context into Sentry alerts along with stacktraces. This works on localhost or on machines that have the source code available on the file system.
But we don't want to ship the source code of our repository in plain text as part of the Docker image because of disk space and security reasons.
However, we still want to receive source code context in our production Sentry alerts.
Proposal
Let raven-go users define their own "storage" of the source code files.
Change the
fileContext(filename string, line, context int) ([][]byte, int)
stacktrace.go function to an implementation of a new interface:Example of custom source code loader
We plan to embed the source code into the binary via https://github.com/shurcooL/vfsgen and implement the interface on top of
http.FileSystem
.The custom loader can be built on anything that can provide source code, either if it's static files built into binaries (like vfsgen, packer etc.), or an implementation that pulls the source code directly from Github.