-
-
Notifications
You must be signed in to change notification settings - Fork 178
feat: add feedback api #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add feedback api #1033
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| use std::{collections::BTreeMap, time::SystemTime}; | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use crate::random_uuid; | ||
|
|
||
| use super::v7::{Context, Event, Level}; | ||
|
|
||
| /// Represents feedback from a user. | ||
| #[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)] | ||
| pub struct Feedback { | ||
| /// The user's contact email | ||
| pub contact_email: Option<String>, | ||
| /// The user's name | ||
| pub name: Option<String>, | ||
| /// The feedback from the user | ||
| pub message: String, | ||
| } | ||
|
|
||
| impl Feedback { | ||
| pub(crate) fn to_context(&self) -> Context { | ||
| Context::Feedback(Box::new(self.clone())) | ||
| } | ||
|
|
||
| pub(crate) fn to_new_event(&self) -> Event<'static> { | ||
| let map = { | ||
| let mut map = BTreeMap::new(); | ||
| map.insert("feedback".to_string(), self.to_context()); | ||
| map | ||
| }; | ||
| Event { | ||
| event_id: random_uuid(), | ||
| level: Level::Info, | ||
| timestamp: SystemTime::now(), | ||
| contexts: map, | ||
| ..Default::default() | ||
| } | ||
| } | ||
|
Comment on lines
+28
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixIn the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,5 +15,6 @@ pub use v7 as latest; | |
|
|
||
| mod attachment; | ||
| mod envelope; | ||
| mod feedback; | ||
| mod monitor; | ||
| mod session; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback event missing required
typefieldHigh Severity
The
to_new_eventmethod constructs a feedbackEventbut doesn't setr#typetoSome("feedback".to_string()). The PR specifically added atypefield to theEventstruct for this purpose, but the..Default::default()fallback leaves it asNone, so it won't be serialized. Per the Sentry protocol, feedback event payloads require"type": "feedback"for the backend to correctly identify and process them as feedback rather than regular error events.Additional Locations (1)
sentry-types/src/protocol/v7.rs#L1727-L1730