-
Notifications
You must be signed in to change notification settings - Fork 94
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
Call NewSpanExporter without checking OTLP_TRACES_EXPORTER environment variable #1572
base: main
Are you sure you want to change the base?
Call NewSpanExporter without checking OTLP_TRACES_EXPORTER environment variable #1572
Conversation
Please be sure to include a changelog entry describing the fix being applied. |
f1cee98
to
0d43862
Compare
Hey, thank you for the review! I've added your suggestions. I spent some time trying to understand and see if there was another way of testing the exporter type but your suggestion to use MarshalLog seems to be the best solution. I've also added a changelog item. Please let me know if there are any other changes you'd like me to make 👍 |
0d43862
to
bc10fad
Compare
Currently if
OTEL_TRACES_EXPORTER
is not defined, then the trace exporter is always set to HTTP, regardless of the value ofOTEL_EXPORTER_OTLP_PROTOCOL
. This is because there is a check to see ifOTEL_TRACES_EXPORTER
is set before callingautoexport.NewSpanExporter
.This change removes that check and adds a test to ensure that
autoexport.NewSpanExporter
still works withoutOTEL_TRACES_EXPORTER
defined. I have left the fallback code in place here so that ifOTEL_EXPORTER_OTLP_PROTOCOL
has an invalid value (or NewSpanExporter returns nil for any other reason) the http exporter will be selected (which is the current behaviour).