Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/batch_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ mod tests {
count: 1,
data_entry_id: Uuid::new_v4(),
session_id: None,
build_id: None,
created_at: Utc::now(),
},
tracking: None,
Expand Down
1 change: 1 addition & 0 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ pub async fn insert_error_entries(
count: data.count.unwrap_or(1).max(0) as u32,
data_entry_id,
session_id: data.session_id,
build_id: data.build_id,
created_at: chrono::Utc::now(),
};

Expand Down
6 changes: 6 additions & 0 deletions src/handler/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub(crate) struct WebRequest {
pub(crate) errors: Option<Vec<ErrorTracking>>,
#[serde(default)]
pub(crate) session_id: Option<String>,
#[serde(default)]
pub(crate) build_id: Option<String>,
}

pub async fn web(
Expand All @@ -48,6 +50,7 @@ pub async fn web(
mut data,
errors,
session_id: parsed_session_id,
build_id,
} = match serde_json::from_slice(&body) {
Ok(req) => req,
Err(_) => return error_response(StatusCode::BAD_REQUEST, "Invalid JSON"),
Expand Down Expand Up @@ -200,6 +203,9 @@ pub async fn web(
if error.session_id.is_none() {
error.session_id = session_id.clone();
}
if error.build_id.is_none() {
error.build_id = build_id.clone();
}
if let Err(e) = insert_error_entries(
&state.batch_queue,
ctx.project_id,
Expand Down
2 changes: 2 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub struct ErrorTracking {
pub count: Option<i32>,
#[serde(default, rename = "sessionId")]
pub session_id: Option<String>,
#[serde(default, rename = "buildId")]
pub build_id: Option<String>,
}

#[derive(Debug, Serialize, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions src/tinybird.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub struct ErrorTrackingRow {
pub count: u32,
pub data_entry_id: Uuid,
pub session_id: Option<String>,
pub build_id: Option<String>,
#[serde(with = "chrono::serde::ts_milliseconds")]
pub created_at: DateTime<Utc>,
}
Expand Down