Open xvilo opened 1 month ago
Hi @xvilo . Has there been any update/workaround regarding this issue?
Uhm, work is being done on this so it isn’t an issue anymore. (https://github.com/open-telemetry/opentelemetry-php/pull/1412) Another work around for now would be to change the order of the dependencies in your composer.json, and then to dump the autoloader again
@xvilo Sorry for the delayed reply. What order would you recommend having, or which package(s) should be moved in the order? Thanks.
Describe your environment
OTEL_TRACES_EXPORTER
set tootlp
Steps to reproduce
php -S
command from the scriptOTEL_TRACES_EXPORTER
tootlp
What is the expected behavior? What did you expect to see? It either:
What is the actual behavior? It can't load the OLTP exporter as a whole
Additional notes?
From my debugging this happens because: The auto root span _register.php is loader earlier in the chain then the _register.php of the oltp exporter, not sure if it's alphabetical or something else in composer? The auto root span kicks of everything in the sdk package, and then also tries to set up the tracer The tracer has an in memory list of registered exporters, which is usually filled through the _register.php scripts. As that didn't happen yet, the exporter does not exist (yet)
If it were to used as a class, e.g. a list of predefined FQCN's then it could work since it would kick in the class loader in the background.
So you either need to find a way to chain these dependencies (don't think there is a composer way), or, from the tracer factory stuffs, directly depend on a list of predefined classes as a fallback. That could work, but will give some overhead if no authoritative classmap is used