opentelemetry-php: Laravel fail to send trace to opentelemetry collector

Describe your environment

PHP 8.2.0
Laravel 9.19

php --ri=opentelemetry
opentelemetry
opentelemetry hooks => enabled
extension version => 1.0.0
Directive => Local Value => Master Value
opentelemetry.conflicts => no value => no value
opentelemetry.validate_hook_functions => On => On

php --ri openswoole
openswoole
Open Swoole => enabled
Author => Open Swoole Group <hello@openswoole.com>
Version => 22.0.0
Built => Dec 21 2022 21:53:14
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1s  1 Nov 2022
dtls => enabled
http2 => enabled
hook-curl => enabled
pcre => enabled
zlib => 1.2.12
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
postgresql => enabled
Directive => Local Value => Master Value
openswoole.enable_coroutine => On => On
openswoole.enable_preemptive_scheduler => Off => Off
openswoole.display_errors => On => On
openswoole.unixsock_buffer_size => 8388608 => 838860

My repo: https://github.com/TuanVu2504/laravel-opentelemetry

Steps to reproduce

git clone https://github.com/TuanVu2504/laravel-opentelemetry
cd laravel-opentelemetry
docker build -t test-otel-php .
cd compose
docker compose up -d
browse to http://localhost/test

When I set OTEL_TRACES_EXPORTER to console, the trace is generated and printed on the stdout of the laravel container. When I set OTEL_TRACES_EXPORTER to otlp, some php commands while the app starting like

php artisan event:cache
php artisan config:cache

generate the trace and send to otel collector successfully. But if I browse to the http://localhost/test. There is no trace sent to otel collector. I know that the opentelemetry generated the trace but unable to send trace to the otel collector. But there are some trace still able to send to the collector container successfully.

How do I make Laravel with octane be able to send trace otel collector.

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

I was curious if this was related to long running processes again, as has been mentioned separately.

I’ve just had a go with Laravel Octane locally exporting to Zipkin, rather than otel-collector, which did appear to work as expected.

image

Will look at setting otel-collector up on this machine tomorrow to see if I encounter any blips myself also.