twine-net / laravel-raven

Sentry (Raven) error monitoring for Laravel 4 & 5 with send in background
17 stars 2 forks source link

Pass environment to sentry #8

Closed tremby closed 9 years ago

tremby commented 9 years ago

It would be good to have a default tag being sent to Sentry for the current environment.

I'm setting it currently like this in the config file:

'options' => [
    'tags' => [
        'environment' => App::environment(),
    ],
],

I think this would be a useful default, whether in the default config file or added automatically.

pulkitjalan commented 9 years ago

That is already defaulted: https://github.com/clowdy/laravel-raven/blob/master/src/Client.php#L35, so you should not need to do that.

Passed in via the service provider: https://github.com/clowdy/laravel-raven/blob/master/src/RavenServiceProvider.php#L78

Same on L4

tremby commented 9 years ago

That does not appear in the Sentry report for me.

pulkitjalan commented 9 years ago

Are you using L4 or L5?

tremby commented 9 years ago

L4 on the project I'm testing on right now. I'll be using it with L5 too.

Ah, found the problem. When I define other tags, the default one is removed. Perhaps you need an array_merge_recursive call in there somewhere.

tremby commented 9 years ago

Oh, you're not even merging it. It's a flat array, so no recursion necessary. Want a patch to merge the configured with the defaults, or did you decide to replace all default tags with configured ones on purpose?

pulkitjalan commented 9 years ago

Ah nice spot, changed the array_merge to array_replace_recursive, so should be fixed now.

tremby commented 9 years ago

Works for me. Thanks.