-
Notifications
You must be signed in to change notification settings - Fork 215
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
Big distribution size of sentry-go (~ 8MB) #75
Comments
Hey, these dependencies shouldn't be bundled in the binary unless their respective integrations (http packages) are imported. Can you provide a minimal example of a build where I can repro this? |
Hi, kamilogorek Thanks for watching this. Reproduce steps:
It's super visible when you do it in docker when |
Whoops! I can confirm that's an issue. I'll take a look at it as early as next week. I'll keep you posted, thanks! |
I verified that and the size is not caused by the external package, but by the number of built-in packages we use. Unless you are using specific integration, it won't be included in the build. If you'll create an empty project without any external dependency, and build it with the same built-in packages, you'll get almost the same size: package main
import (
_ "bufio"
_ "bytes"
_ "context"
_ "crypto/rand"
_ "crypto/tls"
_ "crypto/x509"
_ "encoding/hex"
_ "encoding/json"
_ "fmt"
_ "go/build"
_ "io"
_ "io/ioutil"
_ "log"
_ "math/rand"
_ "net"
_ "net/http"
_ "net/url"
_ "os"
_ "path/filepath"
_ "reflect"
_ "regexp"
_ "runtime"
_ "sort"
_ "strconv"
_ "strings"
_ "sync"
_ "time"
)
func main() {} -rwxr-xr-x 1 kamilogorek staff 8.9M Nov 12 16:05 hello-world |
Overhead may or may not end up in the artifact but it will spam my project dependencies, which I care about. Please read https://research.swtch.com/deps
|
@rur got it. We'll sort that out (have to somehow manage sub-packages with their own go.mod file) and fix the issue as soon as we can. |
👋 The large dependency list of this SDK is a burden in other ways beyond binary size. For engineering teams that review or audit dependencies the huge number of dependencies that this SDK imports directly and indirectly is overwhelming. This isn't a one-time cost since the list changes between releases. As an example this is a summary of the changes to a Go project upgrading the Sentry SDK to the latest version showing dependencies removed, added, and changed. An importer of the Sentry SDK who wishes to review and test dependencies would have to review 23 new dependencies and changes to 15 existing dependencies. This scale of dependency changes is more similar to the cost in upgrading from one version of a completely encompassing multi-feature web framework rather than a utility or integration SDK. It'd be great if the dependency list could be greatly reduced ❤️.
Output is generated by golistcmp. |
Another example output, the total number of dependencies for the SDK is 129 (one line in the output below is the module name itself, so one less than 130):
|
Most of the dependencies arises from the module containing handlers for lots of different servers, e.g. Most applications are going to use a single type of http server, and so many of the dependencies being imported will be unused in an importing application. Applications that use only 💡Could each server specific handler become it's own Go Module, i.e. create a |
This is exactly what we want to do. We are just kinda swamped right now, but will try to solve it asap. Thanks for the feedback and great writeup @leighmcculloch |
Hi there! I see that the conversation detoured from binary sizes to I suggest we move the With regards to binary size, I consider this to be resolved. Smaller binaries depend on improvements in the Go toolchain. I'm following golang/go#6853 for that. The Other packages with specific integrations, for example Note also that the Go tool will not download the source code for packages you don't ever import and use. In Module mode, it does download module metadata to resolve build dependencies. These are the direct dependencies of $ go list -f '{{range .Imports}}{{printf "%s\n" .}}{{end}}' github.com/getsentry/sentry-go
bufio
bytes
context
crypto/rand
crypto/tls
crypto/x509
encoding/hex
encoding/json
fmt
go/build
io
io/ioutil
log
math/rand
net
net/http
net/url
os
path/filepath
reflect
regexp
runtime
sort
strconv
strings
sync
time $ go list -f '{{range .Imports}}{{printf "%s\n" .}}{{end}}' github.com/getsentry/sentry-go | wc -l
27 The reality is that adding I'm open to make improvements if we can, but I'm afraid there's no low-hanging fruit here. |
Hi,
Sentry-go has almost 40 indirect dependencies
https://github.com/getsentry/sentry-go/blob/master/go.mod
which makes a binary package for primitive < 5MB applications quite big
is there a way to work around this, (some sort of lightweight minimal client ?) or do we have HTTP client for Sentry that we can use? thanks
The text was updated successfully, but these errors were encountered: