Skip to content

[JSON] Extra formatter flags for compactness #3390

@skeggse

Description

@skeggse

Feature Request

In addition to flatten_event and with_span_list for the json formatter, consider:

  • flatten_spans: pull all fields of all spans up to the root json object, overriding fields hierarchically; useful to reduce unnecessary bloat in the fields for small applications that make extensive use of spans to provide context
  • with_span_tail: only include the spans field when more than one span is present. when both with_current_span and with_span_list are enabled, you get the same span recorded twice, which is an eyesore and makes skimming logs more difficult.

Crates

  • tracing_subscriber

Motivation

Small applications that control most of their logging/tracing spans to provide context for individual log entries can have their outputs get fairly overwhelming due to the provided json formatting capabilities.

Proposal

Main drawback is added complexity.

Alternatives

A custom formatter, maybe? I'm not sure what that would entail. Or an adapter to help reorganize the spans into a coherent json record in a different way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions