Skip to content

Commit

Permalink
fix(err): support fingerprint passthrough (#26639)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverb123 authored Dec 4, 2024
1 parent 9890231 commit 3bd9b93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion rust/cymbal/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ pub struct Exception {
pub struct RawErrProps {
#[serde(rename = "$exception_list")]
pub exception_list: Vec<Exception>,
#[serde(
rename = "$exception_fingerprint",
skip_serializing_if = "Option::is_none"
)]
pub fingerprint: Option<String>, // Clients can send us fingerprints, which we'll use if present
#[serde(flatten)]
// A catch-all for all the properties we don't "care" about, so when we send back to kafka we don't lose any info
pub other: HashMap<String, Value>,
Expand All @@ -57,6 +62,7 @@ pub struct RawErrProps {
pub struct FingerprintedErrProps {
pub exception_list: Vec<Exception>,
pub fingerprint: String,
pub proposed_fingerprint: String, // We suggest a fingerprint, based on hashes, but let users override client-side
pub other: HashMap<String, Value>,
}

Expand All @@ -67,6 +73,8 @@ pub struct OutputErrProps {
pub exception_list: Vec<Exception>,
#[serde(rename = "$exception_fingerprint")]
pub fingerprint: String,
#[serde(rename = "$exception_proposed_fingerprint")]
pub proposed_fingerprint: String,
#[serde(rename = "$exception_issue_id")]
pub issue_id: Uuid,
#[serde(flatten)]
Expand Down Expand Up @@ -119,7 +127,8 @@ impl RawErrProps {
pub fn to_fingerprinted(self, fingerprint: String) -> FingerprintedErrProps {
FingerprintedErrProps {
exception_list: self.exception_list,
fingerprint,
fingerprint: self.fingerprint.unwrap_or(fingerprint.clone()),
proposed_fingerprint: fingerprint,
other: self.other,
}
}
Expand All @@ -131,6 +140,7 @@ impl FingerprintedErrProps {
exception_list: self.exception_list,
fingerprint: self.fingerprint,
issue_id,
proposed_fingerprint: self.proposed_fingerprint,
other: self.other,
}
}
Expand Down
3 changes: 1 addition & 2 deletions rust/cymbal/tests/static/python_err_props.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,5 @@
"$ip": "185.140.230.43",
"$lib_version__minor": 6,
"$lib": "posthog-python",
"$lib_version__major": 3,
"$exception_fingerprint": ["ConnectionRefusedError", "[Errno 111] Connection refused", "_new_conn"]
"$lib_version__major": 3
}

0 comments on commit 3bd9b93

Please sign in to comment.