diff --git a/books/architecture/src/SUMMARY.md b/books/architecture/src/SUMMARY.md index d97d223d..a541ab81 100644 --- a/books/architecture/src/SUMMARY.md +++ b/books/architecture/src/SUMMARY.md @@ -81,8 +81,7 @@ --- - [🔴 Instrumentation](instrumentation/intro.md) - - [⚪️ Logging](instrumentation/logging.md) - - [⚪️ Data collection](instrumentation/data-collection.md) + - [⚪️ Targets](instrumentation/targets.md) --- diff --git a/books/architecture/src/instrumentation/data-collection.md b/books/architecture/src/instrumentation/data-collection.md deleted file mode 100644 index 7ea3d9fc..00000000 --- a/books/architecture/src/instrumentation/data-collection.md +++ /dev/null @@ -1 +0,0 @@ -# ⚪️ Data collection diff --git a/books/architecture/src/instrumentation/intro.md b/books/architecture/src/instrumentation/intro.md index 33640dd2..d0c38d94 100644 --- a/books/architecture/src/instrumentation/intro.md +++ b/books/architecture/src/instrumentation/intro.md @@ -1,2 +1,6 @@ # Instrumentation -Cuprate is built with [instrumentation](https://en.wikipedia.org/wiki/Instrumentation) in mind. \ No newline at end of file +Cuprate is built with [instrumentation](https://en.wikipedia.org/wiki/Instrumentation) in mind. +The [tracing](https://docs.rs/tracing/latest/tracing/) crate is used to provide "structured, event-based diagnostic information". + +As described in the tracing crate docs, there are 3 main concepts: spans, events and subscribers. Small explanations for +each will be included in the following chapters, however you should probably read the tracing docs. \ No newline at end of file diff --git a/books/architecture/src/instrumentation/targets.md b/books/architecture/src/instrumentation/targets.md new file mode 100644 index 00000000..28fcef78 --- /dev/null +++ b/books/architecture/src/instrumentation/targets.md @@ -0,0 +1,60 @@ +# Targets +The target is described in the `tracing `docs as: + +> a string that categorizes part of the system where the span or event occurred. + +By default, the `tracing` crate will use the module path as the target, we override this to make it easier for users +to filter logs. + +`tracing-subscriber` allows filtering logs based on target prefixes: [Targets](https://docs.rs/tracing-subscriber/0.3.18/tracing_subscriber/filter/targets/struct.Targets.html#). +To reduce potential friction by using custom targets we mimic what module paths would look like by using `::`. + +`` + +### P2P + +| Target | Description | +|-------------------------------|---------------------------------------------------------| +| `p2p` | Anything to do with the peer to peer network. | +| `p2p::address_book` | The address book of P2P peers. | +| `p2p::connection` | Anything to do with P2P connections. | +| `p2p::connection::levin` | The levin protocol parser. | +| `p2p::connection::handshaker` | The handshaker handles doing handshakes with new peers. | +| `p2p::connection::task` | The task that maintains the peer connection. | +| `p2p::peer_set` | Contains connected peers. | +| `p2p::outbound_maintainer` | Maintains the outbound connection count. | +| `p2p::inbound_server` | Handles incoming P2P connections. | +| `p2p::block_downloader` | Downloads blocks when we fall behind. | + +### Dandelion + +| Target | Description | +|---------------------------|---------------------------------| +| `dandelion` | Anything to do with dandelion++ | +| `dandelion::pool_manager` | The dandelion pool manager. | +| `dandelion::router` | The dandelion router. | + +### Consensus + +| Target | Description | +|-----------------------------|--------------------------------| +| `consensus` | Anything to do with consensus. | +| `consensus::block_verifier` | Block verification. | +| `consensus::tx_verifier` | Transaction verification. | + +### Storage + +| Target | Description | +|-----------------------|----------------------------------| +| `storage` | Anything to do with storage. | +| `storage::service` | The storage service abstraction. | +| `storage::blockchain` | Blockchain storage. | +| `storage::txpool` | Txpool storage. | + +### cuprated + +| Target | Description | +|--------------|----------------------------------| +| `blockchain` | | +| `txpool` | | +| | | diff --git a/p2p_state.bin b/p2p_state.bin new file mode 100644 index 00000000..c1caa240 Binary files /dev/null and b/p2p_state.bin differ