feat: add debug logging for slice calculation and node management operations

This commit is contained in:
mik-tf
2025-09-09 00:19:43 -04:00
parent 52316319e6
commit 31f3834e6d
19 changed files with 597 additions and 4155 deletions

View File

@@ -427,6 +427,28 @@ impl DashboardController {
// Get resource provider nodes with updated slice calculations
let resource_provider_nodes = resource_provider_service.get_resource_provider_nodes(&user_email);
// DEBUG: Log template data being prepared
log::info!(
target: "debug.slice_trace",
"dashboard:template_data_prep user={} nodes_loaded_count={}",
user_email,
resource_provider_nodes.len()
);
// DEBUG: Log each node's slice data being sent to template
for node in &resource_provider_nodes {
log::info!(
target: "debug.slice_trace",
"dashboard:node_template_data user={} node_id={} grid_node_id={:?} total_base_slices={} allocated_base_slices={} available_combinations_count={}",
user_email,
node.id,
node.grid_node_id,
node.total_base_slices,
node.allocated_base_slices,
node.available_combinations.len()
);
}
// Calculate resource_provider statistics from nodes
let total_nodes = resource_provider_nodes.len() as u32;
let mut online_nodes = 0u32;
@@ -2524,6 +2546,17 @@ impl DashboardController {
pricing_mode
);
// DEBUG: Log which path will be taken
log::info!(
target: "debug.slice_trace",
"add_grid_nodes:path_decision req_id={} email={} slice_formats_count={} full_node_rental_enabled={} pricing_mode={}",
req_id,
user_email,
slice_formats.len(),
full_node_rental_enabled,
pricing_mode
);
let add_result = if !slice_formats.is_empty() || full_node_rental_enabled {
// Create rental options if full node rental is enabled
let rental_options = if full_node_rental_enabled {
@@ -2561,6 +2594,13 @@ impl DashboardController {
// Choose the appropriate method based on pricing mode
if pricing_mode == "individual" && individual_node_pricing.is_some() {
log::info!(
target: "debug.slice_trace",
"add_grid_nodes:calling_individual_pricing req_id={} email={} node_count={}",
req_id,
user_email,
node_ids.len()
);
resource_provider_service.add_multiple_grid_nodes_with_individual_pricing(
&user_email,
node_ids.clone(),
@@ -2568,6 +2608,13 @@ impl DashboardController {
individual_node_pricing.unwrap()
).await
} else {
log::info!(
target: "debug.slice_trace",
"add_grid_nodes:calling_comprehensive_config req_id={} email={} node_count={}",
req_id,
user_email,
node_ids.len()
);
resource_provider_service.add_multiple_grid_nodes_with_comprehensive_config(
&user_email,
node_ids.clone(),
@@ -2576,6 +2623,13 @@ impl DashboardController {
).await
}
} else {
log::info!(
target: "debug.slice_trace",
"add_grid_nodes:calling_simple_add req_id={} email={} node_count={}",
req_id,
user_email,
node_ids.len()
);
resource_provider_service.add_multiple_grid_nodes(&user_email, node_ids.clone()).await
};