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

sdk: Add getters and export types to allow structural inspection #4606

Closed
pellared opened this issue Oct 11, 2023 · 1 comment
Closed

sdk: Add getters and export types to allow structural inspection #4606

pellared opened this issue Oct 11, 2023 · 1 comment
Labels
enhancement New feature or request pkg:SDK Related to an SDK package

Comments

@pellared
Copy link
Member

How can one test a complex SDK setup (e.g. check that a trace provider uses given exporter)?

We could enhance the OTel Go SDK by adding exported getters and also by exporting some types. This would allow inspecting in the tests if the created SDK components are build as expected.

Reference: https://blog.ploeh.dk/2013/04/04/structural-inspection/

Originally posted by @pellared in open-telemetry/opentelemetry-go-contrib#4414 (comment)

@pellared pellared added pkg:SDK Related to an SDK package enhancement New feature or request labels Oct 11, 2023
@pellared
Copy link
Member Author

SIG meeting notes:

We do not want to add access to all components used or created by the SDK as then the user could try to use them outside of the context of the SDK. This may cause invalid behaviors (e.g. race conditions). Moreover, it may be not compliant with the SDK specification.

We propose to use reflect package for structural inspection. We suggest to extract all reflection code to some helpers to minimize the impact when the internals of the SDK change.

CC @codeboten

@pellared pellared closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:SDK Related to an SDK package
Projects
None yet
Development

No branches or pull requests

1 participant