|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-01-14 18:06 UTC] marcodekrijger at gmail dot com
Description: ------------ Once installed using the manual from http://code.google.com/p/peclapm/wiki/Install And configuring the php.ini file (see reproduce code block). I only get records for the slow pages. When generating an error e.g. trigger_error('adsf', E_USER_NOTICE); or throw new Exception('asdf') the table events stays empty. I tracked the syslog and apache logs, but couldnt find anything. Somehow the db ini setting is ambigious apm.sqlite_db_path="/etc/php5/apm/db" apm.db_path="/etc/php5/apm/d the db_path directive doesnt work (when reviewing the phpinfo page). So I setted both directives to my own path. I also tried to use the default path, but that doesnt make any difference Reproduce code: --------------- extension=apm.so ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;; [apm] ; Whether the extension is globally active or not (overrides apm.event_enabled and apm.slow_request_enabled) apm.enabled="1" ; Enable the capture of events such as errors, notices, warnings,... apm.event_enabled="1" ; Enable the capture of slow requests apm.slow_request_enabled="1" ; Maximum duration in ms a request can take before it gets recorded apm.slow_request_duration="101" ; Path to the SQLite DB directory ; Note: the directory should be readable and writable, SQLite needs to be able to create temporary files in this directory apm.sqlite_db_path="/etc/php5/apm/db" apm.db_path="/etc/php5/apm/db" ; Maximum time in ms the extension will keep trying to insert an event into the database ; Setting this to high may slow down your application if you have lot of concurrent events. ; Setting this to low, you may loose some of your concurrent events apm.max_event_insert_timeout="100" Expected result: ---------------- The events table to be filled Actual result: -------------- The slow request table is filled, but the events table not PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 22:00:01 2025 UTC |
myusername@knutsel:/var/php/apm/db$ ls -la /var/php/apm/db/events -rwxrwxrwx 1 www-data www-data 4096 2011-01-14 22:31 /var/php/apm/db/event myusername@knutsel:/var/php/apm/db$ echo ".schema" | sqlite3 /var/php/apm/db/events CREATE TABLE event ( id INTEGER PRIMARY KEY AUTOINCREMENT, ts TEXT NOT NULL, type INTEGER NOT NULL, file TEXT NOT NULL, line INTEGER NOT NULL, message TEXT NOT NULL, backtrace TEXT NOT NULL); CREATE TABLE slow_request ( id INTEGER PRIMARY KEY AUTOINCREMENT, ts TEXT NOT NULL, duration FLOAT NOT NULL, file TEXT NOT NUL PHPinfo page: apm APM support enabled Version 1.0.0beta2 Directive Local Value Master Value apm.deffered_processing On On apm.enabled On On apm.event_enabled On On apm.slow_request_duration 100 100 apm.slow_request_enabled On On apm.sqlite_db_path /var/php/apm/db /var/php/apm/db apm.sqlite_enabled On On apm.sqlite_error_reporting no value no value apm.sqlite_max_event_insert_timeout 100 100 apm.stacktrace_enabled On On Note that php -i didnt return any results because I have 2 environments a PHP cli env and a PHP web env under Apache. This seems to be separated by having two php.ini files. Above config is from the php.ini file under apache. Under the command line php doesnt have APM enabled In included the screenshot which says the db is empty for events (not for slow requests) Also tried: db = new SQLite3(ini_get('apm.sqlite_db_path').'/events'); $result = $db->query('SELECT * FROM event;'); while ($row = $result->fetchArray()) { var_dump($row); } But that didnt yield any results as well Hope I have given some leads to shed some light into this case.I patched the file, built it, and restarted apache just to be sure. But somehow it can't even get to the patched code, because it didnt printf the comment in the patch. $ php -c /etc/php5/apache2/php.ini -d apm.enabled=1 -d apm.deffered_processing=1 -d apm.event_enabled=1 -d apm.sqlite_db_path=/var/php/apm/db -d apm.sqlite_enabled=1 - d apm.sqlite_error_reporting=30719 -d apm.stacktrace_enabled=1 -r "doesNotExist();" PHP Fatal error: Call to undefined function doesNotExist() in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 $ php -c /etc/php5/apache2/php.ini -d apm.enabled=1 -d apm.deffered_processing=1 -d apm.event_enabled=1 -d apm.sqlite_db_path=/var/php/apm/db -d apm.sqlite_enabled=1 - d apm.sqlite_error_reporting=30719 -d apm.stacktrace_enabled=0 -r "doesNotExist();" PHP Fatal error: Call to undefined function doesNotExist() in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 $ sqlite3 /var/php/apm/db/events "SELECT * FROM event;" $ [doesnt return any record]Tried it with the new patch, and got some additional debug info here. Both (stacktrace enabled or disabled gave same results below): apm_driver_sqlite3_minit: entering apm_driver_sqlite3_rinit: entering apm_driver_sqlite3_rinit: leaving SUCCESS PHP Fatal error: Call to undefined function doesNotExist() in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 PHP_RSHUTDOWN_FUNCTION: entering PHP_RSHUTDOWN_FUNCTION: apm is enabled PHP_RSHUTDOWN_FUNCTION: leaving With no records in event tableI couldn;t just sit and do nothing, but Im not really a C kind of person. But your patch gave me some clues about how to debug. I added some php_printf statements to see where it comes, and where it can't reach. This is wat I discovered. With deffered processing enabled: It gets to the PHP_RSHUTDOWN_FUNCTION but at the if statement at line 268 (if (APM_G(deffered_processing) && APM_G(events) != *APM_G(last_event)) {) It says that the outcome is false, which results in NOT entering this block. I checked the APM_G(events) and *APM_G(last_event), and they seem to be identical which is the cause of not entering this block. I tried disabling this check, but somehow it can't loop this APM_G(events) and I do not fully understand is technical workings. With deffered processing disabled: on init of this module in "PHP_RINIT_FUNCTION" it overrides the zend_error_cb with apm_error_cb;. Although it should, because the block is never reached because of if (APM_G(enabled)) results false???? I tried disabling this check to see if it works, but somehow the "apm_error_cb" method is never called, which left me clueless about what to do. Maybe this information is a little bit more helpfull