Skip to content

Allow access to recorded span fields (JsonFields) from outside the crate #31

@thaapasa

Description

@thaapasa

Feature Request

Motivation

We use json-subscriber to create logging records in our project. We use the provided functionality for grabbing the span records and flattening them. This is fine, but we'd like to be able to do several other things, that are not currently possible with json-subscriber, such as:

  • rename field names (we want to dedot the custom field name unders spans and fields, so that we do not accidentally include conflicting keys such as "foo" and "foo.bar" that cause log parsing to fail in Elasticsearch)
  • merge all custom fields from spans and logging event under the same key "fields" instead of "fields" and "spans"

This is not possible using json-subscribed because the span data is recorded using the crate-internal JsonFields that we cannot access from outside the crate.

Proposal

Expose the JsonFields extension from the crate, so that we can do similar operations like "DynamicFromSpan" and access the extensions from outside the crate.

Alternatives

Alternatively, you could expose the span data in a controlled manner, like provide a way to get the recorded span attributes so that we could generate the log record using that manually. Either as a flattened list or as a list with the values for each span in their own entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions