Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1166 Improve Network Monitor 1 #1182

Merged
merged 53 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0a94cd9
started transactions history
alexisbatyk Feb 13, 2024
5e965fc
working with fbs
alexisbatyk Feb 16, 2024
f3d73ce
more work in sending logs
alexisbatyk Feb 20, 2024
85ce460
client events gen and event msg sending in rust code
alexisbatyk Mar 4, 2024
64370fe
frontend changes
alexisbatyk Mar 4, 2024
57a1ef4
new changes
alexisbatyk Mar 13, 2024
e2fe525
fixed bugs on network-monitor
alexisbatyk Mar 14, 2024
9b08bea
more changes in ring_visualization
alexisbatyk Mar 15, 2024
ebc6936
adding timestamp to logs
alexisbatyk Aug 1, 2024
1cd1c8e
adding timestamp logs to transactions on the frontend
alexisbatyk Aug 1, 2024
04f8346
including timestamp on frontend tables. Formatting it to UTC and supp…
alexisbatyk Aug 6, 2024
461d3d2
sending contract_location on PutEvents - Rust code
alexisbatyk Aug 6, 2024
4ecdb72
contract_location added to fbs schemas
alexisbatyk Aug 6, 2024
528f126
using contract_location on transaction and contract tables
alexisbatyk Aug 6, 2024
6c5d532
location from contract key visibility fix
alexisbatyk Aug 6, 2024
c6154b9
fix throwing correct errors when parsing another fbs type
alexisbatyk Aug 6, 2024
4495434
added timestamp ordering to tables
alexisbatyk Aug 13, 2024
1f07b3a
fixed: always showing put changes as putrequest
alexisbatyk Aug 13, 2024
aa66d0f
storing transactions and contracts data and sending it at the beginni…
alexisbatyk Aug 14, 2024
7dab381
placed node ring below peers histogram and added two toggle buttos fo…
alexisbatyk Aug 14, 2024
81813c5
replace all any to an specific type
alexisbatyk Aug 15, 2024
e825094
deleted unused mock data and placed all mocks into mock_data.ts file
alexisbatyk Aug 15, 2024
1247a06
moving all interface or type declarations to type_definitions
alexisbatyk Aug 15, 2024
686c93c
Merge pull request #1 from alexisbatyk/1195-store-contract-data-on-fn…
alexisbatyk Aug 20, 2024
3832ba0
frontend table filters and ordering by timestamp with switching direc…
alexisbatyk Aug 20, 2024
e851934
added pagination component and integrated it to transactions, contrac…
alexisbatyk Aug 21, 2024
5a711b5
sending Broadcast Events to frontend to display on tables
alexisbatyk Aug 27, 2024
8a57ddf
including BroadcastReceived and BroadcastEmitted into network-monitor…
alexisbatyk Aug 28, 2024
09058a7
fixed bugs related to contract details history table and transactions…
alexisbatyk Aug 29, 2024
77063c0
sending more info from the backend to network-monitor
alexisbatyk Sep 11, 2024
3b67604
added mermaid as a dependency
alexisbatyk Sep 11, 2024
a02e26b
added transactions tree using mermaid and contract details peers ring…
alexisbatyk Sep 11, 2024
219f91b
added home page ring
alexisbatyk Sep 23, 2024
c3726cc
Merge branch 'main' into #1166-improve-network-monitor
alexisbatyk Sep 23, 2024
285679c
using bincode deserialize for PeerId structs
alexisbatyk Sep 23, 2024
1d3040e
Merge branch 'main' of https://github.com/freenet/freenet-core into #…
alexisbatyk Oct 2, 2024
18bc8b9
Merge branch 'main' of https://github.com/freenet/freenet-core into #…
alexisbatyk Oct 7, 2024
05ca31a
Changing fbs input of msg builder functions. Not using PeerId anymore…
alexisbatyk Oct 9, 2024
37cd17f
changed url to v1 network metrics server, and some frontend minor cha…
alexisbatyk Oct 9, 2024
140dfb8
Merge branch 'main' of https://github.com/freenet/freenet-core into #…
alexisbatyk Oct 9, 2024
9539841
cleaning stuff for PR
alexisbatyk Oct 9, 2024
c582885
ran cargo fmt
alexisbatyk Oct 9, 2024
f42105b
fixing clippy lint warnings
alexisbatyk Oct 9, 2024
db08714
fixed clippy erros
alexisbatyk Oct 9, 2024
6504843
Delete crates/fdev/anotherlog.log
iduartgomez Oct 10, 2024
d7cf5a3
Delete crates/fdev/msg_sent_to_element_log.log
iduartgomez Oct 10, 2024
15d0dd0
Delete crates/fdev/failinglog.log
iduartgomez Oct 10, 2024
c94bca4
Delete crates/fdev/log.log
iduartgomez Oct 10, 2024
9409485
fixing PR comments. Frontend JS changes
alexisbatyk Oct 10, 2024
7322695
fixed todo message on network_metrics_server when fbs message is not …
alexisbatyk Oct 10, 2024
74198ca
fix PR comments. removing unnecessary to_string on fbs msg building
alexisbatyk Oct 10, 2024
a9a72d6
fixed bug on frontend in mermaid tx chart with BroadcastEmitted
alexisbatyk Oct 11, 2024
19c268e
changing contract location column for requester peer location in cont…
alexisbatyk Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/core/src/client_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ pub(crate) mod test {
related_contracts: RelatedContracts::new(),
};

tracing::debug!("sending put to an existing contract");

return Some(request.into());
}
}
Expand Down
142 changes: 129 additions & 13 deletions crates/core/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub enum ContractChange<'a> {
PutRequest(topology::PutRequest<'a>),
PutSuccess(topology::PutSuccess<'a>),
PutFailure(topology::PutFailure<'a>),
BroadcastEmitted(topology::BroadcastEmitted<'a>),
BroadcastReceived(topology::BroadcastReceived<'a>),
}

// TODO: Change this to EventWrapper
Expand All @@ -35,6 +37,8 @@ impl ContractChange<'_> {
contract: String,
requester: String,
target: String,
timestamp: u64,
contract_location: f64,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let transaction = buf.create_string(transaction.as_str());
Expand All @@ -48,6 +52,8 @@ impl ContractChange<'_> {
key: Some(contract),
requester: Some(requester),
target: Some(target),
timestamp,
contract_location,
},
);
let msg = topology::ContractChange::create(
Expand All @@ -67,19 +73,23 @@ impl ContractChange<'_> {
contract: String,
requester: String,
target: String,
timestamp: u64,
contract_location: f64,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let transaction = buf.create_string(transaction.as_str());
let contract = buf.create_string(contract.as_str());
let requester = buf.create_string(requester.as_str());
let target = buf.create_string(target.to_string().as_str());
let target = buf.create_string(target.as_str());
let put_success = topology::PutSuccess::create(
&mut buf,
&topology::PutSuccessArgs {
transaction: Some(transaction),
key: Some(contract),
requester: Some(requester),
target: Some(target),
timestamp,
contract_location,
},
);
let msg = topology::ContractChange::create(
Expand All @@ -99,6 +109,7 @@ impl ContractChange<'_> {
contract: impl AsRef<str>,
requester: impl AsRef<str>,
target: impl AsRef<str>,
_timestamp: u64,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let transaction = buf.create_string(transaction.as_ref());
Expand All @@ -125,19 +136,104 @@ impl ContractChange<'_> {
buf.finish_minimal(msg);
buf.finished_data().to_vec()
}

pub fn broadcast_emitted_msg(
transaction: impl AsRef<str>,
upstream: impl AsRef<str>,
broadcast_to: Vec<String>,
broadcasted_to: usize,
contract_key: impl AsRef<str>,
sender: impl AsRef<str>,

timestamp: u64,
contract_location: f64,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let transaction = buf.create_string(transaction.as_ref());
let upstream = buf.create_string(upstream.as_ref());
let broadcast_to = broadcast_to
.iter()
.map(|s| buf.create_string(s.as_str()))
.collect::<Vec<_>>();
let broadcast_to = buf.create_vector(&broadcast_to);
let contract_key = buf.create_string(contract_key.as_ref());
let sender = buf.create_string(sender.as_ref());
let broadcast_emitted = topology::BroadcastEmitted::create(
&mut buf,
&topology::BroadcastEmittedArgs {
transaction: Some(transaction),
upstream: Some(upstream),
broadcast_to: Some(broadcast_to),
broadcasted_to: broadcasted_to as u32,
key: Some(contract_key),
sender: Some(sender),
timestamp,
contract_location,
},
);

let msg = topology::ContractChange::create(
&mut buf,
&topology::ContractChangeArgs {
contract_id: Some(contract_key),
change_type: topology::ContractChangeType::BroadcastEmitted,
change: Some(broadcast_emitted.as_union_value()),
},
);
buf.finish_minimal(msg);
buf.finished_data().to_vec()
}

pub fn broadcast_received_msg(
transaction: impl AsRef<str>,
target: impl AsRef<str>,
requester: impl AsRef<str>,
contract_key: impl AsRef<str>,

timestamp: u64,
contract_location: f64,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let transaction = buf.create_string(transaction.as_ref());
let target = buf.create_string(target.as_ref());
let requester = buf.create_string(requester.as_ref());
let contract_key = buf.create_string(contract_key.as_ref());
let broadcast_received = topology::BroadcastReceived::create(
&mut buf,
&topology::BroadcastReceivedArgs {
transaction: Some(transaction),
target: Some(target),
requester: Some(requester),
key: Some(contract_key),
timestamp,
contract_location,
},
);

let msg = topology::ContractChange::create(
&mut buf,
&topology::ContractChangeArgs {
contract_id: Some(contract_key),
change_type: topology::ContractChangeType::BroadcastReceived,
change: Some(broadcast_received.as_union_value()),
},
);
buf.finish_minimal(msg);
buf.finished_data().to_vec()
}
}

impl PeerChange<'_> {
pub fn current_state_msg<'a>(
to: PeerId,
to: String,
iduartgomez marked this conversation as resolved.
Show resolved Hide resolved
to_location: f64,
connections: impl Iterator<Item = &'a (PeerId, f64)>,
connections: impl Iterator<Item = &'a (String, f64)>,
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let to = buf.create_vector(&bincode::serialize(&to).unwrap());
let to = buf.create_vector(to.as_bytes());
let connections = connections
.map(|(from, from_location)| {
let from = Some(buf.create_vector(&bincode::serialize(from).unwrap()));
let from = Some(buf.create_vector(from.as_bytes()));
topology::AddedConnection::create(
&mut buf,
&topology::AddedConnectionArgs {
Expand Down Expand Up @@ -165,12 +261,12 @@ impl PeerChange<'_> {

pub fn added_connection_msg(
transaction: Option<impl AsRef<str>>,
(from, from_location): (PeerId, f64),
(to, to_location): (PeerId, f64),
(from, from_location): (String, f64),
iduartgomez marked this conversation as resolved.
Show resolved Hide resolved
(to, to_location): (String, f64),
) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let from = buf.create_vector(&bincode::serialize(&from).unwrap());
let to = buf.create_vector(&bincode::serialize(&to).unwrap());
let from = buf.create_vector(from.as_bytes());
let to = buf.create_vector(to.as_bytes());
let transaction = transaction.map(|t| buf.create_string(t.as_ref()));
let add_conn = topology::AddedConnection::create(
&mut buf,
Expand All @@ -194,10 +290,10 @@ impl PeerChange<'_> {
buf.finished_data().to_vec()
}

pub fn removed_connection_msg(at: PeerId, from: PeerId) -> Vec<u8> {
pub fn removed_connection_msg(at: String, from: String) -> Vec<u8> {
let mut buf = flatbuffers::FlatBufferBuilder::new();
let at = buf.create_vector(&bincode::serialize(&at).unwrap());
let from = buf.create_vector(&bincode::serialize(&from).unwrap());
let at = buf.create_vector(&at.as_bytes());
let from = buf.create_vector(&from.as_bytes());
let remove_conn = topology::RemovedConnection::create(
&mut buf,
&topology::RemovedConnectionArgs {
Expand Down Expand Up @@ -319,7 +415,27 @@ impl<'a> TryFromFbs<'a> for ContractChange<'a> {
})?;
Ok(Self::PutFailure(req))
}
_ => unreachable!(),
topology::ContractChangeType::BroadcastEmitted => {
let req = req.change_as_broadcast_emitted().ok_or_else(|| {
flatbuffers::InvalidFlatbuffer::InconsistentUnion {
field: "change_type",
field_type: "ContractChangeType",
error_trace: Default::default(),
}
})?;
Ok(Self::BroadcastEmitted(req))
}
topology::ContractChangeType::BroadcastReceived => {
let req = req.change_as_broadcast_received().ok_or_else(|| {
flatbuffers::InvalidFlatbuffer::InconsistentUnion {
field: "change_type",
field_type: "ContractChangeType",
error_trace: Default::default(),
}
})?;
Ok(Self::BroadcastReceived(req))
}
_ => unreachable!("Invalid contract change type"),
}
}
}
Loading
Loading