Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add fileProcessing measurements #39

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Classes/EventListener/FileProcessingEventListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace Kanti\ServerTiming\EventListener;

use Kanti\ServerTiming\Dto\StopWatch;
use Kanti\ServerTiming\Utility\TimingUtility;
use TYPO3\CMS\Core\Resource\Event\AfterFileProcessingEvent;
use TYPO3\CMS\Core\Resource\Event\BeforeFileProcessingEvent;

final class FileProcessingEventListener
{
public StopWatch|null $stopWatch = null;

public function before(BeforeFileProcessingEvent $event): void
{
if (!$event->getProcessedFile()->isProcessed()) {
$this->stopWatch?->stopIfNot();
$this->stopWatch = TimingUtility::stopWatch('fileProcessing', $event->getProcessedFile()->getName());
}
}

public function after(AfterFileProcessingEvent $event): void
{
$this->stopWatch?->stopIfNot();
$this->stopWatch = null;
}
}
15 changes: 14 additions & 1 deletion Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@ services:
identifier: kanti/server-timing/mail-event-listener
event: TYPO3\CMS\Core\Mail\Event\AfterMailerSentMessageEvent
method: stop

Kanti\ServerTiming\EventListener\BootCompletedEventListener:
tags:
-
name: event.listener
identifier: kanti/server-timing/boot-completed-event-listener
event: TYPO3\CMS\Core\Core\Event\BootCompletedEvent

Kanti\ServerTiming\EventListener\FileProcessingEventListener:
tags:
-
name: event.listener
identifier: kanti/server-timing/file-processing
event: TYPO3\CMS\Core\Resource\Event\BeforeFileProcessingEvent
method: before

-
name: event.listener
identifier: kanti/server-timing/file-processing
event: TYPO3\CMS\Core\Resource\Event\AfterFileProcessingEvent
method: after
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ at the moment there is nothing to configure
- `mail`: shows the mails that are send (only TYPO3 >=12)
- `dataP`: Shows the DataProcessors that were executed
- `extbase`: show all Extbase dispatches, (forwards are included in the original action call)
- `fileProcessing`: show all file processing calls
- `http.client`: external API calls are measured if they use the official TYPO3 `RequestFactory` or the `GuzzleClientFactory`)

> if a measurement key has more than 4 entries, they will get combined into one total time with a count.
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
},
"config": {
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true,
"phpro/grumphp": true,
"pluswerk/grumphp-config": true,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"php-http/discovery": false,
"phpro/grumphp": true,
"phpstan/extension-installer": true,
"ergebnis/composer-normalize": true,
"php-http/discovery": false
"pluswerk/grumphp-config": true,
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
},
"extra": {
Expand Down
Loading