You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feedback captures are subject to sample rate #3604
for(inti=0;i<6;i++){vareventId=SentrySdk.CaptureMessage("An event that will receive user feedback.");SentrySdk.CaptureUserFeedback(eventId,"[email protected]",$"Test {i}","The User");}
(You can also do these manually multiple times instead of in a for loop, which is what we actually tested.)
Expected Result
We would expect all points of feedback to not be subject to the sample rate, as described here.
Actual Result
We are only seeing some of the feedback points come through. (And one duplicate one w/o a linked issue in the below screenshot, strangely enough.)
As a workaround, we tested re-initializing the Sentry SDK with a sampling rate of 100% prior to users submitting feedback, which works. This is not an ideal scenario, so I hope we can see this fixed.
So, at no stage, is any rate limiting implemented by the SDK for User Feedback.
The only thing I can think is that maybe the sentry server is dropping those events for some reason. In that case, you might see some record of that in the "Stats" tab in your Sentry portal.
My initial thought was that it might be related to the attached message (using CaptureMessage) being affected by sampling, resulting in CaptureUserFeedback failing. For example, I also can't call it with SentryId.Empty (it will silently fail).
On the Stats page, I see Filtered, Rate Limited, and Invalid all at 0.
2024-09-10 11:10:04.6697|WARN|SentryLogger|User feedback dropped due to empty id.
Aha, OK that makes sense. I assume User Feedback is designed to be supplied with Exception Events... so after capturing an exception you could then capture some User Feedback and submit this (along with the id of the Exception that was captured).
We have a special Feedback dialog that users can open on demand (through a button on our UI) that the user can choose to optionally attach logs to. It looks like this:
In addition, we have some other parts of our UI which don't necessarily generate an exception, but do generate user feedback (eg. in our case, a user receives a warning from us about something, but they think it's a false positive, so they click on a button to indicate as such), which we really do want to hear about.
Are we misunderstanding the use case of Sentry's User Feedback, or is this indeed a problem/bug in the .Net SDK?
Are we misunderstanding the use case of Sentry's User Feedback, or is this indeed a problem/bug in the .Net SDK?
User feedback was implemented before I started working on the SDK so I'm learning here at the same time as you, but it looks like initially User Feedback events did have to be associated with events and so the code in the SDK is doing what it's supposed to. However, since then, a new format has been introduced that allows User Feedback to be sent independently of events... and presumably this newer User Feedback mechanism hasn't yet been implemented in the .NET SDK.
So I think you've understood the intent of the new User Feedback model but the .NET SDK is still built using the old APIs.
I've raised the following issue for prioritisation:
And getting a widget for MAUI would be nice too. Based on the work done by Andrew on iOS, or Denis on Flutter.
I expanded the feature details to have relevant links and pointer:
Activity
jamescrosswell commentedon Sep 10, 2024
Hi @codecat,
Thanks for getting in touch. I can't see logically how this might be happening though. The API you're calling simply delegates to the Hub:
sentry-dotnet/src/Sentry/SentrySdk.cs
Lines 501 to 502 in 76e9f66
And the Hub in turn passes the feedback on to the SentryClient:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 456 to 471 in 5ff8acc
And the SentryClient simply turns the feedback into an envelope and enqueues this for delivery:
sentry-dotnet/src/Sentry/SentryClient.cs
Lines 85 to 95 in 5b35d8e
So, at no stage, is any rate limiting implemented by the SDK for User Feedback.
The only thing I can think is that maybe the sentry server is dropping those events for some reason. In that case, you might see some record of that in the "Stats" tab in your Sentry portal.
codecat commentedon Sep 10, 2024
Thanks for looking into this.
My initial thought was that it might be related to the attached message (using
CaptureMessage) being affected by sampling, resulting inCaptureUserFeedbackfailing. For example, I also can't call it withSentryId.Empty(it will silently fail).On the Stats page, I see
Filtered,Rate Limited, andInvalidall at 0.codecat commentedon Sep 10, 2024
After adding some logging I can confirm this is indeed what is happening:
jamescrosswell commentedon Sep 10, 2024
Aha, OK that makes sense. I assume User Feedback is designed to be supplied with Exception Events... so after capturing an exception you could then capture some User Feedback and submit this (along with the id of the Exception that was captured).
Are you trying to achieve something different?
codecat commentedon Sep 10, 2024
We have a special Feedback dialog that users can open on demand (through a button on our UI) that the user can choose to optionally attach logs to. It looks like this:
In addition, we have some other parts of our UI which don't necessarily generate an exception, but do generate user feedback (eg. in our case, a user receives a warning from us about something, but they think it's a false positive, so they click on a button to indicate as such), which we really do want to hear about.
Are we misunderstanding the use case of Sentry's User Feedback, or is this indeed a problem/bug in the .Net SDK?
2 remaining items
jamescrosswell commentedon Sep 10, 2024
User feedback was implemented before I started working on the SDK so I'm learning here at the same time as you, but it looks like initially User Feedback events did have to be associated with events and so the code in the SDK is doing what it's supposed to. However, since then, a new format has been introduced that allows User Feedback to be sent independently of events... and presumably this newer User Feedback mechanism hasn't yet been implemented in the .NET SDK.
So I think you've understood the intent of the new User Feedback model but the .NET SDK is still built using the old APIs.
I've raised the following issue for prioritisation:
cc: @bitsandfoxes
bruno-garcia commentedon Nov 20, 2024
@jamescrosswell this could be a good next project.
And getting a widget for MAUI would be nice too. Based on the work done by Andrew on iOS, or Denis on Flutter.
I expanded the feature details to have relevant links and pointer:
aritchie commentedon Feb 13, 2025
@jamescrosswell Thoughts?
Proposal
jamescrosswell commentedon Feb 13, 2025
Probably not for this issue (we need to implement User Feedback using the new APIs to address this issue).
That's more relevant for #3947 but it's done automatically by our transport, so SDK users doesn't need to worry/think about this.