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

Add examples that don't use global variables. #6385

Closed
dashpole opened this issue May 7, 2021 · 1 comment
Closed

Add examples that don't use global variables. #6385

dashpole opened this issue May 7, 2021 · 1 comment
Labels
contribfest enhancement New feature or request help wanted Extra attention is needed

Comments

@dashpole
Copy link
Contributor

dashpole commented May 7, 2021

Feedback from etcd-io/etcd#12919 (comment). Globals are nice for simpler examples, but it is often better for larger projects to avoid them so libraries are isolated from each other.

My suggestion would be to leave the examples in opentelemetry-go as-is, since I would categorize them as "simple", but change the more complex examples in contrib (e.g. the grpc or http examples) to plumb tracerprovider and propagation through. It would also be a better demonstration of those instrumentation libraries' capabilities, as it would show some of the common arguments that could be passed. That may be more confusing if examples differ in their approaches, and i'm open to other ideas on how to make it easier for new users to understand when they should, or shouldn't use global variables.

@dashpole dashpole added the enhancement New feature or request label May 7, 2021
@MrAlias MrAlias added the help wanted Extra attention is needed label May 3, 2022
@vordimous
Copy link
Contributor

I was looking into helping on this issue. The examples have changed quite a bit since this issue was raised. @dashpole can you please confirm this is still an improvement that needs to be made?

From my findings I see that the namedtracer example is the only one that uses a global variable. I think this fits with the suggestion as it is a "simple" example where the other examples are using the NewTracerProvider() to create a instance.

@MrAlias I think that means this issue can be closed?

@pellared pellared transferred this issue from open-telemetry/opentelemetry-go Dec 1, 2024
@dashpole dashpole closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribfest enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants