From 19c268e111000d22834ee3d25fa56f05994a5c9f Mon Sep 17 00:00:00 2001 From: Alexis Batyk Date: Fri, 11 Oct 2024 12:00:46 -0300 Subject: [PATCH] changing contract location column for requester peer location in contract details --- crates/core/src/tracing.rs | 8 ++++---- network-monitor/src/contract-detail.tsx | 7 ++++--- network-monitor/src/transactions-data.ts | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/crates/core/src/tracing.rs b/crates/core/src/tracing.rs index 6ee2cdb00..27b434c4c 100644 --- a/crates/core/src/tracing.rs +++ b/crates/core/src/tracing.rs @@ -217,7 +217,7 @@ impl<'a> NetEventLog<'a> { id, .. }) => { - let this_peer = &op_manager.ring.connection_manager.get_peer_key().unwrap(); + let this_peer = &op_manager.ring.connection_manager.own_location(); let key = contract.key(); EventKind::Put(PutEvent::Request { requester: this_peer.clone(), @@ -267,7 +267,7 @@ impl<'a> NetEventLog<'a> { .. }) => EventKind::Put(PutEvent::BroadcastReceived { id: *id, - requester: sender.peer.clone(), + requester: sender.clone(), key: *key, value: new_value.clone(), target: target.clone(), @@ -978,7 +978,7 @@ enum ConnectEvent { enum PutEvent { Request { id: Transaction, - requester: PeerId, + requester: PeerKeyLocation, key: ContractKey, target: PeerKeyLocation, timestamp: u64, @@ -1006,7 +1006,7 @@ enum PutEvent { BroadcastReceived { id: Transaction, /// peer who started the broadcast op - requester: PeerId, + requester: PeerKeyLocation, /// key of the contract which value was being updated key: ContractKey, /// value that was put diff --git a/network-monitor/src/contract-detail.tsx b/network-monitor/src/contract-detail.tsx index b10d477bc..0a7fe0b36 100644 --- a/network-monitor/src/contract-detail.tsx +++ b/network-monitor/src/contract-detail.tsx @@ -146,7 +146,8 @@ const ContractPeersHistory = ({ )} - Contract Location + Requester
+ Peer Location Transaction Id @@ -220,7 +221,7 @@ const ContractPeersHistory = ({ {tx.contract_id.slice(-8)} - {tx.contract_location} + {tx.requester_location} @@ -379,7 +380,7 @@ export const ContractDetail = ({

Contract Details

Contract Key {transaction.contract_id}

-

Contract Location {transaction.contract_location}

+

Contract Location {transaction.contract_location}

Requester {transaction.requester}

Target {transaction.target}

{/*

Status {transaction.status}

diff --git a/network-monitor/src/transactions-data.ts b/network-monitor/src/transactions-data.ts index 285de515f..fb6df386e 100644 --- a/network-monitor/src/transactions-data.ts +++ b/network-monitor/src/transactions-data.ts @@ -18,12 +18,19 @@ export function handlePutRequest( timestamp: number, contract_location: number ) { + let requester_location = parseFloat( + requester.split(" (@ ")[1].split(")")[0] + ); + + requester = requester.split(" (@")[0]; + let obj_data = { change_type, transaction_id, contract_id, target, requester, + requester_location, unique_id: transaction_id + contract_id + target + requester + change_type, timestamp, @@ -104,7 +111,7 @@ export function handleBroadcastEmitted( timestamp: number, contract_location: number ) { - let sender_location = sender.split(" (@")[1].split(")")[0]; + let sender_location = parseFloat(sender.split(" (@")[1].split(")")[0]); sender = sender.split(" (@")[0]; let upstream_location = upstream.split(" (@")[1].split(")")[0]; @@ -116,6 +123,7 @@ export function handleBroadcastEmitted( contract_id: key, target: broadcast_to, requester: sender, + requester_location: sender_location, unique_id: transaction_id + key + broadcast_to[0] + sender, timestamp, contract_location, @@ -148,12 +156,19 @@ export function handleBroadcastReceived( timestamp: number, contract_location: number ) { + let requester_location = parseFloat( + requester.split(" (@")[1].split(")")[0] + ); + + requester = requester.split(" (@")[0]; + let obj_data = { change_type, transaction_id, contract_id: key, target, requester, + requester_location, unique_id: transaction_id + key + target + requester, timestamp, contract_location,