Skip to content

RUM-7664: Add try-catch in drawOnCanvas in order to catch exceptions from draw(canvas) method#2549

Merged
aleksandr-gringauz merged 1 commit into
developfrom
gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2
Mar 18, 2025
Merged

RUM-7664: Add try-catch in drawOnCanvas in order to catch exceptions from draw(canvas) method#2549
aleksandr-gringauz merged 1 commit into
developfrom
gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2

Conversation

@aleksandr-gringauz

@aleksandr-gringauz aleksandr-gringauz commented Mar 17, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Sometimes Drawable.draw(canvas) can throw an AndroidRuntimeException when called not on the main thread. We catch this exception.

[internal]

For full investigation see the jira ticket https://datadoghq.atlassian.net/browse/RUM-7664?focusedCommentId=2227218

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@aleksandr-gringauz
aleksandr-gringauz force-pushed the gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2 branch from e42ae12 to 9056cfa Compare March 17, 2025 13:17
@codecov-commenter

codecov-commenter commented Mar 17, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.01%. Comparing base (55f0204) to head (97a2382).
Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2549      +/-   ##
===========================================
- Coverage    70.04%   70.01%   -0.03%     
===========================================
  Files          797      798       +1     
  Lines        30027    30036       +9     
  Branches      5027     5028       +1     
===========================================
- Hits         21031    21029       -2     
- Misses        7595     7605      +10     
- Partials      1401     1402       +1     
Files with missing lines Coverage Δ
...ndroid/sessionreplay/internal/utils/DrawableExt.kt 100.00% <100.00%> (ø)
...roid/sessionreplay/internal/utils/DrawableUtils.kt 95.89% <100.00%> (+0.51%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aleksandr-gringauz
aleksandr-gringauz marked this pull request as ready for review March 17, 2025 14:15
@aleksandr-gringauz
aleksandr-gringauz requested review from a team as code owners March 17, 2025 14:15
internalLogger.log(
InternalLogger.Level.ERROR,
listOf(InternalLogger.Target.TELEMETRY),
{ DRAWABLE_DRAW_FINISHED_WITH_ANDROID_RUNTIME_EXCEPTION },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will it be interesting to log the drawable type for further investigation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

jonathanmos
jonathanmos previously approved these changes Mar 17, 2025
ambushwork
ambushwork previously approved these changes Mar 17, 2025
0xnm
0xnm previously approved these changes Mar 18, 2025
} catch (exception: AndroidRuntimeException) {
internalLogger.log(
InternalLogger.Level.ERROR,
listOf(InternalLogger.Target.TELEMETRY),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

very nit: there is an overload which takes a single target

Suggested change
listOf(InternalLogger.Target.TELEMETRY),
InternalLogger.Target.TELEMETRY,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

jonathanmos
jonathanmos previously approved these changes Mar 18, 2025
@aleksandr-gringauz
aleksandr-gringauz dismissed stale reviews from jonathanmos and 0xnm via 73808cd March 18, 2025 08:55
@aleksandr-gringauz
aleksandr-gringauz force-pushed the gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2 branch from 73808cd to 4167754 Compare March 18, 2025 09:09
@aleksandr-gringauz
aleksandr-gringauz force-pushed the gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2 branch from 4167754 to 97a2382 Compare March 18, 2025 10:21
@aleksandr-gringauz
aleksandr-gringauz merged commit ceea3f6 into develop Mar 18, 2025
@aleksandr-gringauz
aleksandr-gringauz deleted the gringauz/rum-7664/try-fix-draw-uncaughtexception-in-session-replay-2 branch March 18, 2025 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.

5 participants