2017 © Pedro Peláez
 

symfony-bundle status-page-bundle

Stores some metrics in Redis and provides a status page for Symfony projects

image

javihgil/status-page-bundle

Stores some metrics in Redis and provides a status page for Symfony projects

  • Tuesday, December 5, 2017
  • by javihgil
  • Repository
  • 1 Watchers
  • 1 Stars
  • 634 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 12 % Grown

The README.md

Status Page Bundle

This bundle is under development, not yet stable, (*1)

Status Page Bundle allows to store some metrics in redis server to provide a status page., (*2)

Configuration

# app/config/config.yml
jhg_status_page:
    predis_client_id: predis_service_id
    metrics:
        requests_per_minute:
            type: request_count
            period: minute
            expire: "+24 hours"
            condition: "not (request.getPathInfo() matches '/^\\\\/_status/i')"
        response_count_404:
            type: response_count
            period: minute
            expire: "next day"
            condition: "response.getStatusCode() == 404"
        response_time:
            type: response_time
            period: minute
            expire: "+24 hours"
            condition: "not (request.getPathInfo() matches '/^\\\\/_status/i')"
        exception:
            type: exception
            period: minute
            expire: "tomorrow"
        requests_per_hour:
            type: request_count
            period: hour
            expire: "next month"
        api_requests_per_minute:
            type: request_count
            period: minute
            expire: "+24 hours"
            condition: "request.getPathInfo() matches '/^\\\\/api/i'"

# routing.yml
_status_page:
    resource: "@JhgStatusPageBundle/Resources/config/routing.yml"
    prefix: /status

Custom status events

For example, if you want to store each FOSUserBundle success register, you can implement this status listener:, (*3)

AppBundle/EventListener/LoginStatusListener.php, (*4)

<?php

namespace AppBundle\EventListener;

use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\FOSUserEvents;
use Jhg\StatusPageBundle\Status\StatusCount;
use Jhg\StatusPageBundle\StatusListener\AbstractStatusListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class RegistrationStatusListener extends AbstractStatusListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            FOSUserEvents::REGISTRATION_SUCCESS => ['onUserRegister' => 1024],
        ];
    }

    public function onUserLogin(FormEvent $event)
    {
        $this->statusStack->registerStatus(new StatusCount($this->eventKey, $this->eventPeriod, $this->eventExpire));
    }
}

app/config/config.yml, (*5)

jhg_status_page:
    predis_client_id: predis_service_id
    metrics:
        registration_success_count:
            type: custom
            class: AppBundle\StatusListener\RegistrationStatusListener
            period: minute
            expire: "+24 hours"

The Versions

05/12 2017

dev-master

9999999-dev

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires

 

05/12 2017

v0.1.4

0.1.4.0

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires

 

04/12 2017

v0.1.3

0.1.3.0

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires

 

04/12 2017

v0.1.2

0.1.2.0

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires

 

04/12 2017

v0.1.1

0.1.1.0

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires

 

04/12 2017

v0.1.0

0.1.0.0

Stores some metrics in Redis and provides a status page for Symfony projects

  Sources   Download

MIT

The Requires