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

parent: None is not respected by json() format #2973

Open
howardjohn opened this issue May 17, 2024 · 0 comments · May be fixed by #2978
Open

parent: None is not respected by json() format #2973

howardjohn opened this issue May 17, 2024 · 0 comments · May be fixed by #2978

Comments

@howardjohn
Copy link
Contributor

Bug Report

Version

tracing v0.1.40 (head of master)

Platform

Linux

Crates

tracing_subscriber

Description

Reproducer:

    tracing_subscriber::fmt()
        // .json()
        .with_max_level(tracing::Level::TRACE)
        // .with_current_span(false)
        .init();

    let span1 = tracing::info_span!("this should never be seen", xyz = "123");
    span1.in_scope(|| {
        tracing::event!(target: "tgt", parent: None, tracing::Level::ERROR, foo="bar", "hello");
    });

Output with/without json:

{"timestamp":"2024-05-17T17:09:37.232034Z","level":"ERROR","fields":{"message":"hello","foo":"bar"},"target":"tgt","spans":[{"xyz":"123","name":"this should never be seen"}]}
2024-05-17T17:09:43.082169Z ERROR tgt: hello foo="bar"

Same removing parent: None:

{"timestamp":"2024-05-17T17:11:23.804525Z","level":"ERROR","fields":{"message":"hello","foo":"bar"},"target":"tgt","spans":[{"xyz":"123","name":"this should never be seen"}]}
2024-05-17T17:11:20.205478Z ERROR this should never be seen{xyz="123"}: tgt: hello foo="bar"

You can see while the plain formater respects parent: None, the json one seems to ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant