Skip to content

Commit

Permalink
Merge branch 'master' into ko-stream-rates
Browse files Browse the repository at this point in the history
  • Loading branch information
kincaidoneil authored Feb 7, 2020
2 parents 1c5ffed + cb91ed4 commit f17616f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/ilp-node/src/instrumentation/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn trace_incoming<A: Account>(
);
let _details_scope = details_span.enter();

next.handle_request(request).in_current_span().await
trace_response(next.handle_request(request).in_current_span().await)
}

/// Add tracing context when the incoming request is
Expand Down
3 changes: 1 addition & 2 deletions crates/ilp-node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ impl InterledgerNode {
if #[cfg(feature = "monitoring")] {
let outgoing_service_fwd = outgoing_service
.clone()
.wrap(trace_forwarding)
.in_current_span();
.wrap(trace_forwarding);
} else {
let outgoing_service_fwd = outgoing_service.clone();
}
Expand Down
48 changes: 48 additions & 0 deletions docs/logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Logging

Logs are created via the `tracing` crates. We define various _scopes_ depending on the operation we want to trace at various debug levels. The log level can be set via the `RUST_LOG` environment variable, and via the `/tracing-level` at runtime by the node operator.

For each request we track various information depending on the error log lvel:
- **Incoming**:
- `ERROR`:
- `request.id`: a randomly generated uuid for that specific request
- `prepare.destination`: the destination of the prepare packet inside the request
- `prepare.amount`: the amount in the prepare packet inside the request
- `from.id`: the request sender's account uuid
- `DEBUG`:
- `from.username`: the request sender's username
- `from.ilp_address`: the request sender's ilp address
- `from.asset_code`: the request sender's asset code
- `from.asset_scale`: the request sender's asset scale
- **Forwarding** (this is shown when an incoming request is turned into an outgoing request and is being forwarded to a peer):
- `ERROR`:
- `prepare.amount`: the amount in the prepare packet inside the request
- `from.id`: the request sender's account uuid
- `DEBUG`:
- `to.username`: the request receiver's username
- `to.ilp_address`: the request receiver's ilp address
- `to.asset_code`: the request receiver's asset code
- `to.asset_scale`: the request receiver's asset scale
- **Outgoing**:
- `ERROR`:
- `request.id`: a randomly generated uuid for that specific request
- `prepare.destination`: the destination of the prepare packet inside the request
- `from.id`: the request sender's account uuid
- `to.id`: the request receiver's account uuid
- `DEBUG`:
- `from.username`: the request sender's username
- `from.ilp_address`: the request sender's ilp address
- `from.asset_code`: the request sender's asset code
- `from.asset_scale`: the request sender's asset scale
- `to.username`: the request receiver's username
- `to.ilp_address`: the request receiver's ilp address
- `to.asset_code`: the request receiver's asset code
- `to.asset_scale`: the request receiver's asset scale

Then, depending on the response received for the request, we add additional information to that log:
- `Fulfill`: We add a scope `"result = fulfill"` at the `DEBUG` level
- `fulfillment`: the fulfill packet's fulfillment condition
- `Reject`: We add a scope `"result = "reject"` at the INFO level
- `reject.code`: the reject packet's error code field
- `reject.message`: the reject packet's message field
- `reject.triggered_by`: the reject packet's triggered_by field

0 comments on commit f17616f

Please sign in to comment.