getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
209 stars 52 forks source link

Add UPM packages contained in the project and their version to the Sentry Logs #301

Open avmaia opened 3 years ago

avmaia commented 3 years ago

Assembly definitions inside a package in the project are always logged as version 0.0.0.0, since its on the unity context it makes a lot more sense to log packages and their versions instead of these asmdefs.

Could possibly add an option to ignore assemblies generated from asmdefs inside packages since just always showing 0.0.0.0 adds some noise to the logging info.

bruno-garcia commented 3 years ago

@avmaia thanks for raising this. Would you be willing to contribute with a PR? You could start with a draft PR without tests or anything to get something quick up and we can discuss from there next steps. Thanks!

avmaia commented 3 years ago

@avmaia thanks for raising this. Would you be willing to contribute with a PR? You could start with a draft PR without tests or anything to get something quick up and we can discuss from there next steps. Thanks!

I dont have much time to look into it on the near future, but my suggestions are to look into https://docs.unity3d.com/ScriptReference/PackageManager.Client.List.html (will list all packages information, Editor-only) and https://docs.unity3d.com/ScriptReference/PackageManager.Events.html (when packages get registered, Editor-only) For builds you can hook refreshing/storing the PackageInfos somewhere (maybe on the sentry asset) using the https://docs.unity3d.com/ScriptReference/Build.IPreprocessBuildWithReport.html

This would be my first try

bruno-garcia commented 2 years ago

Related to #40

bruno-garcia commented 2 years ago

For reference:

Example assembly list in Sentry ![image](https://user-images.githubusercontent.com/1633368/158409654-60f80c2a-5d02-4084-a2c8-eb4bcbbd1a31.png) ![image](https://user-images.githubusercontent.com/1633368/158409705-9a7296e9-e15a-428d-afe7-de06d52dd67a.png) ![image](https://user-images.githubusercontent.com/1633368/158409747-11a641ec-2ddc-4539-95ff-4c94991e9cab.png)

Worth noting we've added an option Report Assemblies Mode) in the Editor integration window to change from the AssemblyVersion (those 4 digits) to AssemblyInformationalVersion. Some assemblies use it (for example, the Sentry/.NET ones):

image

But doesn't see to be very helpful for the Unity ones which don't use AssemblyInformationalVersion.

vaind commented 2 years ago

Current state of the configuration, for reference:

image