-
Notifications
You must be signed in to change notification settings - Fork 135
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
RUM-3569 Store and filter resource ids between sessions #1747
RUM-3569 Store and filter resource ids between sessions #1747
Conversation
Datadog ReportBranch report: ❌ 1 Failed (0 Known Flaky), 2667 Passed, 0 Skipped, 5m 4.52s Wall Time ❌ Failed Tests (1)
🔻 Code Coverage Decreases vs Default Branch (8)
|
Datadog/Datadog.xcodeproj/xcshareddata/xcschemes/DatadogSessionReplay iOS.xcscheme
Outdated
Show resolved
Hide resolved
let resources = ResourcesFeature(core: core, configuration: configuration) | ||
try core.register(feature: resources) | ||
|
||
let sessionReplay = try SessionReplayFeature(core: core, configuration: configuration) | ||
try core.register(feature: sessionReplay) | ||
|
||
let resources = ResourcesFeature(core: core, configuration: configuration) | ||
try core.register(feature: resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly enough - this order matters. Since we use resources data store in session replay recorder it requires resources feature to be registered before.
Raises a question if it would make sense to add new function that registers array of features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be no longer the case after we switched from core
to dependency on FeatureScope
. Starting from #1744 Make FeatureScope always available, the FeatureScope
is always available, even before certain feature is registered 🧹.
@ReadWriteLock | ||
private var knownIdentifiers = Set<String>() { | ||
didSet { | ||
if let knownIdentifiers = knownIdentifiers.asData() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resources come in bulks per view tree capture. Because of that it felt good enough to update the data store on didSet
.
|
||
init( | ||
core: DatadogCoreProtocol | ||
core: DatadogCoreProtocol, | ||
dataStoreResetTime: TimeInterval = TimeInterval(30).days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's minimal effort on our side. Lowest possible SR retention is 30 days. With this, we enable gradual removal of unused image resources. Meaning that if backend clears stored images on their end every 30 days, we'll make sure to reupload only images that we see during the session.
} | ||
} | ||
|
||
enum Constants { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and below are internal
to be able to access them in tests (avoids reimplementing or retyping)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left few suggestions on DS usage and FeatureScope
integration 🙂
e42f6ca
to
0799040
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a remark on caching JSON coders, it looks good for DS
integration 👍.
let resources = ResourcesFeature(core: core, configuration: configuration) | ||
try core.register(feature: resources) | ||
|
||
let sessionReplay = try SessionReplayFeature(core: core, configuration: configuration) | ||
try core.register(feature: sessionReplay) | ||
|
||
let resources = ResourcesFeature(core: core, configuration: configuration) | ||
try core.register(feature: resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be no longer the case after we switched from core
to dependency on FeatureScope
. Starting from #1744 Make FeatureScope always available, the FeatureScope
is always available, even before certain feature is registered 🧹.
0799040
to
e2b5005
Compare
CHANGELOG.md
Outdated
|
||
* [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][] | ||
|
||
# 2.9.0 / 11-04-2024 | ||
|
||
* [IMPROVEMENT] Add image duplicate detection between sessions. See [#1747][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* [IMPROVEMENT] Add image duplicate detection between sessions. See [#1747][] |
What and why?
Adds a "between session" duplicate filtering of resources. This local store is wiped after hardcoded 30 days (standard SR retention), which was agreed with the backend in order to reupload images in regular cadence.
How?
Leverages new
DataStore
inside of theResourceWriter
and stores two values: set of known resource ids and store creation timestamp.Review checklist
Custom CI job configuration (optional)
tools/