Skip to content

Best Practice Usage of Trace ID #28

@ethangodt

Description

@ethangodt
  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first

Hello 👋

I'm working on a JS lib for my team and seeking advice about the best way to handle trace ids. I'm new to Open Telemetry, and my understanding at this point is that trace ids are used to correlate disparate events for enhanced visibility and discoverability.

For proof of concept work, I am currently testing with this vendor library which makes use of some default @open-telemetry instrumentations.

When I integrate this code into my page I'm correctly sending traces, but I'm noticing that there is a different trace id for each instrumentation. On one hand, it makes sense that fetch/ajax tracking have their own trace id (each request is traceable uniquely through a backend system), but in the case of other events (like all core web vitals, user click events, etc.) it seems desirable to correlate these with the same trace id.

Why do the libraries in this repo default to using a unique trace id in most cases? How should I think about this concept? Am I suppose to be supplying a trace id to these instrumentations at page load? Is there meaningful definition somewhere between a trace id and a session id?

Example:
image

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