Open netdjw opened 8 months ago
Hi @netdjw , middleware is registered automatically. I have updated the code, please do: composer update Now when you will visit /apm url, controller will show an error if it can't create /storage/app/apm folder. If that is the case, it means that file permissions are incorrect. Please report whether you will get an error after the composer update.
Hi @mantas-done , I updated to v1.0.10, but still the same.
This is my config/apm.php
:
<?php
return [
/**
* Enable or disable APM
*/
'enabled' => env('MONITORING_APM', false),
/**
* How many results per page to show
*/
'per_page' => 100,
/**
* Logs only part of requests. 1 - 100%, 0.1 - 10% of requests.
*/
'sampling' => 1,
/**
* Log queries of pages that spent in SQL more than given seconds
*/
'slow' => 3,
];
The storage/app/apm/
directory has 777 mod for testing.
I made a test exception in my code to verify the middleware is in the stacktrace and I see this:
Done \ LaravelAPM \ Middleware \ DelayedWriter: 12 handle
So the middleware is loaded just not write the log file.
Can you try setting 'enabled' to 'true' or adding to your .env file: MONITORING_APM=1
If that didn't work I will think of a better way to debug.
On Sat, Feb 10, 2024, 07:49 Balázs Winkler @.***> wrote:
Hi @mantas-done https://github.com/mantas-done , I updated to v1.0.10, but still the same.
This is my config/apm.php:
<?php return [ /* Enable or disable APM */ 'enabled' => env('MONITORING_APM', false),
/** * How many results per page to show */ 'per_page' => 100, /** * Logs only part of requests. 1 - 100%, 0.1 - 10% of requests. */ 'sampling' => 1, /** * Log queries of pages that spent in SQL more than given seconds */ 'slow' => 3,
];
The storage/app/apm/ directory has 777 mod for testing.
I made a test exception in my code to verify the middleware is in the stacktrace and I see this:
Done \ LaravelAPM \ Middleware \ DelayedWriter: 12 handle
So the middleware is loaded just not write the log file.
— Reply to this email directly, view it on GitHub https://github.com/mantas-done/laravel-apm/issues/7#issuecomment-1936889212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECVOJQE7XJB5CHFNYR426DYS4C6JAVCNFSM6AAAAABC5H7BZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWHA4DSMRRGI . You are receiving this because you were mentioned.Message ID: @.***>
Still not work. I tried with 'enabled'
, true
and 1
values too.
I used dd
to catch what methods are calling, but not called any method of any watcher. But DelayedWriter
's handle
method is called with this code:
public function handle($request, Closure $next)
{
return $next($request);
}
I think this isn't do anything.
LogWriter's methods also not called.
Sorry about slow replies, I'm was busy a while.
DelayedWriter writes to file only after the user's request is returned. (terminate method) Could you add Log::info('test'); into different places in code to check whether LogWriter::write(); is executed on your system?
I added and not executing.
Just making sure, you have looked into your log files? (because terminate method executes when the response is already sent to the browser and doing dd() or echo won't show up in the browser).
Got the same issue. Added Log::info('test'); in DelayedResponse, log test shown on file but no request apm is logged
Got the same issue. Added Log::info('test'); in DelayedResponse, log test shown on file but no request apm is logged
if possible, can you also add Log::info('test') inside the ::write() method and see where it gets stuck. Whether it can't create a directory or file. That would help me to fix this issue. Because I don't know how to reproduce this problem on my end.
it seems that the listener got registered here $this->app['events']->listen(RequestHandled::class, [RequestWatcher::class, 'record']);
but RequestWatcher::class, 'record' method isn't called
It seems that I ran using laravel 5.3
by adding this, the requests are logged $this->app['events']->listen('kernel.handled', [RequestWatcher::class, 'record']);
In composer.json, it requires at least Laravel 5.5.
don't know why my composer can install this though. but now works on my side
I made all steps from README, but log file isn't created so the package always show nothing on charts.
Isn't miss the documentation register a middleware or similar thing?