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: Allow crash reporting to use event mappers #1742

Merged
merged 5 commits into from Mar 29, 2024

Conversation

fuzzybinary
Copy link
Contributor

What and why?

CrashReportReceiver now supports calling both the view and event mapper before writing the crash to storage.

refs: RUM-2206

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests for Core, RUM, Trace, Logs, CR and WVT
  • Run unit tests for Session Replay
  • Run integration tests
  • Run smoke tests
  • Run tests for tools/

@fuzzybinary fuzzybinary marked this pull request as ready for review March 21, 2024 18:27
@fuzzybinary fuzzybinary requested review from a team as code owners March 21, 2024 18:27
CrashReportReceiver now supports calling both the view and event mapper before writing the crash to storage.

refs: RUM-2206
@fuzzybinary fuzzybinary force-pushed the jward/RUM-2206-rum-crash-event-mappers branch from f2f8e9a to 0adfeb2 Compare March 25, 2024 20:38
ncreated
ncreated previously approved these changes Mar 26, 2024
Copy link
Collaborator

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Looks great 👍. I left one suggestion, non-blocking. LMK what we decide on the possibility of dropping crashes from mapper.

Also, please update CHANGELOG.md 🙏

This is partially to prevent users from accidentally dropping fatal errors in their mappers, and partially to be consistent with Android.
@fuzzybinary fuzzybinary force-pushed the jward/RUM-2206-rum-crash-event-mappers branch from d72d7db to 5b60c64 Compare March 27, 2024 13:39
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Mar 27, 2024

Datadog Report

Branch report: jward/RUM-2206-rum-crash-event-mappers
Commit report: 7d0ee48
Test service: dd-sdk-ios

✅ 0 Failed, 2699 Passed, 0 Skipped, 22m 51.24s Wall Time
🔻 Test Sessions change in coverage: 12 decreased, 2 increased

🔻 Code Coverage Decreases vs Default Branch (12)

This report shows up to 5 code coverage decreases.

  • test DatadogInternalTests iOS 79.08% (-0.67%) - Details
  • test DatadogInternalTests tvOS 79.06% (-0.65%) - Details
  • test DatadogTraceTests iOS 49.04% (-0.59%) - Details
  • test DatadogRUMTests iOS 79.22% (-0.49%) - Details
  • test DatadogTraceTests tvOS 49.26% (-0.48%) - Details

ncreated
ncreated previously approved these changes Mar 27, 2024
Copy link
Collaborator

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

🎯 Well integrated 🔗. I left two minor comments.

Comment on lines +3 to 4
* [FEATURE] Call RUM's `errorEventMapper` for crashes.
* [FEATURE] Support calling log event mapper for crashes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit/ Let's add PR references to both to be consistent with the rest of this file. It helps when generating release notes and later when tracking changes.

Comment on lines 206 to 211
writer.write(value: rumError)
if let mappedError = self.eventsMapper.map(event: rumError) {
writer.write(value: mappedError)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

question/ Why do we allow dropping crash in this mapper call? Seems inconsistent with the next crash write in this file. Is it because in this case it goes without corresponding view event? If it's on purpose, I think it may make sense to add code comment on this decision.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it's not on purpose. I'll make sure the test covers this and fix.

ncreated
ncreated previously approved these changes Mar 28, 2024
Copy link
Collaborator

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

@fuzzybinary I updated this branch with git conflicts resolution after my merge of #1750. It should be all fine now 👍.

The notable change is that from #1750 all RUM components (including CrashReportReceiver) depend on FeatureScope instead of DatadogCoreProtocol. That removes the use of PassthroughCoreMock in all RUM unit tests, replacing them with simpler FeatureScopeMock. This achieves goals outlined in #1744

# Conflicts:
#	DatadogCore/Tests/Datadog/Mocks/RUMFeatureMocks.swift
#	DatadogRUM/Sources/Feature/RUMFeature.swift
#	DatadogRUM/Sources/Integrations/CrashReportReceiver.swift
#	DatadogRUM/Tests/Mocks/RUMFeatureMocks.swift
@ncreated ncreated force-pushed the jward/RUM-2206-rum-crash-event-mappers branch from 7a401aa to 2d5d2d2 Compare March 28, 2024 08:23
ncreated
ncreated previously approved these changes Mar 28, 2024
receiver.receive(message: .baggage(
key: MessageBusSender.MessageKeys.crash,
value: MessageBusSender.Crash(report: crashReport, context: crashContext)
), from: core)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't compile. With my latest changes on develop, we should now test against FeatureScopeMock not the core. See surrounding tests in this file, I updated them this morning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, sorry, pulled and rebased and didn't see any conflicts so assumed it was good. Fixed now.

@fuzzybinary fuzzybinary force-pushed the jward/RUM-2206-rum-crash-event-mappers branch from faf4c70 to 7d0ee48 Compare March 28, 2024 18:12
@fuzzybinary fuzzybinary merged commit 478a7a4 into develop Mar 29, 2024
8 checks passed
@fuzzybinary fuzzybinary deleted the jward/RUM-2206-rum-crash-event-mappers branch March 29, 2024 13:21
@ncreated ncreated mentioned this pull request Apr 4, 2024
8 tasks
@maxep maxep mentioned this pull request Apr 10, 2024
8 tasks
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.

None yet

2 participants