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

feat: WebGL - dotnet support #657

Merged
merged 40 commits into from
Apr 19, 2022
Merged

feat: WebGL - dotnet support #657

merged 40 commits into from
Apr 19, 2022

Conversation

vaind
Copy link
Collaborator

@vaind vaind commented Mar 22, 2022

Approaches

I've gone through multiple iterations/alternative approaches. You can see them in previous commits:

MVP TODOs

Future PRs

  • Capture Javascript & native errors - WebGL JavaScript & native error handling #668
  • warn/error out during build when "com.unity.modules.unitywebrequest": "1.0.0" package is disabled - otherwise Unity just throws a vague error: Cannot create web request without initializing the system that I couldn't get any useful resolution for by googling - requires editor build script so could be also part of WebGL JavaScript & native error handling #668 which brings that.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 22, 2022

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 9f82cd5

This was referenced Mar 22, 2022
@vaind vaind changed the title feat: WebGL - basic support feat: WebGL - dotnet error support Mar 25, 2022
@vaind vaind changed the title feat: WebGL - dotnet error support feat: WebGL - dotnet support Mar 25, 2022
src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/WebGL/SentryWebGL.cs Outdated Show resolved Hide resolved
@mattjohnsonpint
Copy link
Contributor

@vaind - Please try layering on top of the changes I made with getsentry/sentry-dotnet#1560 and let me know if you have any pain points. I think it should let your code be much cleaner. Thanks.

@vaind vaind force-pushed the feat/webgl branch 2 times, most recently from e9f9faf to 5a15262 Compare March 31, 2022 10:08
@vaind vaind force-pushed the feat/webgl branch 5 times, most recently from edd5d89 to db050d4 Compare April 13, 2022 11:44
Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

This is awesome! :shipit:

I left some notes for and nits for reference

Directory.Build.targets Outdated Show resolved Hide resolved
samples/unity-of-bugs/Assets/Scripts/SmokeTester.cs Outdated Show resolved Hide resolved

public bool EnqueueEnvelope(Envelope envelope)
{
_ = _behaviour.StartCoroutine(_transport.SendEnvelopeAsync(envelope));
Copy link
Member

Choose a reason for hiding this comment

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

It's possible that we'll need some form of back pressure in a follow up PR.
If we capture events in a tight loop, would this negatively affect performance?
In other SDKs (I believe the JavaScript SDK does this) we cap the number of futures we spawn to a number by tracking how many async operations are in-flight. In the .NET SDK it's done through the background worker, but here we could have a counter and only start a new coroutine if less than N are currently running

public int QueuedItems { get; }
}

internal class UnityWebRequestTransport : HttpTransportBase
Copy link
Member

Choose a reason for hiding this comment

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

Even though it's not the goal of this PR. this transport has the potential to unblock usages outside WebGL. Mainly Console platforms. We can refactor things out to be reused later, so that perhaps a selected number of platforms. Possibly even: Anything that's not desktop and mobile

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's why I've moved it to a separate file in the Sentry.Unity csproj - should be a good starting point without major git-diffs when we want to use for another platform.

src/Sentry.Unity/UnityWebRequestTransport.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/UnityWebRequestTransport.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/UnityWebRequestTransport.cs Outdated Show resolved Hide resolved
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@galenmolk
Copy link

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.

I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

@vaind
Copy link
Collaborator Author

vaind commented Jul 22, 2022

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.

I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

Glad you find it useful. It should work on standard versions as for the rest of the SDK, i.e. 2019, 2020, 2021 at the moment. We're testing WebGL specifically in our integration test CI on those.

@galenmolk
Copy link

Hi @vaind ! Thank you for your work on WebGL support for this SDK. We're Sentry customers utilizing the tool on other platforms, so we're excited to be able to use it for WebGL too.
I had a quick question: as far as you know, are there Unity Editor version minimums for Sentry Unity <> WebGL compatibility?

Glad you find it useful. It should work on standard versions as for the rest of the SDK, i.e. 2019, 2020, 2021 at the moment. We're testing WebGL specifically in our integration test CI on those.

Thanks for getting back to me so fast. Sounds good!

@jfbloom22
Copy link

Awesome work! So glad to have WebGL dotnet support!

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