feat(tvix/store/bin): disable --json option, set log to compact

This wasn't really used - to ingest logs in meachine-readable form, the
OTLP infrastructure is more suitable to provide structured logs than
parsing JSON from std{err}, as it also captures span information.

Also, the non-JSON output is a bit too spammy, as remarked in cl/11483 -
change it to `compact`.

Change-Id: I48007b84ba076ab566abbb6131a02868fe0eb397
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11526
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
This commit is contained in:
Florian Klink 2024-04-26 17:16:09 +03:00 committed by clbot
parent cab9c774b7
commit 88922bb207

View file

@ -56,10 +56,6 @@ use tvix_store::proto::FILE_DESCRIPTOR_SET;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
/// Whether to log in JSON
#[arg(long)]
json: bool,
/// Whether to configure OTLP. Set --otlp=false to disable.
#[arg(long, default_missing_value = "true", default_value = "true", num_args(0..=1), require_equals(true), action(clap::ArgAction::Set))]
otlp: bool,
@ -218,32 +214,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let level = cli.log_level.unwrap_or(Level::INFO);
// Set up the tracing subscriber.
let subscriber = tracing_subscriber::registry()
.with(
cli.json.then_some(
let subscriber = tracing_subscriber::registry().with(
tracing_subscriber::fmt::Layer::new()
.with_writer(std::io::stderr)
.json()
.compact()
.with_filter(
EnvFilter::builder()
.with_default_directive(level.into())
.from_env()
.expect("invalid RUST_LOG"),
),
),
)
.with(
(!cli.json).then_some(
tracing_subscriber::fmt::Layer::new()
.with_writer(std::io::stderr)
.pretty()
.with_filter(
EnvFilter::builder()
.with_default_directive(level.into())
.from_env()
.expect("invalid RUST_LOG"),
),
),
);
// Add the otlp layer (when otlp is enabled, and it's not disabled in the CLI)