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

[Sentry] ModuleIntegration wasn't able to extract modules: module integration failed #197

Closed
parasssh opened this issue Apr 10, 2020 · 2 comments · Fixed by #199
Closed

Comments

@parasssh
Copy link

parasssh commented Apr 10, 2020

hypermodeinc/dgraph#5166

A user is seeing this log message from Sentry when using our application. More details at the link above.
[Sentry] ModuleIntegration wasn't able to extract modules: module integration failed

Questions:

  1. What does this message mean?
  2. Under what circumstances do we see this?
  3. And is it a concern or can be ignored?

FWIW, this user's sentry event with ID cc19eb68a1de4cdc8f4808283e9d17ea was indeed reported on our Sentry Dashboard.

@parasssh
Copy link
Author

The sentry-go SDK is version 0.5.1

@rhcarvalho
Copy link
Contributor

Hi @parasssh! Thanks for bringing this to our attention.

1. What does this message mean?

It means that the SDK could not get module information to attach to the error prior to reporting.

2. Under what circumstances do we see this?

It will happen whenever the SDK doesn't find a go.mod file or vendor/modules.txt or vendor/vendor.json.

Current implementation

func extractModules() map[string]string {
extractedModules, err := getModules()
if err != nil {
Logger.Printf("ModuleIntegration wasn't able to extract modules: %v\n", err)
return nil
}
return extractedModules
}
func getModules() (map[string]string, error) {
if fileExists("go.mod") {
return getModulesFromMod()
}
if fileExists("vendor") {
// Priority given to vendor created by modules
if fileExists("vendor/modules.txt") {
return getModulesFromVendorTxt()
}
if fileExists("vendor/vendor.json") {
return getModulesFromVendorJSON()
}
}
return nil, fmt.Errorf("module integration failed")
}

3. And is it a concern or can be ignored?

It can be totally ignored. The only consequence is that the event in Sentry will not include a list of modules/packages.

In case of dgraph, which AFAIK is a program rather than a library, I'd say it is not so critical to have a list of packages listed in Sentry, since the dependencies for a given binary are known and do not change in runtime.


Whenever we fix #184, we'll likely be able to get a list of modules from the running binary itself, without a dependency on go.mod (via https://golang.org/pkg/runtime/debug/#BuildInfo).

In the meantime, if the message is bothering and you'd like to get rid of it right now, one way to do so is to disable the Modules Integration:

func main() {
	err := sentry.Init(sentry.ClientOptions{
		// ...
		Integrations: func(integrations []sentry.Integration) []sentry.Integration {
			filtered := integrations[:0]
			for _, integration := range integrations {
				if integration.Name() != "Modules" {
					filtered = append(filtered, integration)
				}
			}
			return filtered
		},
	})
	// ...
}

rhcarvalho added a commit that referenced this issue Apr 17, 2020
runtime/debug.ReadBuildInfo is more reliable than manually parsing a `go.mod`
file, specially without assistance from golang.org/x/mod/modfile. Another
advantage is that it doesn't require `go.mod` and source code to be available.
We also now include the current module (the module with package main) in the
list of modules.

runtime/debug.ReadBuildInfo requires go 1.12, which is already the minimum
supported Go version. Thus bump the language version in go.mod.

Drop support for reading dependencies from govendor's `vendor/vendor.json`.

Fixes #184.
Fixes #197.

Co-authored-by: Rodolfo Carvalho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants