sentry-cocoa
sentry-cocoa copied to clipboard
feat: Support tracePropagationTargets
:scroll: Description
We now have a new SentryOption tracePropagationTargets
which determines if our two headers are added to outgoing requests.
:bulb: Motivation and Context
Closes #2148.
:green_heart: How did you test it?
WIP
:pencil: Checklist
- [ ] I reviewed the submitted code
- [ ] I added tests to verify the changes
- [x] I updated the docs if needed
- [x] Review from the native team if needed
- [x] No breaking changes
:crystal_ball: Next steps
Fails | |
---|---|
:no_entry_sign: | Please consider adding a changelog entry for the next release. |
Messages | |
---|---|
:book: | Do not forget to update Sentry-docs with your feature once the pull request gets approved. |
Instructions and example for changelog
Please add an entry to CHANGELOG.md
to the "Unreleased" section. Make sure the entry includes this PR's number.
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 #skip-changelog
to the PR description.
Generated by :no_entry_sign: dangerJS against 46e7e674031f238843e5810316f7613ce930be44
Right now SentrySDK.options.tracePropagationTargets
can contain either instances of NSString
, or instances of NSRegularExpression
.
In the case of NSString
, the request's URL.host
must match the value precisely.
In the case of NSRegularExpression
, the entire URL
will be used for matching.
See addHeadersForRequestWithURL
in the changed files.
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 contains
rather than isEqualToString
. I wanted to get early feedback on this. To me it doesn't really make sense, because if you add sentry.io
to SentrySDK.options.tracePropagationTargets
, what you mean is that all request from that domain are allowed. But sentry.io.evil-hacker.com
would also match by using contains
! If you really want to have that kind of freedom you can always use NSRegularExpression
.
@philipphofmann @bruno-garcia what do you think?
Performance metrics :rocket:
Plain | With Sentry | Diff | |
---|---|---|---|
Startup time | 1256.00 ms | 1268.35 ms | 12.35 ms |
Size | 20.51 KiB | 332.90 KiB | 312.40 KiB |
Baseline results on branch: master
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
864c39a52e6a3d3f56495e617b67c39663b10528 | 1191.14 ms | 1233.38 ms | 42.24 ms |
4a66f00b1d9816d03fc915336a36afcc21e2d526 | 1224.73 ms | 1241.14 ms | 16.41 ms |
5ecf9f6f92ee2598fd21b95d1a3af356d9969c50 | 1230.76 ms | 1232.86 ms | 2.10 ms |
202334c8455447a85c00613e12d6514b8f7b0330 | 1265.41 ms | 1277.34 ms | 11.93 ms |
791123de3f8fc898cc93f3bd5ffb8bbb213681e5 | 1217.52 ms | 1253.08 ms | 35.56 ms |
b172a8b1f4383add2e1edcc939c1cbf80d464625 | 1257.68 ms | 1272.38 ms | 14.70 ms |
7138b7d41d4b38f5101d787c38d3c86420d7a93d | 1243.40 ms | 1252.08 ms | 8.68 ms |
172c95a0f5823a6a1c37cd1b2d348ed047ba67b4 | 1220.08 ms | 1251.74 ms | 31.66 ms |
7c867f10598477e7a23e3adc644085f4bbdca7a6 | 1206.16 ms | 1234.88 ms | 28.71 ms |
9fc2dd0fcec6a4c0d960ddc965a9b87d67bde37d | 1246.14 ms | 1275.00 ms | 28.86 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
864c39a52e6a3d3f56495e617b67c39663b10528 | 20.51 KiB | 335.57 KiB | 315.06 KiB |
4a66f00b1d9816d03fc915336a36afcc21e2d526 | 20.51 KiB | 331.79 KiB | 311.28 KiB |
5ecf9f6f92ee2598fd21b95d1a3af356d9969c50 | 20.51 KiB | 332.66 KiB | 312.15 KiB |
202334c8455447a85c00613e12d6514b8f7b0330 | 20.51 KiB | 331.79 KiB | 311.28 KiB |
791123de3f8fc898cc93f3bd5ffb8bbb213681e5 | 20.51 KiB | 331.81 KiB | 311.30 KiB |
b172a8b1f4383add2e1edcc939c1cbf80d464625 | 20.51 KiB | 331.79 KiB | 311.28 KiB |
7138b7d41d4b38f5101d787c38d3c86420d7a93d | 20.51 KiB | 331.79 KiB | 311.28 KiB |
172c95a0f5823a6a1c37cd1b2d348ed047ba67b4 | 20.51 KiB | 335.57 KiB | 315.06 KiB |
7c867f10598477e7a23e3adc644085f4bbdca7a6 | 20.51 KiB | 332.59 KiB | 312.09 KiB |
9fc2dd0fcec6a4c0d960ddc965a9b87d67bde37d | 20.50 KiB | 331.79 KiB | 311.28 KiB |
Previous results on branch: feat/2148-tracePropagationTargets
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
bbcc973679521596df3157969667466940810309 | 1261.96 ms | 1272.67 ms | 10.72 ms |
f7b4806fed9133f35a9e3f086bfce5cee1e207e6 | 1215.08 ms | 1238.28 ms | 23.20 ms |
5d57218901889f439cb1fd3f0e0409999585b045 | 1214.27 ms | 1235.16 ms | 20.89 ms |
8f684823d445a77e3a4e94161f34018046965743 | 1249.96 ms | 1262.08 ms | 12.12 ms |
ca11fbfc35d8fd370718d170d0a8fe3ea1f44b87 | 1227.39 ms | 1246.36 ms | 18.97 ms |
279fa8c16d31f7eecd7dc513ce50923bb9b7a657 | 1216.81 ms | 1238.68 ms | 21.87 ms |
c2aeeeabc8631838b3cb219cac85717fb33825b6 | 1244.12 ms | 1249.53 ms | 5.41 ms |
ff930b0acebe70b47405b3cbce2a2f83f9b6f83f | 1268.13 ms | 1291.84 ms | 23.71 ms |
0e35c66b17112d023b94401d7e7cd7f0a73c631a | 1227.96 ms | 1256.63 ms | 28.67 ms |
f6518a92b5180df0ffcb07577ba995e2db796841 | 1202.39 ms | 1240.90 ms | 38.51 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
bbcc973679521596df3157969667466940810309 | 20.51 KiB | 331.90 KiB | 311.39 KiB |
f7b4806fed9133f35a9e3f086bfce5cee1e207e6 | 20.51 KiB | 331.92 KiB | 311.42 KiB |
5d57218901889f439cb1fd3f0e0409999585b045 | 20.51 KiB | 331.96 KiB | 311.45 KiB |
8f684823d445a77e3a4e94161f34018046965743 | 20.51 KiB | 332.26 KiB | 311.75 KiB |
ca11fbfc35d8fd370718d170d0a8fe3ea1f44b87 | 20.51 KiB | 331.92 KiB | 311.42 KiB |
279fa8c16d31f7eecd7dc513ce50923bb9b7a657 | 20.51 KiB | 332.03 KiB | 311.52 KiB |
c2aeeeabc8631838b3cb219cac85717fb33825b6 | 20.51 KiB | 331.94 KiB | 311.43 KiB |
ff930b0acebe70b47405b3cbce2a2f83f9b6f83f | 20.51 KiB | 332.61 KiB | 312.10 KiB |
0e35c66b17112d023b94401d7e7cd7f0a73c631a | 20.51 KiB | 331.96 KiB | 311.46 KiB |
f6518a92b5180df0ffcb07577ba995e2db796841 | 20.51 KiB | 332.91 KiB | 312.40 KiB |
I'm getting test failures in testGetRequest_SpanCreatedAndBaggageHeaderAdded
, it seems that it uses a cached version of the server maybe? It all succeeds locally when I run the server with my changes. But if we're going to remove those tests that hit the server, I don't really have to look into any further. Let me know!
We are missing 'tracePropagationTargets' initialisation during validateOptions:didFailWithError:
function in SentryOptions
We are missing 'tracePropagationTargets' initialisation during
validateOptions:didFailWithError:
function in SentryOptions
Yeah I actually wanted to ask about that - what is the use of that initWithDict
method anyways? Who's using this, and why?
Yeah I actually wanted to ask about that - what is the use of that initWithDict method anyways? Who's using this, and why?
I believe this is legacy stuff. @philipphofmann do you have a better answer?
Perhaps something we can clean up with v8?
Yeah I actually wanted to ask about that - what is the use of that initWithDict method anyways? Who's using this, and why?
I believe this is legacy stuff. @philipphofmann do you have a better answer?
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.