DataDog / dd-trace-php

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

[BUG] Traces not working with PHP8 and ZF1 #1806

Closed php10-de closed 1 year ago

php10-de commented 1 year ago

Bug description

Since the update from PHP7.4 to PHP8.0 tracing in Datadog does not work anymore

PHP version

PHP8.0.21

Tracer version

0.71.1

Installed extensions

[PHP Modules] bz2 Core ctype curl date ddtrace dom fileinfo filter ftp gd hash iconv intl json libxml mbstring mysqli mysqlnd openssl pcre PDO pdo_mysql pdo_sqlite Phar posix readline redis Reflection session SimpleXML soap sockets sodium SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zip zlib

OS info

System Linux ip-10-136-114-153.eu-central-1.compute.internal 4.14.291-218.527.amzn2.x86_64 Build Date Sep 1 2022 22:32:02 Build System Linux 9a251b3cdc63 5.10.0-13-cloud-amd64 MP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux

Server API is FPM/FastCGI. We are using Apache.

Diagnostics and configuration

Output of phpinfo() (ddtrace >= 0.47.0)

Diagnostics Diagnostic checks passed Directive Local Value Master Value datadog.agent_host no value no value datadog.autofinish_spans Off Off datadog.cakephp_analytics_enabled Off Off datadog.cakephp_analytics_sample_rate 1 1 datadog.codeigniter_analytics_enabled Off Off datadog.codeigniter_analytics_sample_rate 1 1 datadog.curl_analytics_enabled Off Off datadog.curl_analytics_sample_rate 1 1 datadog.distributed_tracing On On datadog.dogstatsd_port 8125 8125 datadog.dogstatsd_url no value no value datadog.elasticsearch_analytics_enabled Off Off datadog.elasticsearch_analytics_sample_rate 1 1 datadog.eloquent_analytics_enabled Off Off datadog.eloquent_analytics_sample_rate 1 1 datadog.env no value no value datadog.guzzle_analytics_enabled Off Off datadog.guzzle_analytics_sample_rate 1 1 datadog.integrations_disabled default default datadog.laravel_analytics_enabled Off Off datadog.laravel_analytics_sample_rate 1 1 datadog.log_backtrace Off Off datadog.lumen_analytics_enabled Off Off datadog.lumen_analytics_sample_rate 1 1 datadog.memcached_analytics_enabled Off Off datadog.memcached_analytics_sample_rate 1 1 datadog.mongo_analytics_enabled Off Off datadog.mongo_analytics_sample_rate 1 1 datadog.mongodb_analytics_enabled Off Off datadog.mongodb_analytics_sample_rate 1 1 datadog.mysqli_analytics_enabled Off Off datadog.mysqli_analytics_sample_rate 1 1 datadog.nette_analytics_enabled Off Off datadog.nette_analytics_sample_rate 1 1 datadog.pcntl_analytics_enabled Off Off datadog.pcntl_analytics_sample_rate 1 1 datadog.pdo_analytics_enabled Off Off datadog.pdo_analytics_sample_rate 1 1 datadog.phpredis_analytics_enabled Off Off datadog.phpredis_analytics_sample_rate 1 1 datadog.predis_analytics_enabled Off Off datadog.predis_analytics_sample_rate 1 1 datadog.priority_sampling On On datadog.propagation_style_extract Datadog,B3,B3 single header Datadog,B3,B3 single header datadog.propagation_style_inject Datadog Datadog datadog.sampling_rate 1 1 datadog.service no value no value datadog.service_mapping no value no value datadog.service_name no value no value datadog.slim_analytics_enabled Off Off datadog.slim_analytics_sample_rate 1 1 datadog.span_sampling_rules [] [] datadog.span_sampling_rules_file no value no value datadog.symfony_analytics_enabled Off Off datadog.symfony_analytics_sample_rate 1 1 datadog.tags no value no value datadog.trace.agent_attempt_retry_time_msec 5000 5000 datadog.trace.agent_connect_timeout 100 100 datadog.trace.agent_debug_verbose_curl Off Off datadog.trace.agent_flush_after_n_requests 10 10 datadog.trace.agent_flush_interval 5000 5000 datadog.trace.agent_max_consecutive_failures 3 3 datadog.trace.agent_max_payload_size 52428800 52428800 datadog.trace.agent_port 8126 8126 datadog.trace.agent_stack_backlog 12 12 datadog.trace.agent_stack_initial_size 131072 131072 datadog.trace.agent_timeout 500 500 datadog.trace.agent_url no value no value datadog.trace.analytics_enabled Off Off datadog.trace.auto_flush_enabled Off Off datadog.trace.beta_high_memory_pressure_percent 80 80 datadog.trace.bgs_connect_timeout 2000 2000 datadog.trace.bgs_timeout 5000 5000 datadog.trace.cakephp_analytics_enabled Off Off datadog.trace.cakephp_analytics_sample_rate 1 1 datadog.trace.cakephp_enabled On On datadog.trace.cli_enabled Off Off datadog.trace.client_ip_header no value no value datadog.trace.client_ip_header_disabled Off Off datadog.trace.codeigniter_analytics_enabled Off Off datadog.trace.codeigniter_analytics_sample_rate 1 1 datadog.trace.codeigniter_enabled On On datadog.trace.curl_analytics_enabled Off Off datadog.trace.curl_analytics_sample_rate 1 1 datadog.trace.curl_enabled On On datadog.trace.db_client_split_by_instance Off Off datadog.trace.debug On On datadog.trace.debug_curl_output Off Off datadog.trace.debug_prng_seed -1 -1 datadog.trace.elasticsearch_analytics_enabled Off Off datadog.trace.elasticsearch_analytics_sample_rate 1 1 datadog.trace.elasticsearch_enabled On On datadog.trace.eloquent_analytics_enabled Off Off datadog.trace.eloquent_analytics_sample_rate 1 1 datadog.trace.eloquent_enabled On On datadog.trace.enabled On On datadog.trace.forked_process On On datadog.trace.generate_root_span On On datadog.trace.global_tags no value no value datadog.trace.guzzle_analytics_enabled Off Off datadog.trace.guzzle_analytics_sample_rate 1 1 datadog.trace.guzzle_enabled On On datadog.trace.header_tags no value no value datadog.trace.health_metrics_enabled Off Off datadog.trace.health_metrics_heartbeat_sample_rate 0.001 0.001 datadog.trace.http_client_split_by_domain Off Off datadog.trace.http_url_query_param_allowed datadog.trace.laravel_analytics_enabled Off Off datadog.trace.laravel_analytics_sample_rate 1 1 datadog.trace.laravel_enabled On On datadog.trace.lumen_analytics_enabled Off Off datadog.trace.lumen_analytics_sample_rate 1 1 datadog.trace.lumen_enabled On On datadog.trace.measure_compile_time On On datadog.trace.memcached_analytics_enabled Off Off datadog.trace.memcached_analytics_sample_rate 1 1 datadog.trace.memcached_enabled On On datadog.trace.memory_limit no value no value datadog.trace.mongo_analytics_enabled Off Off datadog.trace.mongo_analytics_sample_rate 1 1 datadog.trace.mongo_enabled On On datadog.trace.mongodb_analytics_enabled Off Off datadog.trace.mongodb_analytics_sample_rate 1 1 datadog.trace.mongodb_enabled On On datadog.trace.mysqli_analytics_enabled Off Off datadog.trace.mysqli_analytics_sample_rate 1 1 datadog.trace.mysqli_enabled On On datadog.trace.nette_analytics_enabled Off Off datadog.trace.nette_analytics_sample_rate 1 1 datadog.trace.nette_enabled On On datadog.trace.obfuscation_query_stringregexp (?i)(?:p(?:ass)?w(?:or)?d|pass(?:?phrase)?|secret|(?:api?|private?|public?|access?|secret?)key(?:?id)?|token|consumer?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\s|%20)(?:=|%3D)[^&]+|(?:"|%22)(?:\s|%20)(?::|%3A)(?:\s|%20)*(?:"|%22)(?:%2[^2]|%[^2]|[^"%])+(?:"|%22))|bearer(?:\s|%20)+[a-z0-9.-]|token(?::|%3A)[a-z0-9]{13}|gh[opsu][0-9a-zA-Z]{36}|eyI-L+.eyI-L+(?:.(?:[\w.+\/=-]|%3D|%2F|%2B)+)?|[-]{5}BEGIN(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY[-]{5}[^-]+[-]{5}END(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY|ssh-rsa(?:\s|%20)*(?:[a-z0-9\/.+]|%2F|%5C|%2B){100,} (?i)(?:p(?:ass)?w(?:or)?d|pass(?:?phrase)?|secret|(?:api?|private?|public?|access?|secret?)key(?:?id)?|token|consumer?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\s|%20)(?:=|%3D)[^&]+|(?:"|%22)(?:\s|%20)(?::|%3A)(?:\s|%20)*(?:"|%22)(?:%2[^2]|%[^2]|[^"%])+(?:"|%22))|bearer(?:\s|%20)+[a-z0-9.-]|token(?::|%3A)[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|eyI-L+.eyI-L+(?:.(?:[\w.+\/=-]|%3D|%2F|%2B)+)?|[-]{5}BEGIN(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY[-]{5}[^-]+[-]{5}END(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY|ssh-rsa(?:\s|%20)*(?:[a-z0-9\/.+]|%2F|%5C|%2B){100,} datadog.trace.pcntl_analytics_enabled Off Off datadog.trace.pcntl_analytics_sample_rate 1 1 datadog.trace.pcntl_enabled On On datadog.trace.pdo_analytics_enabled Off Off datadog.trace.pdo_analytics_sample_rate 1 1 datadog.trace.pdo_enabled On On datadog.trace.phpredis_analytics_enabled Off Off datadog.trace.phpredis_analytics_sample_rate 1 1 datadog.trace.phpredis_enabled On On datadog.trace.predis_analytics_enabled Off Off datadog.trace.predis_analytics_sample_rate 1 1 datadog.trace.predis_enabled On On datadog.trace.propagate_service Off Off datadog.trace.redis_client_split_by_host Off Off datadog.trace.report_hostname Off Off datadog.trace.request_init_hook /opt/datadog-php/dd-trace-sources/bridge/dd_wrap_autoloader.php /opt/datadog-php/dd-trace-sources/bridge/dd_wrap_autoloader.php datadog.trace.resource_uri_fragment_regex no value no value datadog.trace.resource_uri_mapping_incoming no value no value datadog.trace.resource_uri_mapping_outgoing no value no value datadog.trace.resource_uri_query_param_allowed no value no value datadog.trace.retain_thread_capabilities Off Off datadog.trace.sample_rate 1 1 datadog.trace.sampling_rules [] [] datadog.trace.shutdown_timeout 5000 5000 datadog.trace.slim_analytics_enabled Off Off datadog.trace.slim_analytics_sample_rate 1 1 datadog.trace.slim_enabled On On datadog.trace.spans_limit 1000 1000 datadog.trace.startup_logs On On datadog.trace.symfony_analytics_enabled Off Off datadog.trace.symfony_analytics_sample_rate 1 1 datadog.trace.symfony_enabled On On datadog.trace.traced_internal_functions no value no value datadog.trace.url_as_resource_names_enabled On On datadog.trace.warn_legacy_dd_trace On On datadog.trace.web_analytics_enabled Off Off datadog.trace.web_analytics_sample_rate 1 1 datadog.trace.web_enabled On On datadog.trace.wordpress_analytics_enabled Off Off datadog.trace.wordpress_analytics_sample_rate 1 1 datadog.trace.wordpress_enabled On On datadog.trace.x_datadog_tags_max_length 512 512 datadog.trace.yii_analytics_enabled Off Off datadog.trace.yii_analytics_sample_rate 1 1 datadog.trace.yii_enabled On On datadog.trace.zendframework_analytics_enabled Off Off datadog.trace.zendframework_analytics_sample_rate 1 1 datadog.trace.zendframework_enabled On On datadog.version 6ec31376 6ec31376 datadog.web_analytics_enabled Off Off datadog.web_analytics_sample_rate 1 1 datadog.wordpress_analytics_enabled Off Off datadog.wordpress_analytics_sample_rate 1 1 datadog.yii_analytics_enabled Off Off datadog.yii_analytics_sample_rate 1 1 datadog.zendframework_analytics_enabled Off Off datadog.zendframework_analytics_sample_rate 1 1 ddtrace.cgroup_file /proc/self/cgroup /proc/self/cgroup ddtrace.disable Off Off ddtrace.request_init_hook /opt/datadog-php/dd-trace-sources/bridge/dd_wrap_autoloader.php /opt/datadog-php/dd-trace-sources/bridge/dd_wrap_autoloader.php

DATADOG TRACER CONFIGURATION {"date":"2022-11-18T11:18:46Z","os_name":"Linux ip-10-136-114-157.eu-central-1.compute.internal 4.14.294-220.533.amzn2.x86_64 #1 SMP Thu Sep 29 01:01:23 UTC 2022 x86_64","os_version":"4.14.294-220.533.amzn2.x86_64","version":"0.71.1","lang":"php","lang_version":"8.0.8","env":null,"enabled":true,"service":null,"enabled_cli":false,"agent_url":"http:\/\/localhost:8126","debug":false,"analytics_enabled":false,"sample_rate":1,"sampling_rules":[],"tags":[],"service_mapping":[],"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":"373678fb","architecture":"x86_64","sapi":"fpm-fcgi","datadog.trace.request_init_hook":"\/opt\/datadog-php\/dd-trace-sources\/bridge\/dd_wrap_autoloader.php","open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":false,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":"default","enabled_from_env":true,"opcache.file_cache":null}

Upgrading info

The problem occured when updated PHP7.4 to PHP8.0

bwoebi commented 1 year ago

Hey @php10-de,

We are currently only supporting the original zf1 framework, not its continuation. We're considering adding support for it in future though!

zajca commented 1 year ago

We encountered same issue, we are in process updating zf1 app from 7.4 to 8.1. It looks like metrics are there but they are no longer under zf1.request operation but web.request operation so wrong integration is running and we are loosing tracing for ZF1. Is ti possible to force different integration? What you mean continuation of zf1? Framework libs have like zero changes only to make zf1 run on php8.

zajca commented 1 year ago

I can see here that integration is off by default for php8 https://github.com/DataDog/dd-trace-php/blob/master/src/Integrations/Integrations/IntegrationsLoader.php#L79-L86 I did try to add DD_TRACE_ZENDFRAMEWORK_ENABLED env but integration is not enabled.

bwoebi commented 1 year ago

Hey @zajca and @php10-de,

The freshly released 0.85.0 now also traces the Zend Framework on PHP 8.