bugsnag / bugsnag-go

Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
https://docs.bugsnag.com/platforms/go
MIT License
203 stars 69 forks source link

Stop trimming everything before "main.go" on main packages #203

Closed veqryn closed 6 months ago

veqryn commented 9 months ago

Goal

No matter how I configure SourceRoot and ProjectPackages, any stack trace with a main package with a file containing "main" will be trimmed of its prefix, valid or not. We should not do that, and let SourceRoot and ProjectPackages do that.

For example, if I have multiple main files, it can be confusing knowing which one is responsible when bugsnag shows all of them as main.go.

Another example, if I have a main file called my_main_file.go, it will show up in Bugsnag as just main_file.go, with the my_ stripped off, which is clearly wrong.

I would expect that in bugsnag it would show up as something like cmd/export-service/my_main_file.go

Design

Skip trimming everything in front of the word "main"

Changeset

See file diff

Testing

All automated tests pass. Manual testing works as well, with the desired result.

clr182 commented 8 months ago

Hi @veqryn

Thank you for opening this pull request. Internal discussions are underway regarding the changes proposed in this PR. We will keep you informed with any additional information as soon as it becomes available.

clr182 commented 6 months ago

Hi @veqryn

Thank you for your patience as we investigated this issue further.

We are currently working on an alternative to this PR - You can check it out here if you would like to try it out. The changes here are to fix the order of trimming on file paths and setting the SourceRoot in the configuration to the top directory of the code.

If you do get the chance to try the PR, please let us know if it has solved your issue or whether you are seeing any further issues relating.

clr182 commented 6 months ago

Hi @veqryn

I'm just reaching out to let you know we have a new release (v2.3.0) out for the BugSnag-Go notifier.

This release should address the issue you were seeing with trimming everything before "main.go" on main packages. If after updating you are still seeing issues, please let us know and we can investigate further.

veqryn commented 6 months ago

Great to hear, thank you!