Skip to content

Commit 83c55fe

Browse files
authored
Merge pull request #3104 from DataDog/marroz/RUM-17867-fix-onSessionStart-call-order
RUM-17867: Fixes wrong order setting up session sampler and calling `onSessionStart`.
2 parents c436a9a + 66c66fd commit 83c55fe

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

33
- [FEATURE] Add support for UK1 Datadog Site. See [#3087][]
4+
- [FIX] onSessionStart is now called only after sampling information used by WebView Tracking is in place, avoiding missing traces in early requests. See [#3104][]
45

56
# 3.14.0 / 15-07-2026
67

@@ -1200,6 +1201,7 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
12001201
[#3019]: https://github.com/DataDog/dd-sdk-ios/pull/3019
12011202
[#3051]: https://github.com/DataDog/dd-sdk-ios/pull/3051
12021203
[#3087]: https://github.com/DataDog/dd-sdk-ios/pull/3087
1204+
[#3104]: https://github.com/DataDog/dd-sdk-ios/pull/3104
12031205

12041206
[@00fa9a]: https://github.com/00FA9A
12051207
[@britton-earnin]: https://github.com/Britton-Earnin

DatadogRUM/Sources/Feature/RUMFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ internal final class RUMFeature: DatadogRemoteFeature, RUMSessionSamplerProvider
111111
}()
112112

113113
let onSessionUpdate: RUM.SessionUpdater = { [onSessionStart = configuration.onSessionStart, _rumSessionSampler] sessionScope in
114+
_rumSessionSampler.mutate { $0 = sessionScope?.sampler }
114115
if let sessionScope {
115116
let sessionID = sessionScope.sessionUUID.toRUMDataFormat
116117
let isDiscarded = !sessionScope.sampler.isSampled
117118
onSessionStart?(sessionID, isDiscarded)
118119
}
119-
_rumSessionSampler.mutate { $0 = sessionScope?.sampler }
120120
}
121121

122122
let dependencies = RUMScopeDependencies(

0 commit comments

Comments
 (0)