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

SDK Thrown Unhandled Exception is OTEL Collector if not available #1447

Open
yahorsi opened this issue Dec 5, 2024 · 2 comments
Open

SDK Thrown Unhandled Exception is OTEL Collector if not available #1447

yahorsi opened this issue Dec 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@yahorsi
Copy link

yahorsi commented Dec 5, 2024

Steps to reproduce
Start Open Telemetry instrumented app while OTEL Collector is not available, app cannot start

What is the expected behavior?
App does not crash

What is the actual behavior?
App crashes
image

@yahorsi yahorsi added the bug Something isn't working label Dec 5, 2024
@yahorsi yahorsi changed the title SDK Thrown Unhandled Exception is OTEL Collector is not available SDK Thrown Unhandled Exception is OTEL Collector if not available Dec 5, 2024
@brettmc
Copy link
Collaborator

brettmc commented Dec 5, 2024

Hi @yahorsi are you certain that it crashed the app? The export failure exception has been captured and logged (and you can configure where the logs go)

I updated one of our example scripts here to use batch span processor, and it seems to me to behave correctly:

# php examples/traces/exporters/otlp_http.php 
Starting OTLP example
OTLP example complete!  
OpenTelemetry: [error] Export failure [exception] Export retry limit exceeded [previous] cURL error 6: Could not resolve host: collector (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://collector:4318/v1/traces
#0 /usr/src/myapp/src/Contrib/Otlp/SpanExporter.php(38): OpenTelemetry\SDK\Common\Export\Http\PsrTransport->send('\n\x98\r\n\x9E\x06\n\e\n\thost....', NULL)
#1 /usr/src/myapp/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php(247): OpenTelemetry\Contrib\Otlp\SpanExporter->export(Array)
#2 /usr/src/myapp/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php(190): OpenTelemetry\SDK\Trace\SpanProcessor\BatchSpanProcessor->flush('shutdown', NULL)
#3 /usr/src/myapp/src/SDK/Trace/TracerSharedState.php(71): OpenTelemetry\SDK\Trace\SpanProcessor\BatchSpanProcessor->shutdown(NULL)
#4 /usr/src/myapp/src/SDK/Trace/TracerProvider.php(98): OpenTelemetry\SDK\Trace\TracerSharedState->shutdown(NULL)
#5 /usr/src/myapp/examples/traces/exporters/otlp_http.php(53): OpenTelemetry\SDK\Trace\TracerProvider->shutdown()
#6 {main}

# echo $?
0

The return code from CLI is 0 (success). If you change the log destination, for example dropping putenv('OTEL_PHP_LOG_DESTINATION=none'); into your code, it should suppress the logging of errors. Does that change what you see in terms of crash/not?

@brettmc
Copy link
Collaborator

brettmc commented Dec 24, 2024

@yahorsi do you have a custom error handler that might be turning a NOTICE into an exception?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants