microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
325 stars 140 forks source link

Type 'Span' is missing the following properties from type 'Span': addLink, addLinks #1370

Closed gunzip closed 2 weeks ago

gunzip commented 2 months ago

It looks like there's a mismatch between the version of these packages:

@opentelemetry/api@^1.9.0 @opentelemetry/sdk-trace-base@^1.24.0

I get this error when building:

Type 'Span' is missing the following properties from type 'Span': addLink, addLinks

as the implementation here: https://github.com/open-telemetry/opentelemetry-js/blob/v1.24.0/packages/opentelemetry-sdk-trace-base/src/Span.ts#L57 misses addLink(s) methods, a breaking change as stated into the CHANGELOG:

https://github.com/open-telemetry/opentelemetry-js/blob/main/api/CHANGELOG.md#190

feat(api): allow adding span links after span creation https://github.com/open-telemetry/opentelemetry-js/pull/4536 @seemk This change is non-breaking for end-users, but breaking for Trace SDK implmentations in accordance with the specification as new features need to be implemented.

JacksonWeber commented 2 months ago

@gunzip Thank you for this catch. We'll update the appropriate OTel deps in the App Insights v3 project as they're out of sync with the dependency on the @azure/monitor-opentelemetry project.

JacksonWeber commented 2 months ago

@gunzip Fixed here: https://github.com/microsoft/ApplicationInsights-node.js/pull/1371 and tested building with TypeScript.

gunzip commented 2 months ago

Thank you @JacksonWeber! Are you gonna align the azure/functions package as well? I see monitor-opentelemetry uses 4.x

https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-opentelemetry/package.json#L67

JacksonWeber commented 2 months ago

@gunzip v4 of Azure Functions is supported in the distro at the moment, but there's further work to do to also support in App Insights 3.x SDK. I can work on that and should be able to support it by the time of the next release.

JacksonWeber commented 2 weeks ago

@gunzip the above PR should resolve your issue. Let me know and we can close this issue.

gunzip commented 2 weeks ago

Yes, solved now!