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

Add API allowing to check if captured event is ANR error #581

Merged
merged 10 commits into from
Jun 27, 2024

Conversation

tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Jun 18, 2024

This PR adds a new method to USentryEvent which allows checking if the captured event is an ANR error. By default, ANR error tracking is turned off in plugin settings.

Note, that ANR error tracking works only on Android/Apple since sentry-native doesn't support it at the moment.

Closes #574

Copy link
Contributor

github-actions bot commented Jun 18, 2024

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

Generated by 🚫 dangerJS against 7263b2e

@@ -54,3 +54,8 @@ bool SentryEventAndroid::IsCrash() const
{
return CallMethod<bool>(IsCrashMethod);
}

bool SentryEventAndroid::IsAppNotResponding() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool SentryEventAndroid::IsAppNotResponding() const
bool SentryEventAndroid::IsAnr() const

We're using the abbrevation everywhere else.

@@ -19,6 +19,7 @@ class SentryEventAndroid : public ISentryEvent, public FSentryJavaObjectWrapper
virtual void SetLevel(ESentryLevel level) override;
virtual ESentryLevel GetLevel() const override;
virtual bool IsCrash() const override;
virtual bool IsAppNotResponding() const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
virtual bool IsAppNotResponding() const override;
virtual bool IsAnr() const override;

@@ -54,3 +54,21 @@ bool SentryEventApple::IsCrash() const
{
return EventApple.error != nullptr;
}

bool SentryEventApple::IsAppNotResponding() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool SentryEventApple::IsAppNotResponding() const
bool SentryEventApple::IsAnr() const

@@ -20,6 +20,7 @@ class SentryEventApple : public ISentryEvent
virtual void SetLevel(ESentryLevel level) override;
virtual ESentryLevel GetLevel() const override;
virtual bool IsCrash() const override;
virtual bool IsAppNotResponding() const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
virtual bool IsAppNotResponding() const override;
virtual bool IsAnr() const override;

@@ -60,4 +60,10 @@ bool SentryEventDesktop::IsCrash() const
return IsCrashEvent;
}

bool SentryEventDesktop::IsAppNotResponding() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool SentryEventDesktop::IsAppNotResponding() const
bool SentryEventDesktop::IsAnr() const

@@ -16,4 +16,5 @@ class ISentryEvent
virtual void SetLevel(ESentryLevel level) = 0;
virtual ESentryLevel GetLevel() const = 0;
virtual bool IsCrash() const = 0;
virtual bool IsAppNotResponding() const = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
virtual bool IsAppNotResponding() const = 0;
virtual bool IsAnr() const = 0;

@@ -80,6 +80,14 @@ bool USentryEvent::IsCrash() const
return EventNativeImpl->IsCrash();
}

bool USentryEvent::IsAppNotResponding() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool USentryEvent::IsAppNotResponding() const
bool USentryEvent::IsAnr() const

if(!EventNativeImpl)
return false;

return EventNativeImpl->IsAppNotResponding();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return EventNativeImpl->IsAppNotResponding();
return EventNativeImpl->IsAnr();

@@ -2,6 +2,10 @@

## Unreleased

### Features

- Add API allowing to check if captured event is ANR error ([#581](https://github.com/getsentry/sentry-unreal/pull/581))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Add API allowing to check if captured event is ANR error ([#581](https://github.com/getsentry/sentry-unreal/pull/581))
- Added `IsAnr()` method to mobile `SentryEvents` to check if the event is caused by the Application Not Responding ([#581](https://github.com/getsentry/sentry-unreal/pull/581))

@@ -48,6 +48,10 @@ class SENTRY_API USentryEvent : public UObject
UFUNCTION(BlueprintPure, Category = "Sentry")
bool IsCrash() const;

/** Gets flag indicating whether the event is an Application Not Responding (ANR) error. */
UFUNCTION(BlueprintPure, Category = "Sentry")
bool IsAppNotResponding() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like it's nice having it written out in the blueprints?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can add a meta=(DisplayName="Is App Not Responding") attribute for UFUNCTION here in order to display the full name in blueprints while still having IsAnr in C++ as everywhere else. Does that sound good?

Copy link
Contributor

Choose a reason for hiding this comment

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

That'd be great!

@tustanivsky tustanivsky merged commit e26f8d4 into main Jun 27, 2024
16 checks passed
@tustanivsky tustanivsky deleted the feat/anr-error branch June 27, 2024 13:18
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.

Expose more sentry types to Unreal or expose an delegate for listening ANR
2 participants