DataDog / dd-trace-php

Datadog PHP Clients
https://docs.datadoghq.com/tracing/setup/php
Other
483 stars 149 forks source link

[Bug]: DD_TRACE_<INTEGRATION>_ENABLED does not seem to work #2426

Closed rmikalkenas closed 6 months ago

rmikalkenas commented 6 months ago

Bug report

Tried to migrate deprecated DD_INTEGRATIONS_DISABLED env variable to DD_TRACE_<INTEGRATION>_ENABLED, but looks like it does not work as expected and integrations keep enabled even though explicitly defined as disabled.

Examples - should result to false:

DD_TRACE_SYMFONY_ENABLED=false php -r "var_dump(ddtrace_config_integration_enabled('symfony'));"
> bool(true) 

DD_TRACE_SYMFONY_ENABLED=0 php -r "var_dump(ddtrace_config_integration_enabled('symfony'));"
> bool(true)

DD_INTEGRATIONS_DISABLED works as expected:

DD_INTEGRATIONS_DISABLED=symfony php -r "var_dump(ddtrace_config_integration_enabled('symfony'));"
> bool(false)

DD_INTEGRATIONS_DISABLED="" php -r "var_dump(ddtrace_config_integration_enabled('symfony'));"
> bool(true)

Same results can be seen with other integrations as well.

Also, even though I defined wordpress as disabled (DD_INTEGRATIONS_DISABLED=wordpress), but at info output I see datadog.trace.wordpress_enabled => On => On. Not sure if it's a bug or expected behaviour

PHP version

8.2.13

Tracer or profiler version

0.95.0

Installed extensions

[PHP Modules]                                                                                                                                                                                                
amqp                                                                                                                                                                                                         
bcmath                                                                                                                                                                                                       
Core                                                                                                                                                                                                         
ctype                                                                                                                                                                                                        
curl
date
ddappsec
ddtrace
dom
fileinfo
filter
ftp
gd
gmp
hash
iconv
igbinary
intl
json
libxml
mbstring
mcrypt
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
redis
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
ddappsec
ddtrace

Output of phpinfo()

o.txt

Upgrading from

No response

PROFeNoM commented 6 months ago

Hi, @rmikalkenas !

I can see from the output of your phpinfo that you have set DD_INTEGRATIONS_DISABLED:

DD_INTEGRATIONS_DISABLED=amqp,cakephp,codeigniter,drupal,eloquent,laminas,laravel,laravelqueue,lumen,magento,memcache,memcached,mongo,mongodb,mysqli,nette,pcntl,phpredis,predis,psr18,slim,sqlsrv,wordpress,yii,zendframework

Did you try not setting DD_INTEGRATIONS_DISABLED and relying solely on DD_TRACE_<INTEGRATION>_ENABLED as they aren't meant to co-exist? More precisely, DD_INTEGRATIONS_DISABLED is taking over if it is specifically set.

rmikalkenas commented 6 months ago

Hi, @rmikalkenas !

I can see from the output of your phpinfo that you have set DD_INTEGRATIONS_DISABLED:

DD_INTEGRATIONS_DISABLED=amqp,cakephp,codeigniter,drupal,eloquent,laminas,laravel,laravelqueue,lumen,magento,memcache,memcached,mongo,mongodb,mysqli,nette,pcntl,phpredis,predis,psr18,slim,sqlsrv,wordpress,yii,zendframework

Did you try not setting DD_INTEGRATIONS_DISABLED and relying solely on DD_TRACE_<INTEGRATION>_ENABLED as they aren't meant to co-exist? More precisely, DD_INTEGRATIONS_DISABLED is taking over if it is specifically set.

@PROFeNoM you are right! Thanks for a quick jump in :pray: closing as resolved