-
Notifications
You must be signed in to change notification settings - Fork 136
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
RUM-984 fix: Drop WebView RUM events when mobile session is not sampled #1502
Conversation
527103a
to
62f02eb
Compare
Datadog ReportBranch report: ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, especially on tests side.
LGTM
@@ -11,7 +11,7 @@ import DatadogInternal | |||
@testable import DatadogCore | |||
|
|||
class InternalProxyTests: XCTestCase { | |||
let telemetry = TelemetryMock() | |||
let telemetry = TelemetryReceiverMock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference here? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TelemetryMock
was conforming to two distinct protocols: Telemetry
and FeatureMessageReceiver
. Both have different purpose, so it didn't make sense to have a single mock implementation. I made a split:
TelemetryMock: Telemetry
TelemetryReceiverMock: FeatureMessageReceiver
With no split, I almost ended up re-implementing this mock because it wasn't obvious at first glance how to spy core telemetry in tests.
@@ -6,6 +6,7 @@ | |||
|
|||
import Foundation | |||
import XCTest | |||
import TestUtilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice improvement moving these to TestUtilities! :)
74551a9
to
b304245
Compare
Datadog ReportBranch report: ✅ |
b304245
to
bac1cbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for re-working the tests 🙏
What and why?
📦 This PR fixes the problem of sampling being not respected for WebView events. With this change, if mobile RUM session is not sampled, all WebView events will be dropped. Previously, these events were sent with their original (web) session ID.
How?
No change to
DatadogWebViewTracking
.DatadogRUM
now checks if current session is sampled (determined by presence of"rum"
baggage inDatadogContext
):Changes to
DatadogRUMTests
:WebViewEventReceiverTests
was very low. I spent an extra time re-writting these tests to cover real behaviours instead of calling private method with "happy path" assumptions. It led to discovering RUM-1197 fix: WebView Events Overwrite #1500, which is also patched to this PR - more in this comment: RUM-984 fix: Drop WebView RUM events when mobile session is not sampled #1502 (review)"rum"
baggage is set inDatadogContext
"rum"
baggage is not set inDatadogContext
Review checklist
Custom CI job configuration (optional)
tools/