Skip to content

[DoNotMerge] sdk: implementations to embed noop instead of embedded #6638

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Apr 10, 2025

Fixes #6609

This allows users to use older versions of SDK and newer versions of API. This might be desired if e.g. newer versions of SDK has some bug or worse performance. This would also make bumping dependencies easier as bumping to a newer versions of API should not cause SDK compilation error.

@pellared pellared added pkg:SDK Related to an SDK package area:metrics Part of OpenTelemetry Metrics area:trace Part of OpenTelemetry tracing area:logs Part of OpenTelemetry logs labels Apr 10, 2025
@pellared pellared marked this pull request as ready for review April 10, 2025 13:58
@pellared pellared changed the title sdk: Implementations to embed noop types instead of embedded types sdk: Implementations to embed noop instead of embedded Apr 10, 2025
@pellared pellared changed the title sdk: Implementations to embed noop instead of embedded sdk: implementations to embed noop instead of embedded Apr 10, 2025
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we provide an implementation of all methods? Before we would get a compilation error, now it will silently just provide a no-op.

@MrAlias MrAlias added this to the v1.36.0 milestone Apr 10, 2025
@pellared
Copy link
Member Author

Before we would get a compilation error, now it will silently just provide a no-op.

Correct. This is the intention of this PR.

How do we provide an implementation of all methods?

Users that want an implementation for new methods would need to bump to newer version of the SDK which has the new methods implemented.

Do you have any other proposal?

@MrAlias
Copy link
Contributor

MrAlias commented Apr 10, 2025

Users that want an implementation for new methods would need to bump to newer version of the SDK which has the new methods implemented.

Right, but how do we know we have implemented all the known methods while we are developing? Before this change if I remove SetName from a span the build will fail. Afterwards it will compile and be released silently.

@MrAlias
Copy link
Contributor

MrAlias commented Apr 10, 2025

This feedback might also apply more generally. Do we really want users to be surprised when their telemetry doesn't show up the way they expect, or do we want to signal as soon as possible about the incompatibility of the SDK to implement the API fully?

It seems like embedding the noop lulls the user into a false sense of success. They will think the upgrade is successful, but their system will operate in a partially broken state.

@MrAlias
Copy link
Contributor

MrAlias commented Apr 10, 2025

@pellared
Copy link
Member Author

pellared commented Apr 10, 2025

@MrAlias, your feedback makes totally sense. I think we should also get more feedback from end-users before making such change. Leaving the PR open for some time to encourage gathering feedback and adding "[Do not merge]" label. I am leaning towards closing the PR and referenced issue as "not planned".

@pellared pellared changed the title sdk: implementations to embed noop instead of embedded [DoNotMerge] sdk: implementations to embed noop instead of embedded Apr 10, 2025
@pellared pellared added the blocked Progress is blocked. label Apr 10, 2025
@pellared pellared removed this from the v1.36.0 milestone Apr 10, 2025
@pellared
Copy link
Member Author

@dmathieu, @XSAM, do you have any opinions?

@dmathieu
Copy link
Member

This makes sense to me, and resolves many stability concerns that were raised before.

Regarding the full implementation question, how about adding a test checking that we implement noop?
That way, runtime keeps working if we're missing a method, but our test suite on main will fail.

@pellared pellared mentioned this pull request Apr 11, 2025
@seankhliao
Copy link
Contributor

As someone who writes code, I can't say I like the noop / grpc Unimplemented style very much.

As a consumer of the api, if I'm using the reference implementation in otel/sdk, I pretty much expect to not run in to silent / runtime failures from things being unimplemented, whether that's a new addition to an interface, or a new option that needs to be read / handled by the sdk.

I don't really have an opinion on what other implementations do.

While I understand why someone might want to allow version skew, IMO that should be explicit decisions handled and recorded through the standard go dependency constructs of replace and exclude directives, that is, they should be exceptional circumstances, and treated accordingly so.

Consider for example the addition of histogram boundary hints.
An application may remove their configuration of the sdk and switch to using the options in api, since it's much nicer to manage that way.
But a missed upgrade in sdk will leave them with no boundaries configured at all (api upgrade can't be missed for them to use the new options).

I think the only safe upgrade path should be sdk >= api, rather than api >= sdk, which is what this PR would promote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logs Part of OpenTelemetry logs area:metrics Part of OpenTelemetry Metrics area:trace Part of OpenTelemetry tracing blocked Progress is blocked. pkg:SDK Related to an SDK package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK to embedd noop types
4 participants