Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Country Code To Snowflake (#20875)

Conrad Irwinea5131ce0a9d
diff --git a/crates/collab/src/api/events.rs b/crates/collab/src/api/events.rs
index 80f477df300..57ac43ca56d 100644
--- a/crates/collab/src/api/events.rs
+++ b/crates/collab/src/api/events.rs
@@ -418,7 +418,7 @@ pub async fn post_events(
if let Some(kinesis_client) = app.kinesis_client.clone() {
if let Some(stream) = app.config.kinesis_stream.clone() {
let mut request = kinesis_client.put_records().stream_name(stream);
- for row in for_snowflake(request_body.clone(), first_event_at) {
+ for row in for_snowflake(request_body.clone(), first_event_at, country_code.clone()) {
if let Some(data) = serde_json::to_vec(&row).log_err() {
request = request.records(
aws_sdk_kinesis::types::PutRecordsRequestEntry::builder()
@@ -1381,6 +1381,7 @@ pub fn calculate_json_checksum(app: Arc<AppState>, json: &impl AsRef<[u8]>) -> O
fn for_snowflake(
body: EventRequestBody,
first_event_at: chrono::DateTime<chrono::Utc>,
+ country_code: Option<String>,
) -> impl Iterator<Item = SnowflakeRow> {
body.events.into_iter().flat_map(move |event| {
let timestamp =
@@ -1553,6 +1554,9 @@ fn for_snowflake(
body.release_channel.clone().into(),
);
map.insert("signed_in".to_string(), event.signed_in.into());
+ if let Some(country_code) = country_code.as_ref() {
+ map.insert("country_code".to_string(), country_code.clone().into());
+ }
}
let user_properties = Some(serde_json::json!({