Skip to content

Unify attribute typing and serialization #18164

@Lms24

Description

@Lms24

Right now, we have various implementations and type declarations for attributes, serialization/conversion, etc. Given that spans (v2), metrics and logs all accept the same attributes, we should unify the respective declarations and the logic. This probably saves some bundle size for multi-product users.

Fully unifying attribute typing and serialization is a breaking change because:

  • logs and metrics currently stringify array values
  • stringification is not handled perfectly well and we could extract more information from obscure values:
    • circular objects /h/t @s1gr1d for bringing up!)
    • undefined/null values
    • objects throwing in toJSON but having a toString
    • => All of these cases can be improved but are breaking changes in terms of values

Actually removing duplicated logic between logs, metrics and span attributes is not part of this issue and should be addressed in #18159, #18161, #18160 directly (i.e. before the next major).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions