-
-
Notifications
You must be signed in to change notification settings - Fork 371
Log Integrations: Add SentrySwiftLog Package
#6941
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6941 +/- ##
==========================================
Coverage 85.069% 85.069%
==========================================
Files 453 453
Lines 27681 27681
Branches 12166 12167 +1
==========================================
Hits 23548 23548
- Misses 3874 4087 +213
+ Partials 259 46 -213 see 36 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
| SentrySDK.start { options in | ||
| options.dsn = "https://[email protected]/123456" | ||
| options.enableLogs = true | ||
| options.beforeSendLog = { [weak self] log in |
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.
Just use public SDK API for testing. That way we don't need any kind of test helpers from the main repo, keeping it completely separate and easily transferable to a downstream repo.
SentrySwiftLog PackageSentrySwiftLog Package
| - name: Run CI Diagnostics | ||
| if: failure() | ||
| run: ./scripts/ci-diagnostics.sh | ||
|
|
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.
Bug: New test job missing from required-check dependencies
The new swiftlog-integration-unit-tests job is not included in the unit-tests-required-check job's needs array. Since unit-tests-required-check is the required status check that gates merging, failures in the swiftlog integration tests won't block the PR from merging. The job runs but its result is never validated by the required check.
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 relevant!
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0ede342 | 1233.47 ms | 1262.29 ms | 28.82 ms |
| d05d866 | 1211.78 ms | 1230.96 ms | 19.18 ms |
| bbe6658 | 1221.00 ms | 1248.51 ms | 27.51 ms |
| bc0a04c | 1226.83 ms | 1255.04 ms | 28.21 ms |
| 15a6325 | 1209.43 ms | 1233.43 ms | 24.00 ms |
| 25d9b58 | 1233.76 ms | 1267.92 ms | 34.16 ms |
| 532bde4 | 1210.63 ms | 1256.24 ms | 45.61 ms |
| f83dcc4 | 1210.88 ms | 1246.22 ms | 35.35 ms |
| 449d185 | 1216.31 ms | 1251.94 ms | 35.62 ms |
| dad68ad | 1229.15 ms | 1261.98 ms | 32.83 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0ede342 | 23.75 KiB | 928.15 KiB | 904.40 KiB |
| d05d866 | 23.75 KiB | 878.60 KiB | 854.85 KiB |
| bbe6658 | 23.75 KiB | 908.02 KiB | 884.27 KiB |
| bc0a04c | 23.75 KiB | 933.32 KiB | 909.57 KiB |
| 15a6325 | 23.75 KiB | 933.33 KiB | 909.58 KiB |
| 25d9b58 | 24.15 KiB | 1.01 MiB | 1014.91 KiB |
| 532bde4 | 24.15 KiB | 1.01 MiB | 1014.89 KiB |
| f83dcc4 | 23.75 KiB | 1.02 MiB | 1019.11 KiB |
| 449d185 | 23.75 KiB | 980.81 KiB | 957.06 KiB |
| dad68ad | 23.75 KiB | 912.37 KiB | 888.63 KiB |
Previous results on branch: feat/add-swift-log-integration
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 587a9b5 | 1213.80 ms | 1250.94 ms | 37.14 ms |
| e39cfe2 | 1196.87 ms | 1216.73 ms | 19.87 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 587a9b5 | 24.14 KiB | 1.02 MiB | 1016.89 KiB |
| e39cfe2 | 24.14 KiB | 1.02 MiB | 1016.90 KiB |
.github/file-filters.yml
Outdated
| - "SentryTestUtils/**" | ||
| - "SentryTestUtilsDynamic/**" | ||
| - "SentryTestUtilsTests/**" | ||
| - "integrations/**" |
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.
h: make sure the naming of the directory is aligned with our decision in #6902
| device: "Apple TV" | ||
| scheme: "Sentry" | ||
|
|
||
| swiftlog-integration-unit-tests: |
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: We should consider adding a new workflow file for integrations separate to the main SDK tests, and to not further extend it
| - name: Run CI Diagnostics | ||
| if: failure() | ||
| run: ./scripts/ci-diagnostics.sh | ||
|
|
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 relevant!
| @@ -0,0 +1,8 @@ | |||
| .DS_Store | |||
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.
l: Let's consider these best-practices gitignores:
- https://github.com/github/gitignore/blob/main/Swift.gitignore
- https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
- https://github.com/github/gitignore/blob/main/Global/Xcode.gitignore
I usually concatenate them like this:
|
|
||
| ```swift | ||
| dependencies: [ | ||
| .package(url: "https://github.com/getsentry/sentry-cocoa", from: "9.0.0"), |
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: Is this one really necessary? Wouldn't it be resolve as a transitive dependency anyways?
| @@ -0,0 +1,187 @@ | |||
| # Sentry Swift-Log Integration | |||
|
|
|||
| A `swift-log` handler that forwards log entries to Sentry's structured logging system, automatically capturing application logs with full context including metadata, source location, and log levels. | |||
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.
|
|
||
| var attributes: [String: Any] = [:] | ||
| attributes["sentry.origin"] = "auto.logging.swift-log" | ||
| attributes["swift-log.level"] = level.rawValue |
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: Is the attribute namespacing standardized? Would it make sense to prefix with integration.?
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
#skip-changelog
📜 Description
SentrySwiftLogintegration to theintegrations/logs/sentry-swift-logfolder💡 Motivation and Context
Closes #5372
Relates to #6902
💚 How did you test it?
Package.swiftversion📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.