chore: add loadtest observability setup

This commit is contained in:
kdletters
2026-05-16 22:44:30 +08:00
parent 7f16e88e57
commit 0305b79440
55 changed files with 2867 additions and 1622 deletions

View File

@@ -12,7 +12,7 @@ impl SpacetimeClient {
) -> Result<Vec<CustomWorldLibraryEntryRecord>, SpacetimeClientError> {
let procedure_input = CustomWorldProfileListInput { owner_user_id };
self.call_after_connect(move |connection, sender| {
self.call_after_connect("list_custom_world_profiles", move |connection, sender| {
connection.procedures().list_custom_world_profiles_then(
procedure_input,
move |_, result| {
@@ -36,16 +36,19 @@ impl SpacetimeClient {
profile_id,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_custom_world_library_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_detail_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"get_custom_world_library_detail",
move |connection, sender| {
connection
.procedures()
.get_custom_world_library_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_detail_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -55,16 +58,22 @@ impl SpacetimeClient {
) -> Result<CustomWorldLibraryMutationRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.upsert_custom_world_profile_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"upsert_custom_world_profile_and_return",
move |connection, sender| {
connection
.procedures()
.upsert_custom_world_profile_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -86,16 +95,22 @@ impl SpacetimeClient {
published_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.publish_custom_world_profile_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"publish_custom_world_profile_and_return",
move |connection, sender| {
connection
.procedures()
.publish_custom_world_profile_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -113,19 +128,22 @@ impl SpacetimeClient {
updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.unpublish_custom_world_profile_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
},
);
})
self.call_after_connect(
"unpublish_custom_world_profile_and_return",
move |connection, sender| {
connection
.procedures()
.unpublish_custom_world_profile_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -141,32 +159,41 @@ impl SpacetimeClient {
deleted_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.delete_custom_world_profile_and_return_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_profile_list_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"delete_custom_world_profile_and_return",
move |connection, sender| {
connection
.procedures()
.delete_custom_world_profile_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_profile_list_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn list_custom_world_gallery_entries(
&self,
) -> Result<Vec<CustomWorldGalleryEntryRecord>, SpacetimeClientError> {
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.list_custom_world_gallery_entries_then(move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_gallery_list_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"list_custom_world_gallery_entries",
move |connection, sender| {
connection
.procedures()
.list_custom_world_gallery_entries_then(move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_gallery_list_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -180,16 +207,19 @@ impl SpacetimeClient {
profile_id,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_custom_world_gallery_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"get_custom_world_gallery_detail",
move |connection, sender| {
connection
.procedures()
.get_custom_world_gallery_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -199,16 +229,22 @@ impl SpacetimeClient {
) -> Result<CustomWorldLibraryMutationRecord, SpacetimeClientError> {
let procedure_input = CustomWorldGalleryDetailByCodeInput { public_work_code };
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_custom_world_gallery_detail_by_code_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"get_custom_world_gallery_detail_by_code",
move |connection, sender| {
connection
.procedures()
.get_custom_world_gallery_detail_by_code_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -225,7 +261,7 @@ impl SpacetimeClient {
remixed_at_micros: input.remixed_at_micros,
};
self.call_after_connect(move |connection, sender| {
self.call_after_connect("remix_custom_world_profile", move |connection, sender| {
connection.procedures().remix_custom_world_profile_then(
procedure_input,
move |_, result| {
@@ -249,16 +285,19 @@ impl SpacetimeClient {
played_at_micros: input.played_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.record_custom_world_profile_play_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"record_custom_world_profile_play",
move |connection, sender| {
connection
.procedures()
.record_custom_world_profile_play_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -273,16 +312,19 @@ impl SpacetimeClient {
liked_at_micros: input.liked_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.record_custom_world_profile_like_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"record_custom_world_profile_like",
move |connection, sender| {
connection
.procedures()
.record_custom_world_profile_like_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -292,7 +334,7 @@ impl SpacetimeClient {
) -> Result<CustomWorldPublishWorldRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(move |connection, sender| {
self.call_after_connect("publish_custom_world_world", move |connection, sender| {
connection.procedures().publish_custom_world_world_then(
procedure_input,
move |_, result| {
@@ -331,16 +373,19 @@ impl SpacetimeClient {
created_at_micros: input.created_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.create_custom_world_agent_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_session_procedure_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"create_custom_world_agent_session",
move |connection, sender| {
connection
.procedures()
.create_custom_world_agent_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_session_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -354,17 +399,20 @@ impl SpacetimeClient {
owner_user_id,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().get_custom_world_agent_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
})
self.call_after_connect(
"get_custom_world_agent_session",
move |connection, sender| {
connection.procedures().get_custom_world_agent_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -374,7 +422,7 @@ impl SpacetimeClient {
) -> Result<Vec<CustomWorldWorkSummaryRecord>, SpacetimeClientError> {
let procedure_input = CustomWorldWorksListInput { owner_user_id };
self.call_after_connect(move |connection, sender| {
self.call_after_connect("list_custom_world_works", move |connection, sender| {
connection.procedures().list_custom_world_works_then(
procedure_input,
move |_, result| {
@@ -398,16 +446,19 @@ impl SpacetimeClient {
owner_user_id,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.delete_custom_world_agent_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_works_list_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"delete_custom_world_agent_session",
move |connection, sender| {
connection
.procedures()
.delete_custom_world_agent_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_works_list_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -423,16 +474,19 @@ impl SpacetimeClient {
card_id,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_custom_world_agent_card_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_draft_card_detail_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"get_custom_world_agent_card_detail",
move |connection, sender| {
connection
.procedures()
.get_custom_world_agent_card_detail_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_draft_card_detail_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -449,16 +503,19 @@ impl SpacetimeClient {
submitted_at_micros: input.submitted_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.execute_custom_world_agent_action_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_action_execute_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"execute_custom_world_agent_action",
move |connection, sender| {
connection
.procedures()
.execute_custom_world_agent_action_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_action_execute_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -475,16 +532,19 @@ impl SpacetimeClient {
submitted_at_micros: input.submitted_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.submit_custom_world_agent_message_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"submit_custom_world_agent_message",
move |connection, sender| {
connection
.procedures()
.submit_custom_world_agent_message_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
@@ -521,19 +581,22 @@ impl SpacetimeClient {
updated_at_micros: input.updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.finalize_custom_world_agent_message_turn_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
},
);
})
self.call_after_connect(
"finalize_custom_world_agent_message_turn",
move |connection, sender| {
connection
.procedures()
.finalize_custom_world_agent_message_turn_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -556,19 +619,22 @@ impl SpacetimeClient {
updated_at_micros: input.updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.upsert_custom_world_agent_operation_progress_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
},
);
})
self.call_after_connect(
"upsert_custom_world_agent_operation_progress",
move |connection, sender| {
connection
.procedures()
.upsert_custom_world_agent_operation_progress_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
@@ -584,16 +650,19 @@ impl SpacetimeClient {
operation_id,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_custom_world_agent_operation_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
});
})
self.call_after_connect(
"get_custom_world_agent_operation",
move |connection, sender| {
connection
.procedures()
.get_custom_world_agent_operation_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_custom_world_agent_operation_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
}