Downloads
Stars
Version
Collects data about exceptions, manual events and some logs. Supports writing to BigQuery. For further data analysis, you can use Google Data Studio or your own application.
composer require orinokko/state-monitor
The service identifier of your application
STATE_MONITOR_APP=AppName
Whether or not to use mailing for errors
STATE_MONITOR_LOCAL_EMAIL=true
[email protected]
Whether or not to use BigQuery
STATE_MONITOR_BIGQUERY=true
Settings for BigQuery, more details
STATE_MONITOR_GOOGLE_CLOUD_PROJECT=[monitor-123456]
STATE_MONITOR_GOOGLE_APPLICATION_CREDENTIALS=[storage/monitor.json]
Whether or not to log queries
STATE_MONITOR_LOG_QUERIES=false
Enable or disable kernel middleware (default "true"-enabled)
STATE_MONITOR_MIDDLEWARE_WEB=false
STATE_MONITOR_MIDDLEWARE_API=false
php artisan monitor:install
You must get one of or both lines
Local email channel activated and recipient address provided.
BigQuery channel activated and connection settings provided.
In the process, additional actions will be performed:
Example output after installation:
public_html$ php artisan monitor:install
Current settings:
STATE_MONITOR_APP=TestAppName
STATE_MONITOR_LOCAL_EMAIL=
[email protected]
STATE_MONITOR_BIGQUERY=1
STATE_MONITOR_GOOGLE_CLOUD_PROJECT=monitor
STATE_MONITOR_GOOGLE_APPLICATION_CREDENTIALS=/storage/monitor.json
STATE_MONITOR_LOG_QUERIES=1
STATE_MONITOR_MIDDLEWARE_WEB=
STATE_MONITOR_MIDDLEWARE_API=
Local email channel disabled.
BigQuery channel activated and connection settings provided. Try configure the database...
Dataset already exist.
Table for errors already exist.
Table for checks already exist.
Table for events already exist.
Table for queries already exist.
php artisan vendor:publish --provider='Orinoko\StateMonitor\MonitorServiceProvider' --tag='public' --force
Ensure that real data is listed in APP_NAME and APP_URL. They are can be used to find the sender.
Exceptions automatically will be caught on web and api middleware groups. You can disable this middleware in .env file.
Also exist middleware for custom routes and other:
->middleware('state-monitor-errors')
Called manually
Monitor::validateRequest($type,$url,$method,$params=[],$user='',$domain='')
Called manually
Monitor::storeEvent($message,$priority=0,$url='',$method='',$params=[],$user='',$domain='')
If STATE_MONITOR_LOG_QUERIES is enabled, it will automatically log all queries to the appropriate table.
After publishing assets add to html
<script src="/vendor/state-monitor/js/monitor.js"></script>
Calling
<script>
if (typeof monitorAddEvent === "function")
monitorAddEvent('Page http://phplaravel-135581-835906.cloudwaysapps.com loaded');
</script>