-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat: Add extension for Data to track file I/O operations with Sentry #4862
base: main
Are you sure you want to change the base?
Conversation
|
e4c8331
to
24113a9
Compare
24113a9
to
beac2cc
Compare
dfce878
to
489ae5c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4862 +/- ##
=============================================
- Coverage 92.369% 92.290% -0.080%
=============================================
Files 659 661 +2
Lines 77548 77747 +199
Branches 28079 28010 -69
=============================================
+ Hits 71631 71753 +122
- Misses 5821 5901 +80
+ Partials 96 93 -3
... and 62 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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 found a few issues, but this is going to a great feature 💪
Sources/Swift/Integrations/Performance/IO/Data+SentryTracing.swift
Outdated
Show resolved
Hide resolved
Tests/SentryTests/Integrations/Performance/IO/DataSentryTracingIntegrationTests.swift
Outdated
Show resolved
Hide resolved
Sources/Swift/Integrations/Performance/IO/SentryFileIOTracker+SwiftHelpers.swift
Outdated
Show resolved
Hide resolved
Sources/Swift/Integrations/Performance/IO/SentryFileIOTracker+SwiftHelpers.swift
Show resolved
Hide resolved
Tests/SentryTests/Integrations/Performance/IO/DataSentryTracingIntegrationTests.swift
Show resolved
Hide resolved
Tests/SentryTests/Integrations/Performance/IO/SentryFileIOTrackingIntegrationTests.swift
Outdated
Show resolved
Hide resolved
Tests/SentryTests/Integrations/Performance/IO/DataSentryTracingIntegrationTests.swift
Show resolved
Hide resolved
Co-authored-by: Philipp Hofmann <[email protected]>
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.
LGTM, with one comment to improve the test assertion for the timestamp.
// As the date provider is used by multiple internal components, it is not possible to pin-point the exact timestamp. | ||
// Therefore, we can only assert relative timestamps as the date provider uses an internal drift. | ||
let startTimestamp = try XCTUnwrap(span.startTimestamp) | ||
let endTimestamp = try XCTUnwrap(span.timestamp) |
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.
m
: I would prefer disabling the drift and manually advancing the time in the test between starting the span and finishing it so we can assert the timestamps for accuracy. If you can't manually advance the timestamps, I think it's OK to assert that both startTimestamp and timestamps are even the same. That's more accurate the current assertion. Wrong timestamps for the performance product have a massive impact.
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 is the reason why I brought up unit testing in addition to integration testing in Slack.
I would propose we keep this implementation in the integration test, but I'll add unit tests as well which will not spin up the entire SDK and use a mockOnce
similar to jest.mockReturnValueOnce
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
075a044 | 1237.26 ms | 1255.36 ms | 18.10 ms |
7fb7afb | 1235.00 ms | 1256.81 ms | 21.81 ms |
2b19b82 | 1212.94 ms | 1252.84 ms | 39.90 ms |
257c2a9 | 1231.45 ms | 1252.12 ms | 20.67 ms |
6129be5 | 1215.65 ms | 1247.18 ms | 31.54 ms |
3bf3c92 | 1236.94 ms | 1253.00 ms | 16.06 ms |
5d6ce0e | 1237.10 ms | 1257.46 ms | 20.36 ms |
319f0f5 | 1229.68 ms | 1247.67 ms | 17.99 ms |
7cd187e | 1239.39 ms | 1258.02 ms | 18.63 ms |
48e8c2e | 1231.00 ms | 1244.52 ms | 13.52 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
075a044 | 20.76 KiB | 420.41 KiB | 399.65 KiB |
7fb7afb | 20.76 KiB | 419.69 KiB | 398.94 KiB |
2b19b82 | 21.58 KiB | 542.18 KiB | 520.59 KiB |
257c2a9 | 20.76 KiB | 401.36 KiB | 380.60 KiB |
6129be5 | 21.58 KiB | 418.00 KiB | 396.42 KiB |
3bf3c92 | 21.58 KiB | 706.06 KiB | 684.48 KiB |
5d6ce0e | 22.85 KiB | 405.38 KiB | 382.53 KiB |
319f0f5 | 22.30 KiB | 749.70 KiB | 727.40 KiB |
7cd187e | 20.76 KiB | 401.65 KiB | 380.89 KiB |
48e8c2e | 21.58 KiB | 418.44 KiB | 396.86 KiB |
This PR is derived from #4605
It introduces two methods to extend Data:
Data#init(contentsOfUrlWithSentryTracing:)
is mapped toData.init(contentsOfUrl:)
data.writeWithSentryTracing(to:options:)
is mapped todata.write(to:options)
Blocked by: