Skip to content

Commit

Permalink
Remove application metrics
Browse files Browse the repository at this point in the history
This just served as an initial example.
Real application metrics will be added
in another pull request.
  • Loading branch information
marein committed Oct 5, 2022
1 parent 3005e28 commit abc9f5b
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 207 deletions.
6 changes: 0 additions & 6 deletions config/connect-four/routing.yml

This file was deleted.

8 changes: 0 additions & 8 deletions config/connect-four/services/metrics.yml

This file was deleted.

4 changes: 2 additions & 2 deletions config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Gaming:
resource: '*/routing.yml'
WebInterface:
resource: web-interface/routing.yml
1 change: 0 additions & 1 deletion config/web-interface/services/event_listener.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ services:
public: false
arguments:
- '@web-interface.identity-service'
- '/^\/metrics\//'
tags:
- { name: kernel.event_listener, event: kernel.request }
2 changes: 0 additions & 2 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ services:
- "traefik.http.routers.php-fpm.priority=10"
- "traefik.http.routers.php-fpm.rule=PathPrefix(`/`)"
- "traefik.http.services.php-fpm.loadbalancer.server.port=80"
- "prometheus-job=php-fpm"
- "prometheus-path=/metrics/connect-four"

##############################
# Long running processes #
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ services:
- "traefik.http.routers.php-fpm.priority=10"
- "traefik.http.routers.php-fpm.rule=PathPrefix(`/`)"
- "traefik.http.services.php-fpm.loadbalancer.server.port=80"
- "prometheus-job=php-fpm"
- "prometheus-path=/metrics/connect-four"

##############################
# Long running processes #
Expand Down
136 changes: 0 additions & 136 deletions docker/grafana/dashboards/connect-four/application-metrics.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/ConnectFour/Port/Adapter/Http/MetricsController.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@

final class AssignUserIdOnKernelRequest
{
public function __construct(
private readonly IdentityService $identityService,
private readonly string $ignoredPathExpression
) {
private IdentityService $identityService;

public function __construct(IdentityService $identityService)
{
$this->identityService = $identityService;
}

public function onKernelRequest(RequestEvent $event): void
{
if ($this->shouldIgnoreRequest($event)) {
if (!$event->isMainRequest()) {
return;
}

$session = $event->getRequest()->getSession();
$request = $event->getRequest();
$session = $request->getSession();

if (!$session->has('user')) {
// todo Create user only when it's really needed.
Expand All @@ -31,10 +33,4 @@ public function onKernelRequest(RequestEvent $event): void
$session->set('user', $this->identityService->arrive()['userId']);
}
}

private function shouldIgnoreRequest(RequestEvent $event): bool
{
return !$event->isMainRequest()
|| preg_match($this->ignoredPathExpression, $event->getRequest()->getRequestUri()) === 1;
}
}

0 comments on commit abc9f5b

Please sign in to comment.