Skip to content

Commit

Permalink
Adjust level of replication session and document materialization logs (
Browse files Browse the repository at this point in the history
…#639)

* Remove relay and direct peer poll attempt logging

* Change document creation/update/delete logging to info level

* Lower level of replication session logs to debug

* Update CHANGELOG

* Remove incorrectly commit file

* Lower logging level for replication finished message

* Fix logging logic error in reducer

* Improve GraphQL re-build error
  • Loading branch information
sandreae committed Jun 26, 2024
1 parent 5e66b62 commit 70220a2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Update `libp2p` to version `0.53.2` and apply API changes [#631](https://github.com/p2panda/aquadoggo/pull/631)
- Move relay registration into main network service event loop [#632](https://github.com/p2panda/aquadoggo/pull/632)
- Adjust level of replication and materialization logs [#639](https://github.com/p2panda/aquadoggo/pull/639)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion aquadoggo/src/graphql/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl GraphQLSchemaManager {
async fn rebuild(shared: GraphQLSharedData, schemas: GraphQLSchemas) {
match build_root_schema(shared.store, shared.tx, shared.schema_provider).await {
Ok(schema) => schemas.lock().await.push(schema),
Err(err) => warn!("Error building GraphQL schema: {}", err),
Err(err) => warn!("Can't re-build GraphQL schema: {}", err),
}
}

Expand Down
13 changes: 5 additions & 8 deletions aquadoggo/src/materializer/tasks/reduce.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use log::{debug, trace};
use log::{debug, info, trace};
use p2panda_rs::document::traits::AsDocument;
use p2panda_rs::document::{DocumentBuilder, DocumentId, DocumentViewId};
use p2panda_rs::operation::traits::{AsOperation, WithPublicKey};
Expand Down Expand Up @@ -226,23 +226,20 @@ async fn reduce_document<O: AsOperation + WithId<OperationId> + WithPublicKey>(

let mut tasks = vec![];

// If the document was deleted, then we return nothing
if document.is_deleted() {
debug!(
info!(
"Deleted {} final view {}",
document.display(),
document.view_id().display()
);
}

if document.is_edited() {
debug!(
} else if document.is_edited() {
info!(
"Updated {} latest view {}",
document.display(),
document.view_id().display()
);
} else {
debug!("Created {}", document.display());
info!("Created {}", document.display());
};

if document.is_deleted() || document.is_edited() {
Expand Down
2 changes: 0 additions & 2 deletions aquadoggo/src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ impl EventLoop {
async fn attempt_dial_known_addresses(&mut self) {
// Attempt to dial all relay addresses.
for relay_address in self.network_config.relay_addresses.iter_mut() {
debug!("Dial relay at address {}", relay_address);
dial_known_peer(
&mut self.swarm,
&mut self.known_peers,
Expand All @@ -269,7 +268,6 @@ impl EventLoop {

// Attempt to dial all direct peer addresses.
for direct_node_address in self.network_config.direct_node_addresses.iter_mut() {
debug!("Dial direct peer at address {}", direct_node_address);
dial_known_peer(
&mut self.swarm,
&mut self.known_peers,
Expand Down
6 changes: 3 additions & 3 deletions aquadoggo/src/replication/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;
use std::hash::Hash;

use anyhow::Result;
use log::{debug, info, trace, warn};
use log::{debug, trace, warn};
use p2panda_rs::entry::EncodedEntry;
use p2panda_rs::operation::EncodedOperation;
use p2panda_rs::Human;
Expand Down Expand Up @@ -179,7 +179,7 @@ where

let sessions = self.get_sessions(remote_peer);

info!(
debug!(
"Initiate outbound replication session with peer {}",
remote_peer.display()
);
Expand Down Expand Up @@ -393,7 +393,7 @@ where
.await;
};

info!(
debug!(
"Accept inbound replication session with peer {}",
remote_peer.display()
);
Expand Down
2 changes: 1 addition & 1 deletion aquadoggo/src/replication/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl ConnectionManager {

/// Handle successful replication sessions.
async fn on_replication_finished(&mut self, peer: Peer, _session_id: SessionId) {
info!("Finished replication with peer {}", peer.display());
debug!("Finished replication with peer {}", peer.display());

match self.peers.get_mut(&peer) {
Some(status) => {
Expand Down

0 comments on commit 70220a2

Please sign in to comment.