feat: Use user_agent parsing for all events#10679
Conversation
| fix_culprit(data) | ||
| if data.get('platform') == 'javascript': | ||
| inject_device_data(data) | ||
| normalize_user_agent(data) |
There was a problem hiding this comment.
Is this still necessary if we already perform normalize_user_agent in the event_manager?
There was a problem hiding this comment.
it will be removed there once we validated that it works. For now we start with a small sample rate of events that get it as part of normalize since we don't know the performance impact of this.
Co-Authored-By: HazAT <daniel.griesser.86@gmail.com>
mitsuhiko
left a comment
There was a problem hiding this comment.
lgtm. I think we should try to experiment with this on 10% of events with op supervision.
|
|
||
| try: | ||
| for key, value in headers: | ||
| if key != 'User-Agent': |
There was a problem hiding this comment.
Does the request object normalize header names to this casing?
There was a problem hiding this comment.
Yap and it's one of the things that's pretty annoying because it picks the wrong normalization. Modern HTTP requires lowercase :(
There was a problem hiding this comment.
Good point, not sure, should I change this now?
Important
We need to add
event-normalization.parse-user-agent-sample-rateto the database as a sentry optionThis refactors the existing code from
lang/javascript/plugin.pyintocontext_normalization.py.Additionally, this adds
normalize_user_agentto EventManagernormalizefunction with timing metrics.We also added a dynamic setting to gradually increase this to 100% of events ingested.
Please note I've changed it so if there is already a
browser,osordevicecontext we no longer overwrite it, also for javascript events.e.g: This is for a php event with correct user-agent header:
Before

To enable, merge: https://github.com/getsentry/getsentry/pull/2380
Fixes getsentry/sentry-php#700
Fixes #8555