Skip to content

Make streamed span types the default in public APIs #22349

Description

@Lms24

Right now, we have a lot of APIs tailored to our SpanJSON type, which reflects the child span protocol in transactions. When span streaming becomes the default, we should adjust our public API to reflect the StreamedSpan type.

This is a breaking change, as some fields have been renamed or removed/added newly in the respective types.

I propose we make these changes:

  1. beforeSendSpan callback will emit a StreamedSpanJSON
    1. To ensure a compatibiltiy path with the transaction fallback, we can export a withTransactionSpan helper, users that users wrap their callback in. This is exactly how the callback today is made compatible with span streaming but flipped once span streaming becomes the default.
  2. spanToJson will emit a StreamedSpanJSON(this is mostly internally used but it's publicly exported)
    1. This ensures the default experience for anyone using spanToJSON matches the type of beforeSendSpan to only confront users with one PoJo span type. Internally, it should also help us write span-streaming-native code.
    2. For us, we'll need a spanToLegacyJSON (naming TBD) which we can expose in transaction code paths (event processors, beforeSendTransaction, etc). Maybe we can avoid exporting this from packages other than core, since it will go away once we remove transcations in v12. Ideally, we work with the new spanToJSON in as many places as possible but this remains TBD.

TBD for v12: We could rename StreamedSpanJSON to SpanJSON for a more concise and intuitive name, since at this point, transactions and legacy child spans will be gone.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions