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

Dogfood recent changes #733

Merged
merged 60 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7cd13d4
RUMM-1649 Webview Tracking feature branch init commit
buranmert Nov 24, 2021
43a0a81
RUMM-1785 DatadogEventBridge implemented
buranmert Nov 26, 2021
afd46de
RUMM-1785 DatadogEventBridgeTests added
buranmert Nov 29, 2021
cdf0cce
RUMM-1785 PR comments addressed
buranmert Nov 30, 2021
4d7a40c
RUMM-1785 PR comments
buranmert Dec 6, 2021
957b525
Merge pull request #674 from DataDog/buranmert/RUMM-1785-DatadogEvent…
buranmert Dec 7, 2021
42d6a9e
RUMM-1791 WebRUMEventConsumer added
buranmert Dec 8, 2021
fd18fa7
RUMM-1791 WebLogEventConsumer added
buranmert Dec 10, 2021
aeab8c4
RUMM-1791 Offsets cache added to WebRUMEventConsumer
buranmert Dec 15, 2021
fc693d3
RUMM-1791 PR comments addressed
buranmert Dec 20, 2021
edc0413
RUMM-1791 PR comments addressed
buranmert Dec 22, 2021
5b03879
RUMM-1791 WebRUMEventConsumerTests added
buranmert Dec 23, 2021
e10f099
RUMM-1791 PR comments addressed
buranmert Dec 28, 2021
a05bc9a
RUMM-1791 WebRUMEvents manipulated as JSON
buranmert Dec 29, 2021
29bf40b
RUMM-1791 WebRUMEventConsumer made more flexible
buranmert Dec 30, 2021
c9be2e1
RUMM-1791 PR comments addressed
buranmert Dec 31, 2021
d69ac33
Merge pull request #683 from DataDog/buranmert/RUMM-1791-event-consumers
buranmert Jan 3, 2022
2308581
RUMM-1793 WebView events fire RUMWebViewCommand
buranmert Jan 4, 2022
a729555
RUMM-1793 PR comments addressed
buranmert Jan 5, 2022
317a090
Merge pull request #706 from DataDog/buranmert/RUMM-1793-RUMWebViewEv…
buranmert Jan 6, 2022
d2172ad
Update RUM Schema
fuzzybinary Jan 11, 2022
9411e48
RUMM-1904 source added to RUMEvents.common_schema
buranmert Jan 13, 2022
b5eedf0
RUMM-1796 Add crash reporting logs
maxep Jan 10, 2022
8e9a82b
RUMM-1796 Remove `userLogger` invocation from queue
maxep Jan 13, 2022
beeb9bb
Merge master into merge-from-master
buranmert Jan 13, 2022
930723a
Merge pull request #719 from DataDog/merge-from-master
buranmert Jan 14, 2022
9cf0651
RUMM-1649 WebRUMEvent date offset in Ms
buranmert Jan 13, 2022
ddd210b
Merge pull request #715 from DataDog/jward/RUMM-1900-flutter-error-so…
buranmert Jan 14, 2022
968f456
Merge pull request #718 from DataDog/buranmert/RUMM-1649-fix-webview-…
buranmert Jan 14, 2022
d688bae
RUMM-1796 Fix TSAN issues in `CrashReporter` tests
ncreated Jan 14, 2022
2a0c4ff
Merge master into buranmert/RUMM-1649-integration-tests
buranmert Jan 14, 2022
f15a4cf
Merge pull request #712 from DataDog/maxep/RUMM-1796/crash-reporting-…
maxep Jan 14, 2022
c90c2b1
Update to version 1.1.0 of testing framework
Jan 14, 2022
347ea1a
RUMM-1649 WebViewTracking integration test added
buranmert Jan 14, 2022
1d95970
RUMM-1649 PR comments addressed
buranmert Jan 14, 2022
744191c
Merge pull request #720 from DataDog/nachoBonafonte/update-to-testing…
Jan 17, 2022
da0d544
RUMM-1649 Disable Webviews tracking integration test in Crash Reporti…
ncreated Jan 17, 2022
8d3a40a
Merge pull request #722 from DataDog/ncreated/RUMM-1649-update-hybrid…
ncreated Jan 17, 2022
10fabe3
RUMM-1649 Allow `viewVisit.name` to be `nil` in `RUMSessionMatcher`
ncreated Jan 17, 2022
dda0851
RUMM-1649 Remove obsolete TODO
ncreated Jan 17, 2022
6c260e5
RUMM-1649 Add assertions to more properties and to logs
ncreated Jan 17, 2022
2f14fd4
RUMM-1924 Allow debugging any URL with WebViews Debugging feature
ncreated Jan 17, 2022
c6491bf
RUMM-1924 Fix date correction logic for WebView logs
ncreated Jan 17, 2022
d635cdf
RUMM-1883 Report binary image with no UUID
maxep Jan 18, 2022
1593ae7
RUMM-1649 Apply `resource.method` patch only to Browser SDK events, n…
ncreated Jan 18, 2022
8636d3b
Merge pull request #714 from DataDog/buranmert/RUMM-1649-integration-…
ncreated Jan 18, 2022
84bc17c
Merge pull request #723 from DataDog/ncreated/RUMM-1924-fix-bug-with-…
ncreated Jan 18, 2022
51969f2
RUMM-1925 Add `@service` attribute to all RUM events
ncreated Jan 18, 2022
11a5d21
RUMM-1926 Do not print warning when receiving 'keep alive' command wh…
ncreated Jan 18, 2022
85f9785
Merge pull request #724 from DataDog/maxep/RUMM-1883/report-invalid-i…
maxep Jan 19, 2022
7914271
Merge pull request #726 from DataDog/ncreated/RUMM-1926-fix-debugger-…
ncreated Jan 19, 2022
964f955
Merge pull request #725 from DataDog/ncreated/RUMM-1925-add-service-a…
ncreated Jan 19, 2022
6f71abe
RUMM-1911 Resolve remaining TODO as it references obsolete task
ncreated Jan 19, 2022
0a4a5a2
RUMM-1911 Condition WebViews tracking with `DD_SDK_ENABLE_EXPERIMENTA…
ncreated Jan 19, 2022
9cc0270
RUMM-1911 Rename public API for WebView tracking feature + add docs s…
ncreated Jan 19, 2022
0e80427
RUMM-1911 Add strictier assertion on `.source` attribute for Browser …
ncreated Jan 19, 2022
b0e30f9
Merge pull request #727 from DataDog/ncreated/RUMM-1911-prepare-webvi…
ncreated Jan 19, 2022
ba835f7
Merge pull request #729 from DataDog/feature/hybrid-application
ncreated Jan 19, 2022
973f30d
RUMM-1911 Fix compilation issue for Xcode 12.4
ncreated Jan 20, 2022
19d9cca
Merge pull request #732 from DataDog/ncreated/RUMM-1911-fix-webview-t…
ncreated Jan 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions Datadog/Datadog.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
value = "$(BITRISE_BUILD_URL)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDOUT_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDERR_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<CodeCoverageTargets>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@
value = "$(BITRISE_BUILD_URL)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDOUT_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDERR_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@
value = "$(GIT_CLONE_COMMIT_COMMITER_EMAIL)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDOUT_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDERR_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<CodeCoverageTargets>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@
value = "$(BITRISE_BUILD_URL)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDOUT_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_ENABLE_STDERR_INSTRUMENTATION"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<CodeCoverageTargets>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
value = "CrashReportingCollectOrSendWithLoggingScenario"
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "DD_TEST_SCENARIO_CLASS_NAME"
value = "WebViewTrackingScenario"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
Expand Down
12 changes: 8 additions & 4 deletions Datadog/Example/Debugging/DebugWebviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import UIKit
import Datadog
import WebKit
import Datadog

class DebugWebviewViewController: UIViewController {
@IBOutlet weak var rumServiceNameTextField: UITextField!
Expand Down Expand Up @@ -47,7 +47,7 @@ class DebugWebviewViewController: UIViewController {

private var webviewURL: String {
guard let text = webviewURLTextField.text, !text.isEmpty else {
return "https://www.datadoghq.com"
return "https://datadoghq.dev/browser-sdk-test-playground/webview.html"
}
return text
}
Expand Down Expand Up @@ -84,8 +84,12 @@ class WebviewViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let configuration = WKWebViewConfiguration()
webView = WKWebView(frame: UIScreen.main.bounds, configuration: configuration)
let controller = WKUserContentController()
controller.trackDatadogEvents(in: [request.url!.host!])
let config = WKWebViewConfiguration()
config.userContentController = controller

webView = WKWebView(frame: UIScreen.main.bounds, configuration: config)
view.addSubview(webView)
}

Expand Down
31 changes: 31 additions & 0 deletions Datadog/Example/Scenarios/WebView/WebViewScenarios.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

import UIKit
import Datadog

private struct WebViewTrackingScenarioPredicate: UIKitRUMViewsPredicate {
private let defaultPredicate = DefaultUIKitRUMViewsPredicate()

func rumView(for viewController: UIViewController) -> RUMView? {
if viewController is ShopistWebviewViewController {
return nil // do not consider the webview itself as RUM view
} else {
return defaultPredicate.rumView(for: viewController)
}
}
}

final class WebViewTrackingScenario: TestScenario {
static var storyboardName: String = "WebViewTrackingScenario"

func configureSDK(builder: Datadog.Configuration.Builder) {
_ = builder
.trackUIKitRUMViews(using: WebViewTrackingScenarioPredicate())
.enableLogging(true)
.enableRUM(true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

import UIKit
import WebKit
import Datadog

class WebViewTrackingFixtureViewController: UIViewController, WKNavigationDelegate {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// An action sent from native iOS SDK.
Global.rum.addUserAction(type: .custom, name: "Native action")

// Opens a webview configured to pass all its Browser SDK events to native iOS SDK.
show(ShopistWebviewViewController(), sender: nil)
}
}

class ShopistWebviewViewController: UIViewController {
private let request = URLRequest(url: URL(string: "https://shopist.io")!)
private var webView: WKWebView!

override func viewDidLoad() {
super.viewDidLoad()

let controller = WKUserContentController()
controller.trackDatadogEvents(in: ["shopist.io"])
let config = WKWebViewConfiguration()
config.userContentController = controller

webView = WKWebView(frame: UIScreen.main.bounds, configuration: config)
view.addSubview(webView)
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
webView.load(request)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Web View Tracking Fixture View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" customClass="WebViewTrackingFixtureViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="114" y="80"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,9 @@
},
"testTargets" : [
{
"skippedTests" : [
"IntegrationTests",
"LoggingScenarioTests",
"RUMManualInstrumentationScenarioTests",
"RUMMobileVitalsScenarioTests",
"RUMModalViewsScenarioTests",
"RUMNavigationControllerScenarioTests",
"RUMResourcesScenarioTests",
"RUMScrubbingScenarioTests",
"RUMSwiftUIScenarioTests",
"RUMTabBarControllerScenarioTests",
"RUMTapActionScenarioTests",
"TracingManualInstrumentationScenarioTests",
"TracingURLSessionScenarioTests",
"TrackingConsentScenarioTests"
"selectedTests" : [
"CrashReportingWithLoggingScenarioTests\/testCrashReportingCollectOrSendWithLoggingScenario()",
"CrashReportingWithRUMScenarioTests\/testCrashReportingCollectOrSendWithRUMScenario()"
],
"target" : {
"containerPath" : "container:Datadog.xcodeproj",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,68 @@
"id" : "D87CA41D-8EBB-4809-AC70-E3B8317FAAC7",
"name" : "TSAN",
"options" : {
"environmentVariableEntries" : [
{
"key" : "DD_TEST_RUNNER",
"value" : "$(DD_TEST_RUNNER)"
},
{
"key" : "DATADOG_CLIENT_TOKEN",
"value" : "$(DD_SDK_SWIFT_TESTING_CLIENT_TOKEN)"
},
{
"key" : "DD_ENV",
"value" : "$(DD_SDK_SWIFT_TESTING_ENV)"
},
{
"key" : "DD_SERVICE",
"value" : "$(DD_SDK_SWIFT_TESTING_SERVICE)"
},
{
"key" : "DD_DISABLE_SDKIOS_INTEGRATION",
"value" : "1"
},
{
"key" : "DD_DISABLE_HEADERS_INJECTION",
"value" : "1"
},
{
"key" : "DD_ENABLE_RECORD_PAYLOAD",
"value" : "1"
},
{
"key" : "SRCROOT",
"value" : "$(SRCROOT)"
},
{
"key" : "BITRISE_SOURCE_DIR",
"value" : "$(BITRISE_SOURCE_DIR)"
},
{
"key" : "BITRISE_TRIGGERED_WORKFLOW_ID",
"value" : "$(BITRISE_TRIGGERED_WORKFLOW_ID)"
},
{
"key" : "BITRISE_BUILD_SLUG",
"value" : "$(BITRISE_BUILD_SLUG)"
},
{
"key" : "BITRISE_BUILD_NUMBER",
"value" : "$(BITRISE_BUILD_NUMBER)"
},
{
"key" : "BITRISE_BUILD_URL",
"value" : "$(BITRISE_BUILD_URL)"
},
{
"key" : "DD_ENABLE_STDOUT_INSTRUMENTATION",
"value" : "1"
},
{
"key" : "DD_ENABLE_STDERR_INSTRUMENTATION",
"value" : "1"
}
],
"threadSanitizerEnabled" : true
}
}
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
all: dependencies xcodeproj-httpservermock templates

# The release version of `dd-sdk-swift-testing` to use for tests instrumentation.
DD_SDK_SWIFT_TESTING_VERSION = 1.0.3-beta.1
DD_SDK_SWIFT_TESTING_VERSION = 1.1.0

define DD_SDK_TESTING_XCCONFIG_CI
FRAMEWORK_SEARCH_PATHS=$$(inherited) $$(SRCROOT)/../instrumented-tests/DatadogSDKTesting.xcframework/ios-arm64_x86_64-simulator/\n
Expand All @@ -17,8 +17,9 @@ export DD_SDK_TESTING_XCCONFIG_CI
define DD_SDK_BASE_XCCONFIG
// Active compilation conditions - only enabled on local machine:\n
// - DD_SDK_ENABLE_INTERNAL_MONITORING - enables Internal Monitoring APIs\n
// - DD_SDK_ENABLE_EXPERIMENTAL_APIS - enables APIs which are not available in released version of the SDK\n
// - DD_SDK_COMPILED_FOR_TESTING - conditions the SDK code compiled for testing\n
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DD_SDK_ENABLE_INTERNAL_MONITORING DD_SDK_COMPILED_FOR_TESTING\n
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DD_SDK_ENABLE_INTERNAL_MONITORING DD_SDK_ENABLE_EXPERIMENTAL_APIS DD_SDK_COMPILED_FOR_TESTING\n
\n
// To build only active architecture for all configurations. This gives us ~10% build time gain\n
// in targets which do not use 'Debug' configuration.\n
Expand Down
Loading