faro-web-sdk icon indicating copy to clipboard operation
faro-web-sdk copied to clipboard

Improvements to the tracing instrumentation

Open bfmatei opened this issue 1 year ago • 1 comments

Description

The tracing instrumentation brings the OpenTelemetry User Interaction instrumentation by default. Because of this, the tracing instrumentation also loads the OpenTelemetry Zone Context Manager.

The problem is that the User Interaction instrumentation is not bringing enough value to justify enabling it by default, especially because we also allow the users to load their own instrumentation and pass their own context manager.

Even if one passes a "hardcoded" array of instrumentation when initializing the tracing instrumentation and another context manager, zone.js is still loaded.

Proposed solution

There are a couple of solutions I have in mind:

  • do not embed the user interaction instrumentation in the tracing instrumentation package. Doing so would allow us to remove the zone context manager from the default configuration.
  • make the user interaction instrumentation optional along with zone.js context manager. If you choose this path, be sure to load the due using dynamic imports rather than a sync import in order to avoid zone.js from being initialized.

Context

bfmatei avatar Apr 19 '23 08:04 bfmatei