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 #1814

Closed
wants to merge 80 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
4174d09
RUM-2816 WebView Record Receiver
maxep Feb 21, 2024
1f5b758
Update testUnsupportedView()-allowAll-privacy.png.json
maxep Mar 13, 2024
193975f
RUM-2816 Use corrected date
maxep Mar 21, 2024
0242681
RUM-2816 Apply rum view time offset
maxep Mar 21, 2024
e25a3bf
Merge pull request #1720 from DataDog/maxep/RUM-2816/web-view-sr-rece…
maxep Mar 26, 2024
819b4dd
RUM-2813 Add webview replay configuration
maxep Mar 29, 2024
d511735
Apply suggestions from code review
maxep Apr 9, 2024
92dc3b0
Apply suggestions from code review
maxep Apr 9, 2024
6c4d5d1
Merge pull request #1754 from DataDog/maxep/RUM-2813/sr-webview-privacy
maxep Apr 9, 2024
d524f2b
RUM-3531 WebView slot cache
maxep Mar 21, 2024
6eff630
RUM-3135 Build hidden webview wireframes
maxep Apr 5, 2024
62185d6
RUM-3531 Use NSHashTable as webview cache
maxep Apr 12, 2024
d4b1d4a
Merge pull request #1760 from DataDog/maxep/RUM-3531/hide-webview-wir…
maxep Apr 12, 2024
cc5692d
Merge branch 'develop' into feature/webview-replay
maxep Apr 15, 2024
aec536a
Fix feature scope conflict
maxep Apr 15, 2024
0134202
Update CHANGELOG.md
maxep Apr 15, 2024
ec3006f
Merge branch 'develop' into feature/webview-replay
maxep Apr 16, 2024
8a89706
RUM-3470 Support head-based trace sampling for local traces and autom…
ncreated Apr 17, 2024
c478274
Correct FPS for VisionOS
maciejburda Mar 1, 2024
bd29f61
Changes to support macOS logs
maciejburda Mar 1, 2024
f13329c
Clean up
maciejburda Mar 1, 2024
26385f1
Fix compilation issue on ios
maciejburda Mar 22, 2024
d4d5c99
Run linter
maciejburda Apr 2, 2024
f66af65
PR fixes
maciejburda Apr 2, 2024
7562259
Fix test
maciejburda Apr 2, 2024
6abffa1
RUM-4086 Synchronize SR info with webviews
maxep Apr 17, 2024
b5a4a51
PR Fixes
maciejburda Apr 18, 2024
687903b
Add smoke tests for macOS
maciejburda Apr 18, 2024
090d4a8
Remove failing test
maciejburda Apr 18, 2024
c0f09b2
RUM-3470 CR feedback - remove `tracerSampleRate` from HTTP header rea…
ncreated Apr 19, 2024
6ae18fd
PR fixes
maciejburda Apr 19, 2024
ec76086
Documentation update
maciejburda Apr 19, 2024
5d3a8dd
apply cr suggestions
maxep Apr 19, 2024
30ed013
Merge pull request #1784 from DataDog/maxep/RUM-4086/inject-has-repla…
maxep Apr 19, 2024
7ec152f
Apply suggestions from code review
maxep Apr 19, 2024
afa261c
Fix deployment target on SPM project
maciejburda Apr 19, 2024
f768267
RUM-3134 attach vc to window
maxep Apr 19, 2024
7b094e8
PR fixes
maciejburda Apr 22, 2024
c452a2d
Merge pull request #1783 from DataDog/ncreated/RUM-3470/head-based-sa…
ncreated Apr 22, 2024
39d5755
Revert nil interface
maciejburda Apr 22, 2024
c08e66b
Update dependency-manager-tests/spm/Shared/DatadogSetup.swift
maciejburda Apr 23, 2024
ad97879
Update apiSurface files for Swift and Objective-C
0xnm Apr 24, 2024
d8c2f2b
RUM-3470 Support head-based sampling for manual distributed traces
ncreated Apr 24, 2024
0387e08
Merge pull request #1792 from DataDog/nogorodnikov/update-api-surface…
0xnm Apr 24, 2024
79943d3
Merge pull request #1711 from DataDog/maciey/innovation-week-changes
maciejburda Apr 24, 2024
0930c24
Merge branch 'develop' into feature/webview-replay
maxep Apr 25, 2024
713dd0e
RUM-3470 CR feedback - rename new sampling strategy to `.headBased`
ncreated Apr 25, 2024
a662ad1
RUM-3470 CR feedback - add Objective-C API for `TraceSamplingStrategy`
ncreated Apr 25, 2024
8ec55a4
RUM-3470 Fix - use replacement API in tests
ncreated Apr 25, 2024
7afd568
RUM-3574 Start sending batches immediately after feature is initialized
ncreated Apr 25, 2024
c090d4b
RUM-3574 Fix background tasks tests for `DataUploadWorker`
ncreated Apr 25, 2024
cdd181f
Merge pull request #1793 from DataDog/ncreated/RUM-3470/head-based-sa…
ncreated Apr 26, 2024
c46b9df
Merge pull request #1776 from DataDog/feature/webview-replay
maxep Apr 26, 2024
066c2f9
Merge pull request #1785 from DataDog/maxep/RUM-3134/fix-sr-test
maxep Apr 26, 2024
a1fd4b2
Merge branch 'develop' into ncreated/RUM-3470/head-based-sampling
ncreated Apr 26, 2024
353dbec
RUM-3470 Update `CHANGELOG.md`
ncreated Apr 26, 2024
4506efa
Merge pull request #1794 from DataDog/ncreated/RUM-3470/head-based-sa…
ncreated Apr 26, 2024
02aff38
Fix nightly tests build failure
ncreated Apr 26, 2024
bd6d31b
Merge pull request #1802 from DataDog/ncreated/chore/fix-ci-build-aft…
ncreated Apr 26, 2024
30d8fdc
Add addUserExtraInfo to ObjC API
0xnm Apr 26, 2024
0134ce1
Merge pull request #1799 from DataDog/nogorodnikov/add-addExtraUserIn…
0xnm Apr 29, 2024
169d46f
Add isInitialized and stopInstance methods to ObjC API
0xnm Apr 26, 2024
cbce083
Add DatadogSessionReplay to the Swift API surface generation
0xnm Apr 29, 2024
81e8103
Merge pull request #1800 from DataDog/nogorodnikov/add-stopinstance-a…
0xnm Apr 29, 2024
d38c1cd
Merge pull request #1804 from DataDog/nogorodnikov/add-session-replay…
0xnm Apr 29, 2024
f1ebc3b
RUM-4310: Add Configuration#additionalConfiguration property to ObjC API
0xnm Apr 30, 2024
258d9ff
Merge pull request #1806 from DataDog/nogorodnikov/rum-4310/add-addit…
0xnm Apr 30, 2024
e1de90c
GH-1797 fix: use trace and span id as decimal
ganeshnj Apr 30, 2024
c43214d
update changelog
ganeshnj Apr 30, 2024
318828a
fix integration tests
ganeshnj Apr 30, 2024
ad20f2d
Merge pull request #1807 from DataDog/ganeshnj/fix/GH-1797-dd-id-format
ganeshnj May 2, 2024
57f3237
chore: various fixes to build with SPI
ganeshnj May 3, 2024
b19f4aa
invert if-def
ganeshnj May 6, 2024
b940df1
Merge branch 'develop' into ncreated/RUM-3574/start-sending-batches-o…
ncreated May 6, 2024
1f60725
Fix CHANGELOG.md
ncreated May 6, 2024
31d0eb0
invert if-def
ganeshnj May 6, 2024
4530d0d
Merge pull request #1812 from DataDog/ganeshnj/chore/spi-fixes
ganeshnj May 7, 2024
0a9bfae
Merge pull request #1798 from DataDog/ncreated/RUM-3574/start-sending…
ncreated May 7, 2024
a27befc
chore: add badges for SPI and CP
ganeshnj May 7, 2024
440c890
Merge pull request #1820 from DataDog/ganeshnj/chore/badges
ganeshnj May 7, 2024
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
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Unreleased

- [IMPROVEMENT] Start sending data immediately after SDK is initialized. See [#1798][]
- [FEATURE] `DatadogTrace` now supports head-based sampling. See [#1794][]
- [FEATURE] Support WebView recording in Session Replay. See [#1776][]
- [IMPROVEMENT] Add `isInitialized` and `stopInstance` methods to ObjC API. See [#1800][]
- [IMPROVEMENT] Add `addUserExtraInfo` method to ObjC API. See [#1799][]
- [FIX] Use trace and span id as decimal. See [#1807][]

# 2.10.0 / 23-04-2024

- [IMPROVEMENT] Add image duplicate detection between sessions. See [#1747][]
- [FEATURE] Add support for 128 bit trace IDs. See [#1721][]
- [FEATURE] Fatal App Hangs are tracked in RUM. See [#1763][]
- [FIX] Avoid name collision with Required Reason APIs. See [#1774][]
- [IMPROVEMENT] Make the SDK compile on macOS 12+. See [#1711][]

# 2.9.0 / 11-04-2024

Expand Down Expand Up @@ -629,16 +637,21 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
[#1696]: https://github.com/DataDog/dd-sdk-ios/pull/1696
[#1697]: https://github.com/DataDog/dd-sdk-ios/pull/1697
[#1707]: https://github.com/DataDog/dd-sdk-ios/pull/1707
[#1711]: https://github.com/DataDog/dd-sdk-ios/pull/1711
[#1721]: https://github.com/DataDog/dd-sdk-ios/pull/1721
[#1722]: https://github.com/DataDog/dd-sdk-ios/pull/1722
[#1724]: https://github.com/DataDog/dd-sdk-ios/pull/1724
[#1741]: https://github.com/DataDog/dd-sdk-ios/pull/1741
[#1742]: https://github.com/DataDog/dd-sdk-ios/pull/1742
[#1746]: https://github.com/DataDog/dd-sdk-ios/pull/1746
[#1747]: https://github.com/DataDog/dd-sdk-ios/pull/1747
[#1794]: https://github.com/DataDog/dd-sdk-ios/pull/1794
[#1774]: https://github.com/DataDog/dd-sdk-ios/pull/1774
[#1763]: https://github.com/DataDog/dd-sdk-ios/pull/1763
[#1767]: https://github.com/DataDog/dd-sdk-ios/pull/1767
[#1721]: https://github.com/DataDog/dd-sdk-ios/pull/1721
[#1747]: https://github.com/DataDog/dd-sdk-ios/pull/1747
[#1798]: https://github.com/DataDog/dd-sdk-ios/pull/1798
[#1776]: https://github.com/DataDog/dd-sdk-ios/pull/1776
[#1807]: https://github.com/DataDog/dd-sdk-ios/pull/1807
[@00fa9a]: https://github.com/00FA9A
[@britton-earnin]: https://github.com/Britton-Earnin
[@hengyu]: https://github.com/Hengyu
Expand Down
70 changes: 63 additions & 7 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 @@ -198,22 +198,16 @@
</BuildableReference>
<SkippedTests>
<Test
Identifier = "HeadBasedSamplingTests/testSamplingLocalTrace()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent_throughTracerAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSamplingLocalTraceWithImplicitParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent_throughURLSessionInstrumentationAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent_throughTracerAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithNoParent()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent_throughURLSessionInstrumentationAPI()">
</Test>
</SkippedTests>
</TestableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,22 @@
</BuildableReference>
<SkippedTests>
<Test
Identifier = "HeadBasedSamplingTests/testSamplingLocalTrace()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent_throughTracerAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSamplingLocalTraceWithImplicitParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent_throughURLSessionInstrumentationAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithNoParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent_throughTracerAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent()">
Identifier = "HeadBasedSamplingTests/testSendingDroppedDistributedTraceWithParent_throughURLSessionInstrumentationAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithNoParent()">
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithNoParent_throughTracerAPI()">
</Test>
<Test
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithParent()">
Identifier = "HeadBasedSamplingTests/testSendingSampledDistributedTraceWithParent_throughTracerAPI()">
</Test>
</SkippedTests>
</TestableReference>
Expand Down Expand Up @@ -232,11 +232,6 @@
BlueprintName = "DatadogTraceTests tvOS"
ReferencedContainer = "container:Datadog.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "DatadogTracer_SamplingTests/testWhenRootSpanIsSampled_thenAllChildSpansMustBeSampledTheSameWay()">
</Test>
</SkippedTests>
</TestableReference>
<TestableReference
skipped = "NO">
Expand Down
2 changes: 1 addition & 1 deletion Datadog/E2ETests/Tracing/TracerE2ETests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TracerE2ETests: E2ETests {
/// ```
func test_trace_tracer_inject_span_context() {
let anySpan = tracer.startSpan(operationName: .mockRandom()) // this span is never sent
let anyWriter = HTTPHeadersWriter()
let anyWriter = HTTPHeadersWriter(samplingStrategy: .custom(sampleRate: 20))

measure(resourceName: DD.PerfSpanName.fromCurrentMethodName()) {
tracer.inject(spanContext: anySpan.context, writer: anyWriter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,19 @@ internal struct DebugManualTraceInjectionView: View {

switch selectedTraceHeaderType {
case .datadog:
let writer = HTTPHeadersWriter(sampleRate: sampleRate)
let writer = HTTPHeadersWriter(samplingStrategy: .custom(sampleRate: sampleRate))
Tracer.shared().inject(spanContext: span.context, writer: writer)
writer.traceHeaderFields.forEach { request.setValue($0.value, forHTTPHeaderField: $0.key) }
case .w3c:
let writer = W3CHTTPHeadersWriter(
sampleRate: sampleRate,
tracestate: [:]
)
let writer = W3CHTTPHeadersWriter(samplingStrategy: .custom(sampleRate: sampleRate), tracestate: [:])
Tracer.shared().inject(spanContext: span.context, writer: writer)
writer.traceHeaderFields.forEach { request.setValue($0.value, forHTTPHeaderField: $0.key) }
case .b3Single:
let writer = B3HTTPHeadersWriter(sampleRate: sampleRate, injectEncoding: .single)
let writer = B3HTTPHeadersWriter(samplingStrategy: .custom(sampleRate: sampleRate), injectEncoding: .single)
Tracer.shared().inject(spanContext: span.context, writer: writer)
writer.traceHeaderFields.forEach { request.setValue($0.value, forHTTPHeaderField: $0.key) }
case .b3Multiple:
let writer = B3HTTPHeadersWriter(sampleRate: sampleRate, injectEncoding: .multiple)
let writer = B3HTTPHeadersWriter(samplingStrategy: .custom(sampleRate: sampleRate), injectEncoding: .multiple)
Tracer.shared().inject(spanContext: span.context, writer: writer)
writer.traceHeaderFields.forEach { request.setValue($0.value, forHTTPHeaderField: $0.key) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class WebEventIntegrationTests: XCTestCase {
"service": "super",
"session": {
"id": "0110cab4-7471-480e-aa4e-7ce039ced355",
"type": "user"
"type": "user",
"has_replay": true
},
"type": "view",
"view": {
Expand Down Expand Up @@ -90,14 +91,16 @@ class WebEventIntegrationTests: XCTestCase {
"count": 3
},
"time_spent": 3120000000,
"url": "http://localhost:8080/test.html"
"url": "http://localhost:8080/test.html",
},
"_dd": {
"document_version": 2,
"drift": 0,
"format_version": 2,
"session": {
"plan": 2
"replay_stats": {
"records_count": 10,
"segments_count": 1,
"segments_total_raw_size": 10
}
}
},
Expand Down Expand Up @@ -159,10 +162,7 @@ class WebEventIntegrationTests: XCTestCase {
"_dd": {
"document_version": 2,
"drift": 0,
"format_version": 2,
"session": {
"plan": 1
}
"format_version": 2
}
}
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* 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-Present Datadog, Inc.
*/

import XCTest
#if !os(tvOS)
import WebKit

import TestUtilities
@testable import DatadogRUM
@testable import DatadogWebViewTracking
@_spi(Internal) @testable import DatadogSessionReplay

class WebRecordIntegrationTests: XCTestCase {
// swiftlint:disable implicitly_unwrapped_optional
private var core: DatadogCoreProxy! // swiftlint:disable:this implicitly_unwrapped_optional
private var controller: WKUserContentControllerMock!
// swiftlint:enable implicitly_unwrapped_optional

override func setUp() {
core = DatadogCoreProxy(
context: .mockWith(
env: "test",
version: "1.1.1",
serverTimeOffset: 123
)
)

controller = WKUserContentControllerMock()
let configuration = WKWebViewConfiguration()
configuration.userContentController = controller
let webView = WKWebView(frame: .zero, configuration: configuration)
WebViewTracking.enable(webView: webView, in: core)
}

override func tearDown() {
core.flushAndTearDown()
core = nil
controller = nil
}

func testWebRecordIntegration() throws {
// Given
let webView = WKWebView()
let randomApplicationID: String = .mockRandom()
let randomUUID: UUID = .mockRandom()
let randomBrowserViewID: UUID = .mockRandom()

SessionReplay.enable(with: SessionReplay.Configuration(replaySampleRate: 100), in: core)
RUM.enable(with: .mockWith(applicationID: randomApplicationID) {
$0.uuidGenerator = RUMUUIDGeneratorMock(uuid: randomUUID)
}, in: core)

let body = """
{
"eventType": "record",
"event": {
"timestamp" : \(1635932927012),
"type": 2
},
"view": { "id": "\(randomBrowserViewID.uuidString.lowercased())" }
}
"""

// When
RUMMonitor.shared(in: core).startView(key: "web-view")
controller.send(body: body, from: webView)
controller.flush()

// Then
let segments = try core.waitAndReturnEventsData(ofFeature: SessionReplayFeature.name)
.map { try SegmentJSON($0, source: .ios) }
let segment = try XCTUnwrap(segments.first)

let expectedUUID = randomUUID.uuidString.lowercased()
let expectedSlotID = String(webView.hash)

XCTAssertEqual(segment.applicationID, randomApplicationID)
XCTAssertEqual(segment.sessionID, expectedUUID)
XCTAssertEqual(segment.viewID, randomBrowserViewID.uuidString.lowercased())

let record = try XCTUnwrap(segment.records.first)
DDAssertDictionariesEqual(record, [
"timestamp": 1_635_932_927_012 + 123.toInt64Milliseconds,
"type": 2,
"slotId": expectedSlotID
])
}
}

#endif
Loading