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-1785 DatadogEventBridge implemented #674

Merged

Conversation

buranmert
Copy link
Contributor

@buranmert buranmert commented Nov 26, 2021

What and why?

As part of WKWebView tracking, Datadog iOS SDK needs to communicate with Datadog Browser SDK.

How?

DatadogEventBridge is implemented as a mean of communication between those two platforms.
It receives messages from Browser SDK, parses them into JSON and forwards to corresponding WebEventConsumer (Log or RUM).

NOTE

Also, an extension of WKUserContentController is added in order to inject DatadogEventBridge into the WKWebView. However, I can't find a way to test this extension in unit tests. I tried webView.evaluateJavaScript(...) API to call JS methods within the webview, yet that didn't work in unit tests (although it works in Example app).
We may need to test this extension in integration tests.

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

@buranmert buranmert self-assigned this Nov 26, 2021
@buranmert buranmert marked this pull request as ready for review November 29, 2021 11:17
@buranmert buranmert requested a review from a team as a code owner November 29, 2021 11:17
@buranmert buranmert force-pushed the buranmert/RUMM-1785-DatadogEventBridge branch from f42703d to afd46de Compare November 29, 2021 11:24
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.

I left few questions, about the architecture plan (vs upcoming V2 efforts), threading and testing.

IMO this can't be single-threaded feature, as Browser events are equally complex to mobile events and we should process them on a background queue.

@buranmert buranmert requested a review from ncreated November 30, 2021 14:46

init(eventBridge: DatadogEventBridge) {
self.eventBridge = eventBridge
}
Copy link
Member

Choose a reason for hiding this comment

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

What will be the lifecycle of DatadogMessageHandler? As I understand, it will be created with public API similar to:

controller.addDatadogMessageHandler(allowedWebViewHosts: ["datadoghq.dev"])

and destroyed when? I'm trying to guess the lifecycle of underlying queue - assuming it will be destroyed when WebView disappears, it should be fine.

HostsSanitizer refactored out and shared
@buranmert buranmert requested a review from ncreated December 6, 2021 10:25
@buranmert buranmert merged commit 957b525 into feature/hybrid-application Dec 7, 2021
@buranmert buranmert deleted the buranmert/RUMM-1785-DatadogEventBridge branch December 7, 2021 10:32
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