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

new v0.18.1 released as patched but is actually a breaking change version #2055

Closed
blumamir opened this issue Mar 30, 2021 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@blumamir
Copy link
Member

Yesterday, a new patch version v0.18.1 was published.
This version depended on a new major version of @opentelemetry/api: ^1.0.0-rc.0.

Installing multiple versions of api package in the same application is not compatible as the symbols to access global apis such as context and propagation is different, causing different otel components to reference different globals.

Example of the issue that causes infinity loop on new v0.18.1:

// this code is referencing "@opentelemetry/api": "^0.18.0", thus setting the context on api major version 0.
        context.with(suppressInstrumentation(context.active()), () => {
            this.exporter.export([span], () => {});
        });

The exporter (v0.18.0) is using http module to export, which is calling http instrumentation (v0.18.0), which has dependency on "@opentelemetry/tracing": "^0.18.1". So when @opentelemetry/instrumentation-http is calling tracer startSpan, the invoked function is coming from @opentelemetry/[email protected] which has a dependency on @opentelemetry/[email protected], thus suppressInstrumentation has no effect which means exported spans are instrumented in an infinity loop.

Since the release of v0.18.1, any new installation of our (Aspecto), previously working SDK which depends on exact versions v0.18.0 is currently crashing the client application due to this issue.

This new version, which is marked as patch, will also find its way into all the plugins in contrib repo and in opentelemetry-ext-js which depends on api version ^0.18.0 but will receive 1.0.0-rc.0 version via dependency on ^0.18.0 of core packages.

I think the new core packages versions should be 0.19.0, and v0.18.1 should be unpublished from npm.

@blumamir blumamir added the bug Something isn't working label Mar 30, 2021
@dyladan
Copy link
Member

dyladan commented Mar 30, 2021

@dyladan dyladan closed this as completed Mar 30, 2021
@Flarna
Copy link
Member

Flarna commented Mar 31, 2021

Installing multiple versions of api package in the same application is not compatible as the symbols to access global apis such as context and propagation is different, causing different otel components to reference different globals.

Is this something we can/should improve in API? The main idea was to return Noop instances if version doesn't match but it should not crash nor end up in endless loops.

@blumamir
Copy link
Member Author

Is this something we can/should improve in API? The main idea was to return Noop instances if version doesn't match but it should not crash nor end up in endless loops.

I believe that it does return NOOP. Our endless loop happened due to the context not being set and read by the same api version, causing suppressInstrumentation not to work - which is a recipe for infinite loops.
There might be other issues such as propagation not working etc, but it will probably resolve when we move to api v.1.0.0 everywhere.

@vmarchaud
Copy link
Member

Is this something we can/should improve in API? The main idea was to return Noop instances if version doesn't match but it should not crash nor end up in endless loops.

We were discussing this in the maintainers conv and @dyladan suggested that the main problem is that components should have the API as peer dependency so they don't use their own api version (on major bump, npm/yarn will complain that the peer dependency isn't there if the user bump api without also bumping component), this would theorically avoid this problem.

@dyladan
Copy link
Member

dyladan commented Mar 31, 2021

I had not thought of the suppressInstrumentation case. I wonder if the NOOP context manager should return a context with instrumentation suppressed instead of returning the root context?

@blumamir
Copy link
Member Author

@dyladan to me it sounds like a good idea which will increase the robustness of the project - failing more securely in case of issues.
If there is no context manager installed, I see no point in returning a full "recording span" from startSpan.

@dyladan
Copy link
Member

dyladan commented Mar 31, 2021

Well there is no requirement to use a context manager currently. It is perfectly reasonable to manually pass around context objects without a context manager if you have tight performance concerns or unique use-cases.

In this case you wouldn't expect to use the context from the context manager at all so returning a suppressed context is OK.

@blumamir
Copy link
Member Author

If the user is managing the context himself, then he will not call context.active() (directly, or via default parameter to context parameter in startSpan), so it should not be a problem I believe.

In case user meant to handle context manually, but for some reason context.active() is called, then returning suppressed instrumentation context will protect him from potential issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants