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

Add support for silent mode and trace logging #553

Merged
merged 7 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Added interactive GeoIp map display ([#505](https://github.com/fujiapple852/trippy/issues/505))
- Added support for the [paris](https://github.com/libparistraceroute/libparistraceroute) ECMP traceroute strategy
for `IPv4/udp` ([#542](https://github.com/fujiapple852/trippy/issues/542))
- Added `silent` reporting mode to run tracing without producing any
output ([#555](https://github.com/fujiapple852/trippy/issues/555))
- Added `-v` (`--verbose`), `--log-format`, `--log-filter` & `--log-span-events` flags to support generating debug trace
logging output ([#552](https://github.com/fujiapple852/trippy/issues/552))

### Changed

Expand Down
137 changes: 137 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ thiserror = "1.0.40"
derive_more = "0.99.17"
arrayvec = "0.7.2"
socket2 = { version = "0.5.2", features = [ "all" ] }
tracing = "0.1.37"

# TUI dependencies
anyhow = "1.0.71"
Expand All @@ -46,6 +47,8 @@ etcetera = "0.8.0"
toml = "0.7.3"
indexmap = "1.9.3"
maxminddb = "0.23.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }
tracing-chrome = "0.7.1"

# Library dependencies (Linux)
[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ Generate `bash` shell completions (or `fish`, `powershell`, `zsh`, `elvish`):
trip --generate bash
```

Run in `silent` tracing mode and output `compact` trace logging with `full` span events:

```shell
trip www.example.com -m silent -v --log-format compact --log-span-events full
```

## Command Reference

```shell
Expand All @@ -347,6 +353,7 @@ Options:
- markdown: Generate a markdown text table report for N cycles
- csv: Generate a SCV report for N cycles
- json: Generate a JSON report for N cycles
- silent: Do not generate any tracing output for N cycles

-p, --protocol <PROTOCOL>
Tracing protocol [default: icmp]
Expand Down Expand Up @@ -511,6 +518,29 @@ Options:

[possible values: bash, elvish, fish, powershell, zsh]

--log-format <LOG_FORMAT>
The debug log format [default: pretty]

Possible values:
- compact: Display log data in a compact format
- pretty: Display log data in a pretty format
- json: Display log data in a json format
- chrome: Display log data in Chrome trace format

--log-filter <LOG_FILTER>
The debug log filter [default: trippy=debug]

--log-span-events <LOG_SPAN_EVENTS>
The debug log format [default: off]

Possible values:
- off: Do not display event spans
- active: Display enter and exit event spans
- full: Display all event spans

-v, --verbose
Enable verbose debug logging

-h, --help
Print help (see a summary with '-h')

Expand Down
2 changes: 2 additions & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use parking_lot::RwLock;
use std::net::{IpAddr, Ipv4Addr};
use std::sync::Arc;
use std::time::Duration;
use tracing::instrument;
use trippy::tracing::{
Probe, ProbeStatus, Tracer, TracerChannel, TracerChannelConfig, TracerConfig, TracerRound,
};
Expand Down Expand Up @@ -266,6 +267,7 @@ impl Default for Hop {
///
/// Note that this implementation blocks the tracer on the `RwLock` and so any delays in the the TUI will delay the
/// next round of the started.
#[instrument(skip_all)]
pub fn run_backend(
tracer_config: &TracerConfig,
channel_config: &TracerChannelConfig,
Expand Down
Loading