Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript issues like "Type 'BatchSpanProcessor' is not assignable to type 'SpanProcessor'" since update to last OpenTelemetry packages #42

Closed
jitbasemartin opened this issue Jun 6, 2022 · 10 comments

Comments

@jitbasemartin
Copy link

Nestjs-OpenTelemetry seems not working with last opentelemetry packages like @opentelemetry/sdk-trace-base

I try to update Nestjs-OpenTelemetry to offer a fix but tests are not working

Here a sample of typescript issues:

error TS2322: Type 'BatchSpanProcessor' is not assignable to type 'SpanProcessor'.
  Types of property 'onStart' are incompatible.
    Type '(_span: Span, _parentContext: Context) => void' is not assignable to type '(span: Span, parentContext: Context) => void'.
      Types of parameters '_span' and 'span' are incompatible.
        Type 'import("node_modules/@opentelemetry/sdk-node/node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span' is not assignable to type 'import("node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span'.
          Types have separate declarations of a private property '_spanContext'.

error TS2322: Type 'HttpInstrumentation' is not assignable to type 'InstrumentationOption'.
  Type 'HttpInstrumentation' is not assignable to type 'Instrumentation'.
    Types of property 'setMeterProvider' are incompatible.
      Type '(meterProvider: import("node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/api-metrics/build/src/types/MeterProvider").MeterProvider) => void' is not assignable to type '(meterProvider: import("node_modules/@opentelemetry/api-metrics/build/src/types/MeterProvider").MeterProvider) => void'.
        Types of parameters 'meterProvider' and 'meterProvider' are incompatible.
          Type 'import("node_modules/@opentelemetry/api-metrics/build/src/types/MeterProvider").MeterProvider' is not assignable to type 'import("node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/api-metrics/build/src/types/MeterProvider").MeterProvider'.
            The types returned by 'getMeter(...)' are incompatible between these types.
              Type 'Meter' is missing the following properties from type 'Meter': addBatchObservableCallback, removeBatchObservableCallback
@rtuin
Copy link

rtuin commented Jun 13, 2022

Just ran into the same issue.
Workaround is to stick the @opentelemetry packages on 1.x, as suggested here.

@dyladan
Copy link

dyladan commented Jun 28, 2022

The latest packages should be working together. Otel releases happen for all packages in lockstep now to avoid this problem in the future.

@jitbasemartin
Copy link
Author

jitbasemartin commented Aug 18, 2022

Is it possible to update this package to last versions of Otel ?
I tried to run test without changes of this package and I got Jest timeout (even if I increase it)

@benaichouchemm
Copy link

I have all the latest packages and still see the issue:
@opentelemetry/api": "^1.1.0", "@opentelemetry/core": "^1.5.0", "@opentelemetry/sdk-trace-base": "^1.5.0", "@opentelemetry/auto-instrumentations-node": "^0.31.2", "@opentelemetry/exporter-trace-otlp-http": "^0.31.0", "@opentelemetry/instrumentation": "^0.31.0", "@opentelemetry/resources": "^1.5.0", "@opentelemetry/sdk-node": "^0.31.0", "@opentelemetry/sdk-trace-node": "^1.5.0", "@opentelemetry/sdk-trace-web": "^1.5.0", "@opentelemetry/semantic-conventions": "^1.5.0", "@opentelemetry/tracing": "^0.24.0",

@akshatflx
Copy link

akshatflx commented Sep 1, 2022

I had a similar issue (SimpleSpanProcessor is not assignable to type SpanProcessor). Resolved it by adding this block to my package.json -

"resolutions": {
     "@opentelemetry/sdk-trace-base": "^1.6.0"
}

@dyladan
Copy link

dyladan commented Sep 1, 2022

The package @opentelemetry/tracing is deprecated and will definitely not work with 1.5.0 or 0.31.0 packages

1.5.0 is not the latest for those stable packages, but 1.6.0 is.

@dyladan
Copy link

dyladan commented Sep 1, 2022

A full list of otel dependencies in package.json is definitely helpful when trying to debug these issues

@benaichouchemm
Copy link

Yeah changing 1.6.0 solved this issue, thanks.

@MetinSeylan
Copy link
Owner

#49

@faruk-arslan
Copy link

faruk-arslan commented Mar 1, 2023

Using
"@opentelemetry/exporter-zipkin": "^1.7.0"
"@opentelemetry/sdk-trace-base": "^1.7.0" should work now, since the "@metinseylan/nestjs-opentelemetry": "^3.0.0" uses these versions.
Try removing the existing packages from cli
npm uninstall @opentelemetry/sdk-trace-base @opentelemetry/exporter-zipkin
and install with defined versions npm i @opentelemetry/[email protected] @opentelemetry/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants