microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
320 stars 138 forks source link

@azure/monitor-opentelemetry 1.0.0-beta.2 breaking changes #1199

Closed matwilko closed 10 months ago

matwilko commented 10 months ago

The 3.0.0-beta.7 package depends on @azure/monitor-opentelemetry with a semver of ^1.0.0-beta.1. However, this causes upgrades to new beta versions which can (and now do) including breaking changes.

1.0.0-beta.2 has removed AzureMonitorOpenTelemetryClient, and replaced with a call to useAzureMonitor - so installing applicationinsights@3.0.0-beta.7 and attempting to new up a TelemetryClient causes a crash:

TypeError: monitor_opentelemetry_1.AzureMonitorOpenTelemetryClient is not a constructor
    at new TelemetryClient (....\node_modules\applicationinsights\out\src\shim\telemetryClient.js:44:24)

This can be resolved with a manual resolution in package.json, forcing @azure/monitor-opentelemetry to remain at 1.0.0-beta.1.

I'd suggest that in future releases, exact version matches be used for dependencies that are also pre-release and subject to breaking changes between "compatible according to semver" versions.

hectorhdzg commented 10 months ago

This should be resolved now as we temporary removed that dependency, we will make sure to pin specific version for beta dependencies to avoid this in the future