opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

Are there any working example of a Symfony Otel integration?

Open renta opened this issue 2 years ago • 2 comments

Current example of Symfony 5 Otel integration does not work. I've tried several times docker-compose up -d and received this error in all the cases:

1 -c /tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc  -fPIC -DPIC -o third_party/abseil-cpp/absl/synchronization/internal/.libs/create_thread_identity.o
/bin/sh /tmp/pear/temp/pear-build-defaultuserbPMHAF/grpc-1.35.0/libtool --mode=compile g++ -I. -I/tmp/pear/temp/grpc -I/tmp/pear/temp/pear-build-defaultuserbPMHAF/grpc-1.35.0/include -I/tmp/pear/temp/pear-build-defaultuserbPMHAF/grpc-1.35.0/main -I/tmp/pear/temp/grpc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/grpc/include -I/tmp/pear/temp/grpc/src/core/ext/upb-generated -I/tmp/pear/temp/grpc/src/core/ext/upbdefs-generated -I/tmp/pear/temp/grpc/src/php/ext/grpc -I/tmp/pear/temp/grpc/third_party/abseil-cpp -I/tmp/pear/temp/grpc/third_party/address_sorting/include -I/tmp/pear/temp/grpc/third_party/boringssl-with-bazel/src/include -I/tmp/pear/temp/grpc/third_party/re2 -I/tmp/pear/temp/grpc/third_party/upb  -Wno-maybe-uninitialized -DHAVE_CONFIG_H  -std=c++11 -fno-exceptions -fno-rtti -g -O2   -fvisibility=hidden     -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN
_AND_MEAN     -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0     -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 -c /tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -o third_party/abseil-cpp/absl/synchronization/internal/graphcycles.lo
 g++ -I. -I/tmp/pear/temp/grpc -I/tmp/pear/temp/pear-build-defaultuserbPMHAF/grpc-1.35.0/include -I/tmp/pear/temp/pear-build-defaultuserbPMHAF/grpc-1.35.0/main -I/tmp/pear/temp/grpc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/grpc/include -I/tmp/pear/temp/grpc/src/core/ext/upb-generated -I/tmp/pear/temp/grpc/src/core/ext/upbdefs-generated -I/tmp/pear/temp/grpc/src/php/ext/grpc -I/tmp/pear/temp/grpc/third_party/abseil-cpp -I/tmp/pear/temp/grpc/third_party/address_sorting/include -I/tmp/pear/temp/grpc/third_party/boringssl-with-bazel/src/include -I/tmp/pear/temp/grpc/third_party/re2 -I/tmp/pear/temp/grpc/third_party/upb -Wno-maybe-uninitialized -DHAVE_CONFIG_H -std=c++11 -fno-exceptions -fno-rtti -g -O2 -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=
1 -c /tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc  -fPIC -DPIC -o third_party/abseil-cpp/absl/synchronization/internal/.libs/graphcycles.o
/tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc: In member function 'void absl::lts_2020_09_23::synchronization_internal::GraphCycles::RemoveNode(void*)':
/tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:26: error: 'numeric_limits' is not a member of 'std'
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                          ^~~~~~~~~~~~~~
/tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:49: error: expected primary-expression before '>' token
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                                                 ^
/tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:52: error: '::max' has not been declared; did you mean 'std::max'?
  451 |   if (x->version == std::numeric_limits<uint32_t>::max()) {
      |                                                    ^~~
      |                                                    std::max
In file included from /usr/include/c++/11.2.1/algorithm:62,
                 from /tmp/pear/temp/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:38:
/usr/include/c++/11.2.1/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
make: *** [Makefile:1473: third_party/abseil-cpp/absl/synchronization/internal/graphcycles.lo] Error 1
ERROR: `make' failed
The command '/bin/sh -c apk add $PHPIZE_DEPS libstdc++ zlib-dev linux-headers     && CPPFLAGS="-Wno-maybe-uninitialized" pecl install grpc-1.35.0     && docker-php-ext-enable grpc' returned a non-zero code: 1
ERROR: Service 'php' failed to build : Build failed

My current environment is Linux Mint 21 with Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1

I've tried to create a very simple Symfony 5.3 application in the Docker (just Nginx, php-fpm with Symfony Skeleton and Jaeger) and had no luck with open-telemetry/opentelemetry-auto-symfony (NoopTracingProvider in this case with configuration via envs) and OtelSdkBundle seems to create traces (I see Otel tab in the debug toolbar with otlp exporter) but no traces in the Jaeger (I suppose because of this issue https://github.com/open-telemetry/opentelemetry-php/issues/1146 - in my case there were also strange localhost endpoint in the getExporter method).

Are any auto integration works with Symfony 5 out of a box?

renta avatar Dec 08 '23 10:12 renta

This is falling down way earlier than Symfony, or even OpenTelemetry! The error you've shown is failure to build the gRPC extension. That's possibly related to your build environment. You could try not building grpc and using a different exporter (otlp+http, for example), to get past that error if you just want to see something work.

brettmc avatar Dec 09 '23 01:12 brettmc

I got a chance to look at this a bit closer today. The image builds just fine for me, do you have an unusual CPU architecture? I also applied a fix to caddy so that it can start up.

Yes, we do have auto-instrumentation for symfony that you could try: https://packagist.org/packages/open-telemetry/opentelemetry-auto-symfony

brettmc avatar Feb 07 '24 05:02 brettmc

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '24 12:03 stale[bot]