GithubHelp home page GithubHelp logo

oxcom / symfony-rollbar-bundle Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 30.0 185 KB

Bundle for Symfony that integrates Rollbar tracker

License: MIT License

PHP 100.00%
symfony rollbar bundle symfony-framework

symfony-rollbar-bundle's People

Contributors

jeffreymb avatar ownede avatar oxcom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

symfony-rollbar-bundle's Issues

CamelCase or snack_case?

Hi, guys. I saw, you added rollbar_js configuration, but under this section you used CamelCase.
It's a bad practice use of writing compound words.
Could you please use snake case to write configuration for rollbar js section as you used for rollbar section?

ExceptionListener tries to serialize Closure on \Error (PHP 7+)

On PHP 7+ (happened on 7.1.14), the bundle tries to serialize Closure when it catches \Error based throwable (f.e \TypeError).

Error:

Error: Uncaught Exception: Serialization of 'Closure' is not allowed in vendor/oxcom/symfony-rollbar-bundle/EventListener/ExceptionListener.php:53

Person tracking

Hi,

For the person tracking, may I know the correct way to use it with the bundle?

I have tried defining the person_fn to my service, but the getPerson() method in my service never gets called unless I override the person configuration definition (https://github.com/OxCom/symfony-rollbar-bundle/blob/master/DependencyInjection/Configuration.php#L141) with the following:

->scalarNode('person')->defaultNull()->end()

I try this because in rollbar-php https://github.com/rollbar/rollbar-php/blob/v1.6.3/src/DataBuilder.php#L868 it will skip the function call if person is not null which it isn't in default bundle config (default value is []). Trying to force it to null will still result in empty array value.

I'm using PHP7.2 btw.

Thanks

A tree builder without a root node is deprecated

25x: A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.
    4x in SymfonyRollbarExtensionTest::testConfigEnabledVars from SymfonyRollbarBundle\Tests\DependencyInjection
    4x in SymfonyRollbarExtensionTest::testConfigDisabledVars from SymfonyRollbarBundle\Tests\DependencyInjection
    4x in PersonProviderTest::testConstPerson from SymfonyRollbarBundle\Tests\Provider
    2x in BundleTest::setUp from SymfonyRollbarBundle\Tests
    2x in CheckIgnoreTest::testCheckIgnore from SymfonyRollbarBundle\Tests\Provider
    2x in CheckIgnoreTest::testPersonProviderFunction from SymfonyRollbarBundle\Tests\Provider
    2x in PersonProviderTest::testPersonProviderWasCalled from SymfonyRollbarBundle\Tests\Provider
    2x in RollbarHandlerTest::testWriteDisabledRollbar from SymfonyRollbarBundle\Tests\Provider
    2x in RollbarExtensionTest::testRollbarJs from SymfonyRollbarBundle\Tests\Twig
    1x in ConfigurationTest::testEmptyConfiguration from SymfonyRollbarBundle\Tests\DependencyInjection

Add ability to collect person data

Rollbar allows Person tracking. Very useful in some cases (you can track previous errors of given user etc).

It's able to send data about logged user:

  • id (required)
  • username (optional)
  • email (optional)

As the bundle uses Monolog, this StackOverflow answer should help a bit.
Of course, we should be able to configure which data we'd like to send to Rollbar.

person_fn parameter is not null by default

Hello, guys. I have a question about person_fn config parameter. Why is it null by default?
Why don't you define a class like this by default:

class PersonProvider implements InterfacePersonProvider
{
    /** @var TokenStorageInterface */
    private $tokenStorage;

    public function __construct(TokenStorageInterface $tokenStorage)
    {
        $this->tokenStorage = $tokenStorage;
    }

    public function getPerson(): array
    {
        if ($token = $this->tokenStorage->getToken()) {
            $user = $token->getUser();
            if (!$user || !is_object($user)) {
                return [];
            }

            $userData = [];
            if (method_exists($user, 'getId')) {
                $userData['id'] = $user->getId();
            } else {
                // id is required
                $userData['id'] = $user->getUsername();
            }

            $userData['username'] = $user->getUsername();
            if (method_exists($user, 'getEmail')) {
                $userData['email'] = $user->getEmail();
            }

            return $userData;
        }

        return [];
    }
}

So, it would be convenient for a lot of users, because they don't need to create own service to get user data. It's better than nothing, isn't it?
And of course they can override it, if they would need some additional data.

Can't install

Hi,

Trying to install the bundle but getting the following error :

There is no extension able to load the configuration for "symfony_rollbar"

I have the bundle registered in config/bundles.php

Any idea why I'm getting this error ?

Thanks in advance,
Julien

Wrong parameter value in config

Hello. I found some unexpected behaviour in your bundle. Could you please tell me why you placed \Symfony\Component\Debug\Exception\FatalErrorException to exclude section in config?
Simplified example.

$array = [];
// developer thinks that $array it is ArrayCollection
$array->first(); // For php 7 \Error will be thrown here

We use symfony v3.4.15
To process the error, Symfony\Component\Debug\ErrorHandler::handleException
will be called, which converts Error to FatalThrowableError which extends FatalErrorException
Look here on code: https://github.com/symfony/debug/blob/master/ErrorHandler.php#L520

As result, error will be not reported because of exclude default values in config.

If you want to show how to use exclude option, I suggest to create ExampleException class in SymfonyRollbarBundle which won't used anywhere and put this exception to exclude section.
What do you think about it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.