Skip to content

Commit

Permalink
Merge pull request #3 from jobee/update
Browse files Browse the repository at this point in the history
!!!TASK: Neos 7.x support
  • Loading branch information
albe authored Oct 14, 2021
2 parents 8d81774 + f6c8064 commit 712805f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
24 changes: 0 additions & 24 deletions Classes/Http/CheckEnabledComponent.php

This file was deleted.

35 changes: 35 additions & 0 deletions Classes/Http/Middleware/CheckEnabledMiddleware.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace Flowpack\Fusion\Tracing\Http\Middleware;

use Flowpack\Fusion\Tracing\Aspect\RuntimeTracing;
use Neos\Flow\Annotations as Flow;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

/**
* Look for a "X-Fusion-Tracing" request header and start tracing
*/
class CheckEnabledMiddleware implements MiddlewareInterface
{
/**
* @Flow\Inject
* @var RuntimeTracing
*/
protected $runtimeTracing;

/**
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$traceNameHeader = $request->getHeaderLine('X-Fusion-Tracing');
if (!empty($traceNameHeader)) {
$this->runtimeTracing->enable($traceNameHeader);
}
return $handler->handle($request);
}
}
9 changes: 4 additions & 5 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Neos:
Flow:
http:
chain:
'preprocess':
chain:
'flowpackFusionTracingCheckEnabled':
component: 'Flowpack\Fusion\Tracing\Http\CheckEnabledComponent'
middlewares:
flowpackFusionTracingCheckEnabled:
position: 'start 999'
middleware: 'Flowpack\Fusion\Tracing\Http\Middleware\CheckEnabledMiddleware'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "neos-package",
"name": "flowpack/fusion-tracing",
"require": {
"neos/fusion": "^4.3 || ^5.0 || dev-master"
"neos/fusion": "^7.0 || dev-master"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 712805f

Please sign in to comment.