monolog icon indicating copy to clipboard operation
monolog copied to clipboard

SlackHandler does not timeout

Open Flightfreak opened this issue 4 years ago • 6 comments

Monolog version 1.26.1

In a Laravel application we are using the SlackHandler for verbose logging. We see from our APM New Relic that certain logging processes are taking much longer than we allow them to.

image

$handler = new SlackHandler($key, '#notices', 'username', true, null, Logger::NOTICE, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);

$handler = new SlackHandler($key, '#warnings', 'username', true, null, Logger::WARNING, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);

$handler = new SlackHandler($key, '#errors', 'username', true, null, Logger::ERROR, false, false, true);
$handler->setConnectionTimeout(2);
$handler->setTimeout(4);
$monolog->pushHandler($handler);

I'm looking for any advice on how to further analyze and control this.

Flightfreak avatar Oct 07 '21 10:10 Flightfreak

@Flightfreak Can you please give more info about this.

As far as I see in the image, the timeout limit was never reached (not connection or normal timeout).

I mean, your image shows a total time of 1160 ms ... that is 1.16 seconds ... right? As far as I understand the timeout values you are setting are expressed in seconds.

Maybe I am not getting the picture, in that case, please provide more info. Thanks in advance.

juan-morales avatar Oct 24 '21 12:10 juan-morales

@juan-morales thank you for stepping in. It is actually 1 160 000 ms that is 19 minutes.

Flightfreak avatar Oct 27 '21 06:10 Flightfreak

@Flightfreak @Seldaek I created a pull request: #1606

is a draft pull request, which I would like your opinion about it as I am not 100% sure if is a proper solution.

(some tests are failing, but still would like an opinion, in the meanwhile I will try to fix the failing tests)

juan-morales avatar Oct 27 '21 13:10 juan-morales

Change is ready

juan-morales avatar Nov 03 '21 06:11 juan-morales

Thank you @juan-morales! I'm not familiar enough with the related stream functionalities but I will try to test this.

Flightfreak avatar Nov 03 '21 21:11 Flightfreak

any updates on this one? :ok_man:

juan-morales avatar Nov 15 '21 09:11 juan-morales