grafana / faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
https://grafana.com/oss/faro/
Apache License 2.0
689 stars 62 forks source link

Declare specified OTel package versions as a peer dependency to prevent problems caused by different versions #354

Open codecapitano opened 8 months ago

codecapitano commented 8 months ago

Description

Using different OTel versions can cause problems if Faro would not used the version as specified.

Proposed solution

Declare respective packages as peer-dependencies

Memfisrain commented 7 months ago

Hey @codecapitano, do you have any updated on this?

I am having an issues with different versions of @opentelemetry packages in my build. When it was 1.2.0 version I had to add in package.json resolution the following:

{
  "resolutions": {
    "@opentelemetry/core": "1.15.2",
    "@opentelemetry/resources": "1.15.2",
    "@opentelemetry/semantic-conventions": "1.15.2",
    "@opentelemetry/sdk-trace-base": "1.15.2",
    "@opentelemetry/sdk-trace-web": "1.15.2"
  }

Now I switched to 1.2.8 faro and got one more complaint:

ERROR in @opentelemetry/instrumentation
  Multiple versions of @opentelemetry/instrumentation found:
    0.41.2 /builds/product/web-app/~/@opentelemetry/instrumentation from /builds/product/web-app/~/libjs-pdobservability/traces/traces.js
    0.44.0 /builds/product/web-app/~/@grafana/faro-web-tracing/~/@opentelemetry/instrumentation from /builds/product/web-app/~/@grafana/faro-web-tracing/dist/cjs/instrumentation.js
Memfisrain commented 7 months ago

And one more issue with dependency as I can see is:

  1. I would like to install "@grafana/faro-web-sdk": "1.2.4" and "@grafana/faro-web-tracing": "1.2.4"
  2. When I look into my node_modules I can see, that @grafana/faro-web-tracing installs it's own @grafana/faro-web-sdk@1.2.8

That again trigger multiple versions of package error

codecapitano commented 7 months ago

Hi @Memfisrain thanks for bumping this,

Will updat the otel deps in the web-tracing package and clean up our own resolutions (seems they cause problems with recent otel version and we don't need them anymore).

Also I'll declare the otel packages we use as peer deps.

You can track it here.

Unfortunately we will release the next Faro version after Black Friday or maybe even after Black Week.

Cheers, Marco

SimenB commented 7 months ago

Not actually fixed

codecapitano commented 7 months ago

Not actually fixed

@SimenB can you give me a brief description. Is it still the problem with different package versions in a build?

SimenB commented 7 months ago

Title of issue is "use peer deps" - in that regard I don't think it should be considered completed. Dependency mismatch has been fixed, tho 👍

codecapitano commented 7 months ago

Title of issue is "use peer deps" - in that regard I don't think it should be considered completed. Dependency mismatch has been fixed, tho 👍

Thank you Simen.

Yes good catch, it got auto closed because of the linked PR. Will reopen the issue.

codecapitano commented 7 months ago

Quick heads up @Memfisrain and @SimenB. We released Faro v1.2.9 which contains the updated otel-deps in the web-tracing package.