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

should opentelemetry-instrument read code config? #67

Closed
Tracked by #3
JamieDanielson opened this issue Jan 30, 2023 · 4 comments
Closed
Tracked by #3

should opentelemetry-instrument read code config? #67

JamieDanielson opened this issue Jan 30, 2023 · 4 comments
Labels
type: discussion Requests for comments, discussions about possible enhancements.
Milestone

Comments

@JamieDanielson
Copy link
Contributor

I run with opentelemetry-instrument, it doesn’t pick up my code configuration in this app.

poetry run opentelemetry-instrument python3 app.py results in unknown_service:python and debug is not true.

poetry run python3 app.py correctly picks up those env vars 🤔

I guess the question is… should it? Or does using opentelemetry-instrument mean you can only use env vars and not config in code with configure_opentelemetry?

@JamieDanielson JamieDanielson added the type: discussion Requests for comments, discussions about possible enhancements. label Jan 30, 2023
@vreynolds vreynolds added this to the Beta milestone Feb 1, 2023
@emilyashley
Copy link
Contributor

I have this question, too!

@emilyashley
Copy link
Contributor

emilyashley commented Feb 28, 2023

I think after discussion we landed on sticking to one or the other (configure_opentelemetry() or opentelemetry-instrument), not mix and match.

@JamieDanielson I'm curious if you think this documentation makes it clear that we expect one or the other? https://github.com/honeycombio/honeycomb-opentelemetry-python/blob/main/src/honeycomb/opentelemetry/distro.py#L3

If so, we'll make sure to put this in the main documentation and we can close this issue?

@MikeGoldsmith
Copy link
Contributor

Yep, that's right - both opentelemetry-instrument and configure_opentelemetry trigger the distro hook to configure the OTel SDK. If both are called, it will configure the SDK twice, which can lead to unexpected setups.

If you want a zero-code solution that's only driven by env vars you would use opentemetry-instrument.
if you want to configure via code (and optionally mix with env vars), you would use configure_opentelemetry.

@emilyashley
Copy link
Contributor

Great! I'll make sure it's extra clear which example app uses which way! This looks good to close to me ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion Requests for comments, discussions about possible enhancements.
Projects
None yet
Development

No branches or pull requests

4 participants