-
Notifications
You must be signed in to change notification settings - Fork 821
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
feat(otlp-transformer): Do not limit @opentelemetry/api
upper range peerDependency
#4816
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -59,7 +59,7 @@ | |||
"README.md" | |||
], | |||
"peerDependencies": { | |||
"@opentelemetry/api": ">=1.3.0 <1.10.0" | |||
"@opentelemetry/api": "^1.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This here is fine to unpin as it does not implement the API. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I kind of get it now. Took me some time and iterations to really wrap my head around this. I think what confused me additionally is that this package here had this (which, as you stated, does not need it), which is also how we stumbled over this problem in the first place. So I'll just fix this one place instead! 👍
@pichlermarc I am also following this thread. I struggle to understand the reasoning for clamping the version range like this. Especially considering the spec you linked:
To me, this would very much indicate that it is absolutely safe to allow for a specific version and above within a major ( Do you happen to have an example for how this is necessary? I understand that extending an interface will be fine for consumers, but break for implementors, however, that seems to be forbidden by the spec and instead replacement interfaces should be provided:
|
Example: Adding a new instrument to the
There's a difference between the API and the SDK. |
…dency" This reverts commit d0dd3d5.
@opentelemetry/api
upper range peerDependency@opentelemetry/api
upper range peerDependency
I updated this to only unclamp this for otlp-transformer! @pichlermarc thanks for the explanations! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Please also add a changelog entry, then we can merge this. 🙂
A side note about this situation: I agree that ideally we'd have an API setup that allows for just depending on the caret range, no matter if you're implementor or consumer. We may be able to do such a thing but we'd need to do a lot of prototyping before we can consider changing the API in such a way. There are a lot of edge-cases that come with providing a "partial" no-op (which would be the natural result of that) that can cause issues.
The spec kind of intends it to be this way and I can see the original reasoning behind that choice. However, combined with some TypeScript/NPM limitations it ends up being quite clunky and not very user-friendly.
I think we should have at least documentation about API limitations and best-practices (it was also hard to wrap my head around the topic when I joined the SIG).
Me and @mydea thought a lot about this offline and I settled my mental model on the fact that SemVer is sometimes actually really hard to properly get right when you have implementors. It becomes a trade-off between wanting to be super correct, and being user-friendly but risking breakage. In theory, even simple stuff that you may think will never break anybody, like for example turning the return type of a simple exported function from In our packages in the Sentry JS SDKs we probably don't adhere to SemVer in the strictest of ways (still we never had anybody complain). The only API where we are careful is our Here, whenever we want to add surface, we first add it as optional field, and then in a major we may make it non-optional. This comes with a bit of internal implementation complexity but it is probably worth it. I am not familiar enough with the OTEL implementations and whether OTEL already has this pattern but I still wanted to bring it up for posterity. |
I added a changelog entry, I figure this is an enhancement 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving to Marc to merge. He's the "otlp-transformer" and "exporter"-king.
… peerDependency (open-telemetry#4816) * feat: Do not limit `@opentelemetry/api` upper range peerDependency * Revert "feat: Do not limit `@opentelemetry/api` upper range peerDependency" This reverts commit d0dd3d5. * only unclamp otlp-transformer * Add changelog entry --------- Co-authored-by: Marc Pichler <[email protected]>
Today, some packages define a peer dependency on
@opentelemetry/api
that explicitly excludes future versions in the 1.x range. IMHO this is not helpful because 1.x release have to be backwards compatible anyhow, but this can lead to version conflicts when using different packages. I believe that it should be safe enough to simply have^1.3.0
as peer dependency?Fixes #4815