open-telemetry / opentelemetry-php

The OpenTelemetry PHP Library
https://opentelemetry.io/docs/instrumentation/php/
Apache License 2.0
756 stars 187 forks source link

Export errors with Guzzle 6 as http client #1408

Closed mvanduijker closed 1 month ago

mvanduijker commented 1 month ago

Steps to reproduce Create project with guzzle 6 Try to export data

What is the expected behavior? No error exporting data

What is the actual behavior? Following stack trace

application NOTICE: PHP message: OpenTelemetry: [warning] Error during opentelemetry initialization: OpenTelemetry\SDK\Common\Http\Psr\Client\Discovery\Guzzle::create(): Return value must be of type Psr\Http\Client\ClientInterface, GuzzleHttp\Client returned
application #0 /var/www/vendor/open-telemetry/sdk/Common/Http/Psr/Client/Discovery.php(40): OpenTelemetry\SDK\Common\Http\Psr\Client\Discovery\Guzzle->create()
application #1 /var/www/vendor/open-telemetry/sdk/Common/Export/Http/PsrTransportFactory.php(47): OpenTelemetry\SDK\Common\Http\Psr\Client\Discovery::find()
application #2 /var/www/vendor/open-telemetry/exporter-otlp/OtlpHttpTransportFactory.php(32): OpenTelemetry\SDK\Common\Export\Http\PsrTransportFactory->create()
application #3 /var/www/vendor/open-telemetry/exporter-otlp/SpanExporterFactory.php(54): OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory->create()
application #4 /var/www/vendor/open-telemetry/exporter-otlp/SpanExporterFactory.php(33): OpenTelemetry\Contrib\Otlp\SpanExporterFactory->buildTransport()
application #5 /var/www/vendor/open-telemetry/sdk/Trace/ExporterFactory.php(30): OpenTelemetry\Contrib\Otlp\SpanExporterFactory->create()
application #6 /var/www/vendor/open-telemetry/sdk/SdkAutoloader.php(85): OpenTelemetry\SDK\Trace\ExporterFactory->create()
application #7 /var/www/vendor/open-telemetry/sdk/SdkAutoloader.php(60): OpenTelemetry\SDK\SdkAutoloader::environmentBasedInitializer()
application #8 /var/www/vendor/open-telemetry/api/Globals.php(93): OpenTelemetry\SDK\SdkAutoloader::OpenTelemetry\SDK\{closure}()
application #9 /var/www/vendor/open-telemetry/api/Globals.php(43): OpenTelemetry\API\Globals::globals()
application #10 /var/www/vendor/open-telemetry/api/Instrumentation/CachedInstrumentation.php(54): OpenTelemetry\API\Globals::tracerProvider()
application #11 /var/www/vendor/open-telemetry/opentelemetry-auto-symfony/src/SymfonyInstrumentation.php(48): OpenTelemetry\API\Instrumentation\CachedInstrumentation->tracer()
application #12 /var/www/vendor/symfony/http-kernel/HttpKernel.php(69): OpenTelemetry\Contrib\Instrumentation\Symfony\SymfonyInstrumentation::OpenTelemetry\Contrib\Instrumentation\Symfony\{closure}()
application #13 /var/www/vendor/symfony/http-kernel/Kernel.php(202): Symfony\Component\HttpKernel\HttpKernel->handle()
application #14 /var/www/public/index.php(39): Symfony\Component\HttpKernel\Kernel->handle()
application #15 {main} in /var/www/vendor/open-telemetry/api/Globals.php(95)

Additional context

It wrongly detects guzzle version 6 client as a client which implements the Psr\Http\Client\ClientInterface which it doesn't.