Skip to content

Commit 3fb4337

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Add requestor to the deployment audit log for imports (#31335)
This allows us to render differently for cloud imports. GitOrigin-RevId: d4b1c34e6519d3fbd00646295654da883d0015d0
1 parent 14aec54 commit 3fb4337

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crates/application/src/snapshot_import.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ impl<RT: Runtime> SnapshotImportWorker<RT> {
747747
table_count,
748748
import_mode: snapshot_import.mode,
749749
import_format: snapshot_import.format.clone(),
750+
requestor: snapshot_import.requestor.clone(),
750751
},
751752
snapshot_import.requestor.clone(),
752753
)

crates/model/src/deployment_audit_log/types.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use value::{
3535
codegen_convex_serialization,
3636
obj,
3737
remove_int64,
38+
remove_nullable_object,
3839
remove_object,
3940
remove_string,
4041
remove_vec,
@@ -56,6 +57,7 @@ use crate::{
5657
snapshot_imports::types::{
5758
ImportFormat,
5859
ImportMode,
60+
ImportRequestor,
5961
},
6062
};
6163

@@ -154,6 +156,7 @@ pub enum DeploymentAuditLogEvent {
154156
table_count: u64,
155157
import_mode: ImportMode,
156158
import_format: ImportFormat,
159+
requestor: ImportRequestor,
157160
},
158161
}
159162

@@ -276,6 +279,7 @@ impl DeploymentAuditLogEvent {
276279
table_count,
277280
import_mode,
278281
import_format,
282+
requestor,
279283
} => {
280284
let table_names: Vec<_> = table_names
281285
.into_iter()
@@ -287,7 +291,8 @@ impl DeploymentAuditLogEvent {
287291
"table_names" => table_names,
288292
"table_count" => table_count as i64,
289293
"import_mode" => import_mode.to_string(),
290-
"import_format" => ConvexValue::Object(import_format.try_into()?)
294+
"import_format" => ConvexObject::try_from(import_format)?,
295+
"requestor" => ConvexObject::try_from(requestor)?,
291296
)
292297
},
293298
DeploymentAuditLogEvent::ClearTables => obj!(),
@@ -388,6 +393,8 @@ impl TryFrom<ConvexObject> for DeploymentAuditLogEvent {
388393
table_count: remove_int64(&mut fields, "table_count")? as u64,
389394
import_mode: remove_string(&mut fields, "import_mode")?.parse()?,
390395
import_format: remove_object(&mut fields, "import_format")?,
396+
requestor: remove_nullable_object(&mut fields, "requestor")?
397+
.unwrap_or(ImportRequestor::SnapshotImport),
391398
}
392399
},
393400
_ => anyhow::bail!("action {action} unrecognized"),

0 commit comments

Comments
 (0)