opentelemetry-go
opentelemetry-go copied to clipboard
Add examples that don't use global variables.
Feedback from https://github.com/etcd-io/etcd/pull/12919#discussion_r628085064. 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.