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 new SDK structure #48

Closed
wants to merge 17 commits into from
Closed

Sentry new SDK structure #48

wants to merge 17 commits into from

Conversation

semuserable
Copy link
Contributor

@semuserable semuserable commented Feb 5, 2021

I suggest to take a look at the proposed structure by opening the branch itself from github UI, here is the link.

General "what's inside" and points for discussion

  • UPM package can be installed right now via https://github.com/getsentry/sentry-unity.git?path=/package#feature/restructure (configure your DSN via Component/Sentry window)
    • path package folder to install from
    • #feature/restructure branch to install from
  • Project Plugins/Android removed until Android integration (Android related code is not removed)
  • [Discuss] Configure UnityPath in Directory.Build.props for other development OSes. Currently only Windows. Add for possible paths MacOS. Previous approach in main branch regarding path setting didn't work for me
  • [Discuss] Check package.json for what's missing or wrong (name, versions, etc)
  • [Discuss] Submodule sentry-dotnet is via https for now. It's hell to move the submodule around, wtf?, worst times. Spent too much time on that with cryptic git commands
  • [Discuss] StackTraceMode.Original for issue 46 didn't work out. Still receive exception for Path.GetFileName on Mono. Workaround for now - UnityEventProcessor, Line: 246 (no link because of 'Load diff')
  • /samples/unity-of-bugs project. I checked all buttons and present the current behavior. I enabled debug mode from sentry window in order to see how logs are propagated. 'Capturing event' sends to sentry, 'Configuring the scope' not.
    • AssertFalse - Capturing event (sent to io.sentry)
    • ThrowNull - Capturing event (sent to io.sentry)
    • ThrowExceptionAndCatch - Configuring the scope (not sent to io.sentry),
    • ThrowNullAndCatch - Configuring the scope (not sent to io.sentry)
    • SendMessage - Configuring the scope (not sent to io.sentry)
    • ExceptionToString - Configuring the scope (not sent to io.sentry)
    • ThrowKotlinOnBackground - no Android support yet
    • ThorwKotlinOnBckround - no Android support yet
    • CrashNative - Capturing event (sent to io.sentry)
  • [Discuss] I didn't do any updates to README.md yet. I suggest to discuss it first.

I probably have missed something, but I hope this solves all the current needs for us. Let me quickly summarize

  • Unity installable UPM package
  • Convenient development flow
    • Package development in a separate solution, not in Unity
    • Sample project to quickly test and iterate the latest changes
  • Clear folders structure with clear names, no ~ folders for UPM
  • issue 45 unblocked

The following issues can be closed after the merge

@semuserable semuserable marked this pull request as ready for review February 5, 2021 17:00
url = ../../sentry-dotnet.git
[submodule "src/sentry-dotnet"]
path = src/sentry-dotnet
url = https://github.com/getsentry/sentry-dotnet.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a relative path so that it uses the same scheme used to checkout the repo.

I use git but folks forking usually use https and this came up as an issue before.

</member>
<member name="F:Sentry.AttachmentType.Default">
<summary>
Standard attachment without special meaning.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably patch the build not to generate this. It's used to generate the API docs but we don't need here

<UnityPath Condition="$(UnityPath) == '' AND Exists('C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed\UnityEngine.dll')">C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed</UnityPath>
<UnityPath Condition="$(UnityPath) == '' AND Exists('/Applications/Unity/Hub/Editor/$(UnityVersion)/Unity.app/Contents/Managed/UnityEngine.dll')">/Applications/Unity/Hub/Editor/$(UnityVersion)/Unity.app/Contents/Managed/</UnityPath>
<!--If not using Unity Hub, tries to pick whatever Unity version is installed on the machine-->
<UnityPath Condition="$(UnityPath) == '' AND Exists('C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll')">C:\Program Files\Unity\Editor\Data\Managed</UnityPath>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paths for macOS are here

@bruno-garcia
Copy link
Member

I suggest to take a look at the proposed structure by opening the branch itself from github UI, here is the link.

General "what's inside" and points for discussion

  • UPM package can be installed right now via https://github.com/getsentry/sentry-unity.git?path=/package#feature/restructure (configure your DSN via Component/Sentry window)

    • path package folder to install from
    • #feature/restructure branch to install from
  • Project Plugins/Android removed until Android integration (Android related code is not removed)

  • [Discuss] Configure UnityPath in Directory.Build.props for other development OSes. Currently only Windows. Add for possible paths MacOS. Previous approach in main branch regarding path setting didn't work for me

I'm on a mac and CI will be Linux so we need all 3. The path for macOS is on the deleted version of the file so you can pick from there (I made a comment).
We can also fallback to the non Unity Hub path as I used to do. Basically IIRC you just want to change where the Condition is added since you had problems with my approach, right?

  • [Discuss] Check package.json for what's missing or wrong (name, versions, etc)

Made some notes but generally LGTM. We can iterate on it.

  • [Discuss] Submodule sentry-dotnet is via https for now. It's hell to move the submodule around, wtf?, worst times. Spent too much time on that with cryptic git commands

I made a note on the review why it was relative. Ideally it'd stay relative for those reasons but we can discuss further the pros and cons.

I thought it threw from wintin the .NET SDK? We can go on with the work around for now but ideally we'd try for < before calling the API we know it'll blow up.

  • /samples/unity-of-bugs project. I checked all buttons and present the current behavior. I enabled debug mode from sentry window in order to see how logs are propagated. 'Capturing event' sends to sentry, 'Configuring the scope' not.

    • AssertFalse - Capturing event (sent to io.sentry)
    • ThrowNull - Capturing event (sent to io.sentry)
    • ThrowExceptionAndCatch - Configuring the scope (not sent to io.sentry),
    • ThrowNullAndCatch - Configuring the scope (not sent to io.sentry)
    • SendMessage - Configuring the scope (not sent to io.sentry)
    • ExceptionToString - Configuring the scope (not sent to io.sentry)
    • ThrowKotlinOnBackground - no Android support yet
    • ThorwKotlinOnBckround - no Android support yet
    • CrashNative - Capturing event (sent to io.sentry)
  • [Discuss] I didn't do any updates to README.md yet. I suggest to discuss it first.

Most (if not all) of those (except the Android ones) should work. Might be due to dropping link.xml.
There's no reason why SendMessage wouldn't work, it's the most basic thing the SDK can do.

Odd that the diff shows as all files are completely different and yet it's just a rename (most of the time) probably line breaks (do you commit /r/n?) but GitHub should be showing that:

image

@bruno-garcia
Copy link
Member

Now when we build the solution (Sentry.Unity.sln) it copies the dlls to the packages which was the original approach. The downside I see now is that this is "the published package". So we'll have pending changes each time during development. One advantage is that the code will be ready to use by anyone if they want to point to a commit hash through UPM so handy for hot fixes. But a bit annoying in terms or dev since we'll push a ton of DLLs all the time in each PR.

One alternative is that we have the compiled assemblies go into a different directory that will be on gitignore. And the package folder (which we give instructions to install) will only change during a "release", which will be building the whole project then moving the contents of the folder that's on gitignore into the packages folder.

What do you think?

@bruno-garcia
Copy link
Member

Oh I see I changed the unity-of-bugs to exclusively use the Debug.Log API so not sure why it's not working.

We can add some samples using SentrySdk.CaptureMessage and friends too.

@semuserable
Copy link
Contributor Author

semuserable commented Feb 8, 2021

Now when we build the solution (Sentry.Unity.sln) it copies the dlls to the packages which was the original approach. The downside I see now is that this is "the published package". So we'll have pending changes each time during development. One advantage is that the code will be ready to use by anyone if they want to point to a commit hash through UPM so handy for hot fixes. But a bit annoying in terms or dev since we'll push a ton of DLLs all the time in each PR.

One alternative is that we have the compiled assemblies go into a different directory that will be on gitignore. And the package folder (which we give instructions to install) will only change during a "release", which will be building the whole project then moving the contents of the folder that's on gitignore into the packages folder.

What do you think?

Current flow suggests that any change you made in src will be immediately available in sample project you use for testing (ie unity-of-bugs), because it references it directly.

I kinda agree that it's got "shared" by "dev" and "release" flows.

I guess we can create another folder in our structure and .gitignore it, but then we need to think about dev, release flow from build and references perspective.

Overall, we need to establish those first :)

My current suggestion:

  • /package/dev - testable from unity-of-bugs (dev)
  • /package/release - installable UPM (release)

Need to configure build process additionally, so libs are copied into the correct folder.

@semuserable
Copy link
Contributor Author

semuserable commented Feb 8, 2021

Basically IIRC you just want to change where the Condition is added since you had problems with my approach, right?

Hm, I found an issue.

Doesn't work on Win

<PropertyGroup>
    <UnityPath Condition="$(UnityPath) == '' AND Exists('C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed\UnityEngine.dll')">C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed</UnityPath>
</PropertyGroup>

Works on Win

<PropertyGroup>
    <UnityPath Condition="Exists('C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed\UnityEngine.dll')">C:\Program Files\Unity\Hub\Editor\$(UnityVersion)\Editor\Data\Managed</UnityPath>
</PropertyGroup>

So, the problem is with this key expand $(UnityPath) == ''.

@semuserable
Copy link
Contributor Author

I made a note on the review why it was relative. Ideally it'd stay relative for those reasons but we can discuss further the pros and cons.

Yes, I didn't get the "relative path approach" tbh. It's much easier to work with it "by default git commands".

@semuserable
Copy link
Contributor Author

I thought it threw from wintin the .NET SDK? We can go on with the work around for now but ideally we'd try for < before calling the API we know it'll blow up.

Nope, not from within SDK.

@semuserable
Copy link
Contributor Author

Oh I see I changed the unity-of-bugs to exclusively use the Debug.Log API so not sure why it's not working.

We can add some samples using SentrySdk.CaptureMessage and friends too.

Sure, let's discuss.

@semuserable
Copy link
Contributor Author

semuserable commented Feb 8, 2021

Odd that the diff shows as all files are completely different and yet it's just a rename (most of the time) probably line breaks (do you commit /r/n?)

Yes, by default it converts to /r/n, I'll change it to LF (Unix style).

@bruno-garcia
Copy link
Member

This can be closed now, right?

@bruno-garcia
Copy link
Member

Feel free to reopen otherwise

@semuserable
Copy link
Contributor Author

This can be closed now, right?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants