feat: Support tracePropagationTargets#2217
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Support tracePropagationTargets ([#2217](https://github.com/getsentry/sentry-cocoa/pull/2217))If none of the above apply, you can opt out of this check by adding |
|
Right now In the case of See This matches the docs and example on https://develop.sentry.dev/sdk/performance/#tracepropagationtargets, and makes the most sense to me, and matches what I've seen in other systems (like CORS whitelists in Django). @brustolin on the other hand thinks that the entire url should always be used, and we should use @philipphofmann @bruno-garcia what do you think? |
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 864c39a | 1191.14 ms | 1233.38 ms | 42.24 ms |
| 4a66f00 | 1224.73 ms | 1241.14 ms | 16.41 ms |
| 5ecf9f6 | 1230.76 ms | 1232.86 ms | 2.10 ms |
| 202334c | 1265.41 ms | 1277.34 ms | 11.93 ms |
| 791123d | 1217.52 ms | 1253.08 ms | 35.56 ms |
| b172a8b | 1257.68 ms | 1272.38 ms | 14.70 ms |
| 7138b7d | 1243.40 ms | 1252.08 ms | 8.68 ms |
| 172c95a | 1220.08 ms | 1251.74 ms | 31.66 ms |
| 7c867f1 | 1206.16 ms | 1234.88 ms | 28.71 ms |
| 9fc2dd0 | 1246.14 ms | 1275.00 ms | 28.86 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 864c39a | 20.51 KiB | 335.57 KiB | 315.06 KiB |
| 4a66f00 | 20.51 KiB | 331.79 KiB | 311.28 KiB |
| 5ecf9f6 | 20.51 KiB | 332.66 KiB | 312.15 KiB |
| 202334c | 20.51 KiB | 331.79 KiB | 311.28 KiB |
| 791123d | 20.51 KiB | 331.81 KiB | 311.30 KiB |
| b172a8b | 20.51 KiB | 331.79 KiB | 311.28 KiB |
| 7138b7d | 20.51 KiB | 331.79 KiB | 311.28 KiB |
| 172c95a | 20.51 KiB | 335.57 KiB | 315.06 KiB |
| 7c867f1 | 20.51 KiB | 332.59 KiB | 312.09 KiB |
| 9fc2dd0 | 20.50 KiB | 331.79 KiB | 311.28 KiB |
Previous results on branch: feat/2148-tracePropagationTargets
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bbcc973 | 1261.96 ms | 1272.67 ms | 10.72 ms |
| f7b4806 | 1215.08 ms | 1238.28 ms | 23.20 ms |
| 5d57218 | 1214.27 ms | 1235.16 ms | 20.89 ms |
| 8f68482 | 1249.96 ms | 1262.08 ms | 12.12 ms |
| ca11fbf | 1227.39 ms | 1246.36 ms | 18.97 ms |
| 279fa8c | 1216.81 ms | 1238.68 ms | 21.87 ms |
| c2aeeea | 1244.12 ms | 1249.53 ms | 5.41 ms |
| ff930b0 | 1268.13 ms | 1291.84 ms | 23.71 ms |
| 0e35c66 | 1227.96 ms | 1256.63 ms | 28.67 ms |
| f6518a9 | 1202.39 ms | 1240.90 ms | 38.51 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bbcc973 | 20.51 KiB | 331.90 KiB | 311.39 KiB |
| f7b4806 | 20.51 KiB | 331.92 KiB | 311.42 KiB |
| 5d57218 | 20.51 KiB | 331.96 KiB | 311.45 KiB |
| 8f68482 | 20.51 KiB | 332.26 KiB | 311.75 KiB |
| ca11fbf | 20.51 KiB | 331.92 KiB | 311.42 KiB |
| 279fa8c | 20.51 KiB | 332.03 KiB | 311.52 KiB |
| c2aeeea | 20.51 KiB | 331.94 KiB | 311.43 KiB |
| ff930b0 | 20.51 KiB | 332.61 KiB | 312.10 KiB |
| 0e35c66 | 20.51 KiB | 331.96 KiB | 311.46 KiB |
| f6518a9 | 20.51 KiB | 332.91 KiB | 312.40 KiB |
* master: release: 7.26.0 meta: Fix Changelog concurrent transactions (#2229) build(deps): bump fastlane from 2.210.0 to 2.210.1 (#2224) Revert "feat: profile concurrent transactions (#2105)" (#2225) fix: Align core data span operations (#2222) test: Remove empty assert msg for AppStateTests (#2221) meta: Fix Changelog (#2219) ref: Add typealias for bytes (#2209) feat: profile concurrent transactions (#2105) ci: Readd cache for UI tests (#2215) # Conflicts: # Sentry.xcodeproj/project.pbxproj
|
I'm getting test failures in |
|
We are missing 'tracePropagationTargets' initialisation during |
Yeah I actually wanted to ask about that - what is the use of that |
I believe this is legacy stuff. |
|
Perhaps something we can clean up with v8? |
Legacy and hybrid SDKs. So no, I don't think we can rid of that in V8. |
|
@kevinrenskers, it's supposed to be as pointed out in the develop docs. We have an internal DACI, which I'm going to send you somewhere in private. |
Co-authored-by: Dhiogo Brustolin <[email protected]>
philipphofmann
left a comment
There was a problem hiding this comment.
Thanks for taking care of this, @kevinrenskers.
| infoDict[@"CFBundleShortVersionString"], infoDict[@"CFBundleVersion"]]; | ||
| } | ||
|
|
||
| NSRegularExpression *everythingAllowedRegex = |
There was a problem hiding this comment.
h: We are missing tests for this new functionality.
There was a problem hiding this comment.
This is tested using testAddHeadersForRequestWithURL. What are you missing?
There was a problem hiding this comment.
I miss
- That the default is an array with a regex
.*. - Setting an array with different values than NSString or NSRegularExpression. We don't need to validate the logging functionality, but we should ensure we are not crashing.
- A test for the custom setter
- A test for setting tracePropagationTargets with the
startWithDict.
There was a problem hiding this comment.
That the default is an array with a regex .*.
That is basically what is tested using testAddHeadersForRequestWithURL. Not that it literally is a regex .*, but that it has the correct behavior, which seems more useful to me than testing if it contains this specific regex?
I'll look into the other points.
| XCTAssertEqual(task.currentRequest?.allHTTPHeaderFields?["sentry-trace"] ?? "", "") | ||
| } | ||
|
|
||
| func testAddHeadersForRequestWithURL() { |
There was a problem hiding this comment.
l: Excellent test case, but I think we should split it up into several ones.
There was a problem hiding this comment.
Just wondering why you think so? Splitting it up doesn't really do anything, and I like how all these related things are now in one test function.
There was a problem hiding this comment.
An approach to organizing your tests is to test one functionality. When the test fails its name should tell you what's wrong. Up to you.
brustolin
left a comment
There was a problem hiding this comment.
LGTM
Just wait for @philipphofmann replies in his comments before merge this.
philipphofmann
left a comment
There was a problem hiding this comment.
Only missing tests and the wrong link to the docs.
| infoDict[@"CFBundleShortVersionString"], infoDict[@"CFBundleVersion"]]; | ||
| } | ||
|
|
||
| NSRegularExpression *everythingAllowedRegex = |
There was a problem hiding this comment.
I miss
- That the default is an array with a regex
.*. - Setting an array with different values than NSString or NSRegularExpression. We don't need to validate the logging functionality, but we should ensure we are not crashing.
- A test for the custom setter
- A test for setting tracePropagationTargets with the
startWithDict.
| XCTAssertEqual(task.currentRequest?.allHTTPHeaderFields?["sentry-trace"] ?? "", "") | ||
| } | ||
|
|
||
| func testAddHeadersForRequestWithURL() { |
There was a problem hiding this comment.
An approach to organizing your tests is to test one functionality. When the test fails its name should tell you what's wrong. Up to you.
| XCTAssertNil(options.beforeBreadcrumb); | ||
| } | ||
|
|
||
| - (void)testTracePropagationTargets |
There was a problem hiding this comment.
m: Let's please also validate the default value. We only need to add a line somewhere here
📜 Description
We now have a new SentryOption
tracePropagationTargetswhich determines if our two headers are added to outgoing requests.💡 Motivation and Context
Closes #2148.
💚 How did you test it?
Unit test & running the app with a debug proxy to view actual requests and their headers.
📝 Checklist
🔮 Next steps