fix(transport): Tag sockets traffic originating from Sentry's HttpConnection#4340
fix(transport): Tag sockets traffic originating from Sentry's HttpConnection#4340
Conversation
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
Performance metrics 🚀
|
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
|
|
||
| @Override | ||
| public void tagSockets() { | ||
| TrafficStats.setThreadStatsTag(1); |
There was a problem hiding this comment.
Would it be better to have the current thread id as tag?
I see the value in not showing the violation, but if we want to tackle it, we can show the current thread id or a number hardly used by the user, to ensure we don't mess with any report of the app.
Also, we could use TrafficStats.getAndSetThreadStatsTag(), so that we can restore previous value, and if it's -1 clear it later. Not sure how much worth it is, as we are the only one using this thread, i think, but why not
There was a problem hiding this comment.
not sure if it'd change much because it's a threadlocal (under-the-hood) and we anyway use only our own single thread for our requests. But I changed it from 1 to a random number, I think it should be fine like that.
stefanosiano
left a comment
There was a problem hiding this comment.
Just a small comment on the number used to tag, but no strong opinion on it
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
📜 Description
To get rid of UntaggedSocket strict mode violation
💡 Motivation and Context
Addresses #909
💚 How did you test it?
With tests and verified no strict mode violation when running the sample app
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps