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

Call NewSpanExporter without checking OTLP_TRACES_EXPORTER environment variable #1572

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ManiaKazemzadeh
Copy link

Currently if OTEL_TRACES_EXPORTER is not defined, then the trace exporter is always set to HTTP, regardless of the value of OTEL_EXPORTER_OTLP_PROTOCOL. This is because there is a check to see if OTEL_TRACES_EXPORTER is set before calling autoexport.NewSpanExporter.

This change removes that check and adds a test to ensure that autoexport.NewSpanExporter still works without OTEL_TRACES_EXPORTER defined. I have left the fallback code in place here so that if OTEL_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).

Copy link

linux-foundation-easycla bot commented Jan 9, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ManiaKazemzadeh / name: Mania Kazemzadeh (bc10fad, ea1fbbb)
  • ✅ login: MrAlias / name: Tyler Yahn (fd20c01)

@ManiaKazemzadeh ManiaKazemzadeh marked this pull request as ready for review January 9, 2025 19:43
@ManiaKazemzadeh ManiaKazemzadeh requested a review from a team as a code owner January 9, 2025 19:43
instrumentation.go Outdated Show resolved Hide resolved
instrumentation_test.go Show resolved Hide resolved
instrumentation_test.go Outdated Show resolved Hide resolved
@MrAlias
Copy link
Contributor

MrAlias commented Jan 9, 2025

Please be sure to include a changelog entry describing the fix being applied.

@ManiaKazemzadeh ManiaKazemzadeh force-pushed the fix-span-exporter-behaviour branch from f1cee98 to 0d43862 Compare January 10, 2025 11:14
@ManiaKazemzadeh
Copy link
Author

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 👍

@ManiaKazemzadeh ManiaKazemzadeh force-pushed the fix-span-exporter-behaviour branch from 0d43862 to bc10fad Compare January 10, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants