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

RUMM-2745 Decouple Webview Tracking #1086

Merged
merged 9 commits into from
Dec 20, 2022

Conversation

maxep
Copy link
Member

@maxep maxep commented Dec 12, 2022

What and why?

The web-view tracking no longer depends on the DatadogV1Context and will send raw logs and events through the message-bus.

The DatadogV1Context can now be removed as well as its dependencies:

  • CarrierInfoProvider
  • NetworConnectionInfoProvider
  • AppVersionProvider
  • DateCorrector

How?

The bridge used to inject native context in Browser events, this responsibility moves to the Feature message receiver. The WebEventBridge now send raw Browser events on the bus, the Log and RUM receiver will be able to inject current context (e.g ddTags, or RUM context) before writing it to core.

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
  • Run integration tests
  • Run smoke tests

@maxep maxep self-assigned this Dec 12, 2022
@maxep maxep requested a review from a team as a code owner December 12, 2022 17:08
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 12, 2022

Datadog Report

Branch report: maxep/RUMM-2745/decouple-webview-tracking
Commit report: 1eb15d1

dd-sdk-ios 0 Failed, 0 New Flaky, 58 Passed, 0 Skipped, 4.93s Wall Time

Comment on lines 31 to 36
internal final class GlobalRUMCommandSubscriber: RUMCommandSubscriber {
func process(command: RUMCommand) {
let subscriber = Global.rum as? RUMCommandSubscriber
subscriber?.process(command: command)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a fan of this, but it helps for injecting a RUMCommandSubscriber instance for testing. Ultimately, The Global.rum and this class will be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth documenting the usage and plan in the header comment?

internal typealias JSON = [String: Any]

/// Receiver to consume a RUM event coming from Browser SDK.
internal final class WebViewEventReceiver {
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic is migrated from WebRUMEventConsumer.

@maxep maxep force-pushed the maxep/RUMM-2745/any-codable-erasure branch 2 times, most recently from 907fda8 to 618ec72 Compare December 13, 2022 14:05
@maxep maxep force-pushed the maxep/RUMM-2745/decouple-webview-tracking branch from 4f2a1a1 to fad9c7b Compare December 13, 2022 14:25
@maxep maxep force-pushed the maxep/RUMM-2745/any-codable-erasure branch from 618ec72 to cf8c6ae Compare December 15, 2022 09:54
@maxep maxep force-pushed the maxep/RUMM-2745/decouple-webview-tracking branch from fad9c7b to fc17e83 Compare December 15, 2022 09:55
Base automatically changed from maxep/RUMM-2745/any-codable-erasure to develop December 16, 2022 11:22
Copy link
Member

@maciejburda maciejburda left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 31 to 36
internal final class GlobalRUMCommandSubscriber: RUMCommandSubscriber {
func process(command: RUMCommand) {
let subscriber = Global.rum as? RUMCommandSubscriber
subscriber?.process(command: command)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth documenting the usage and plan in the header comment?

Copy link
Member

@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 done 🎯. Happy to see remaining V1 context gone 💪 and the use of V2 things for further separation of Features.

Everything makes total sense 👍 and AnyCodable pays-off well. I left few minor comments, but approve it anyway.

/// `DatadogV1Context` can be safely captured during component initialization. It will never change during component's lifespan, meaning that:
/// - exposed static configuration won't change;
/// - bundled provider references won't change (although the value they provide will be different over time).
internal struct DatadogV1Context {
Copy link
Member

Choose a reason for hiding this comment

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

🍾 Great to see it gone 👋🙂.

@datadog-datadog-prod-us1
Copy link

Datadog Report

Branch report: maxep/RUMM-2745/decouple-webview-tracking
Commit report: 3283010

dd-sdk-ios 0 Failed, 0 New Flaky, 58 Passed, 0 Skipped, 5.33s Wall Time

@maxep maxep merged commit c478fe4 into develop Dec 20, 2022
@maxep maxep deleted the maxep/RUMM-2745/decouple-webview-tracking branch December 20, 2022 15:36
This was referenced Jan 18, 2023
@maxep maxep mentioned this pull request Jan 23, 2023
6 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.

3 participants