Repository navigation
fix(feedback): update_user_reports to shim feedback - #68317
Conversation
|
will follow up with tests tomorrow |
|
Do we expect |
By "events" do you mean userreport + resulting feedback? I.e. "user reports without an associated event are missing an environment" |
| if features.has( | ||
| "organizations:user-feedback-ingest", project.organization, actor=None | ||
| ): | ||
| shim_to_feedback( |
There was a problem hiding this comment.
When is this task ran and what's the purpose of calling shim_to_feedback here, vs save_userreport? If it's called in both, won't this create duplicate feedbacks?
There was a problem hiding this comment.
if you look at the above:
user_reports = UserReport.objects.filter(
group_id__isnull=True,
environment_id__isnull=True,
date_added__gte=start,
date_added__lte=end,
)
this is the key -- we're only going to call shim_to_feedback on user reports which haven't already been shimmed, as there was no event associated with them, so no duplication.
There was a problem hiding this comment.
could we just use event_id__isnull instead?
There was a problem hiding this comment.
don't think it really matters too much -- they should all return equivalent results unless i'm missing something
There was a problem hiding this comment.
if it doesn't matter for functionality, i'd prefer event_id=null. from a reader's perspective, event_id__isnull makes it clear that we're filtering on user reports with missing events. Although environment and group = null is correlated with event = null right now, the relationship isn't clear and it might not always be the case
There was a problem hiding this comment.
@aliu3ntry i think that is a fair point -- my only counter is that this PR is not changing this line, and i'd rather not introduce changes that aren't needed. i could add a comment explaining if that makes sense to you?
There was a problem hiding this comment.
I see, that's fair. Yes a comment would be good
There was a problem hiding this comment.
Taking a second look, I think event_id__isnull would've been wrong... we use event_id's to lookup the associated events, and in the UserReport model this field isn't nullable. Thank you for adding the comment!
There was a problem hiding this comment.
right, totally that makes sense -- the event_id is added regardless if the event exists or not.
| shim_to_feedback( | ||
| report, event, project, FeedbackCreationSource.USER_REPORT_ENVELOPE | ||
| ) | ||
| report.update(group_id=event.group_id, environment_id=event.get_environment().id) |
There was a problem hiding this comment.
Should we update these fields before creating the feedback? I.e. move it above line 68
There was a problem hiding this comment.
i don't think it really matters, what do you think?
There was a problem hiding this comment.
I thought shim_to_feedback used these fields -- didn't look closely enough, my bad
yes, we can remove the case. i'd want to do that in a follow up PR to ensure that metric drops to 0. |
yes, exactly. |
Bundle ReportChanges will decrease total bundle size by 2.23kB ⬇️
|
|
This looks related to #68179 |
update_userreports, create the feedback via shim there, where the event exists.We were seeing lots of customer issues where the environment wasn't being set correctly. This should fix the issue.
Note, after this change, user reports that never receive an associated event will no longer be ingested / shown in the platform. This is the behavior prior to the recent feedback changes. Because of missing environments, these events end up causing more confusion than they are worth, so I think it makes sense to not show them.