Skip to content

Commit a2537ef

Browse files
author
Andrii Afanasiev
committed
docs and more tests
1 parent bc80685 commit a2537ef

File tree

5 files changed

+60
-9
lines changed

5 files changed

+60
-9
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class Configuration implements ConfigurationInterface
3939
];
4040

4141
public static $autoInstrument = [
42-
'network' => true,
43-
'log' => true,
44-
'dom' => true,
45-
'navigation' => true,
46-
'connectivit' => true,
42+
'network' => true,
43+
'log' => true,
44+
'dom' => true,
45+
'navigation' => true,
46+
'connectivity' => true,
4747
];
4848

4949
/**
@@ -149,7 +149,6 @@ public function getConfigTreeBuilder()
149149
->end()
150150
->scalarNode('verbose')->defaultFalse()->end()
151151
->scalarNode('async')->defaultTrue()->end()
152-
->scalarNode('autoInstrument')->defaultTrue()->end()
153152
->arrayNode('autoInstrument')
154153
->treatNullLike([])
155154
->prototype('scalar')->end()

Resources/doc/configuration.rst

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ Simple configuration of bundle:
4747
send_message_trace: false
4848
include_raw_request_body: false
4949
local_vars_dump: false
50+
rollbar_js:
51+
enabled: true
52+
accessToken: 'some-public-token'
53+
captureUncaught: true
54+
uncaughtErrorLevel: 'error'
55+
captureUnhandledRejections: true
56+
payload:
57+
environment: environment: '%kernel.environment%'
58+
ignoredMessages: []
59+
verbose: false
60+
async: true
61+
autoInstrument:
62+
network: true
63+
log: true
64+
dom: true
65+
navigation: true
66+
connectivity: true
67+
itemsPerMinute: 60
68+
maxItems: 0
69+
scrubFields: ['passwd', 'password', 'secret', 'confirm_password', 'password_confirmation', 'auth_token', 'csrf_token']
5070
5171
Bundle configuration
5272
--------------------
@@ -61,7 +81,7 @@ in `official documentation`_ for Rollbar PHP lib.
6181
.. _`official documentation`: https://rollbar.com/docs/notifier/rollbar-php/
6282

6383
RollBar - Settings
64-
--------------------
84+
------------------
6585

6686
Here you can description of some important configuration options for RollBar.
6787

@@ -75,7 +95,7 @@ Here you can description of some important configuration options for RollBar.
7595

7696

7797
RollBar - Person Tracking
78-
--------------------
98+
-------------------------
7999
Rollbar `can track`_ which of your People (users) are affected by each error. There is one of the options:
80100

81101
``person_fn``: A function reference (string, etc. - anything that `call_user_func()`_ can handle) returning an array like the one for 'person'.
@@ -122,3 +142,11 @@ Than in your ``PersonProvider`` class/service or function you have to return use
122142
123143
.. _`can track`: https://rollbar.com/docs/person-tracking/
124144
.. _`call_user_func()`: http://php.net/call_user_func
145+
146+
RollBarJS - Integration
147+
-----------------------
148+
It's possible to use `Rollbar for JavaScript`_ integration in your project. The basic configuration is assailable in configuration for current bundle.
149+
150+
Inject following ``{{ rollbarJs() }}`` code into the <head> of every page you want to monitor. It should be as high as possible, before any other <script> tags.
151+
152+
.. _`Rollbar for JavaScript`: https://rollbar.com/docs/notifier/rollbar.js/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
imports:
2+
- { resource: config.yml }
3+
- { resource: parameters.yml }
4+
5+
symfony_rollbar:
6+
enable: true
7+
exclude:
8+
- \Symfony\Component\Debug\Exception\FatalErrorException
9+
- \SymfonyRollbarBundle\Tests\Fixtures\MyAwesomeException
10+
- \ParseError
11+
rollbar:
12+
access_token: 'SOME_ROLLBAR_ACCESS_TOKEN_123456'
13+
environment: '%kernel.environment%'
14+
15+
rollbar_js:
16+
enabled: false
17+
accessToken: 'SOME_ROLLBAR_ACCESS_TOKEN_654321'
18+
payload:
19+
environment: '%kernel.environment%'

Tests/SymfonyRollbarBundle/Twig/RollbarExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function generatorRollbarEnv()
5959
// env, is-empty-functions
6060
['test', false],
6161
['test_drb', true],
62+
['test_drbj', true],
6263
];
6364
}
6465
}

Twig/RollbarExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public function __construct(ContainerInterface $container)
2828
$this->container = $container;
2929

3030
try {
31-
$this->config = $container->getParameter(SymfonyRollbarExtension::ALIAS . '.config');
31+
$config = $container->getParameter(SymfonyRollbarExtension::ALIAS . '.config');
32+
33+
if (!empty($config['rollbar_js']['enabled'])) {
34+
$this->config = $config;
35+
}
3236
} catch (\Exception $e) {
3337
return null;
3438
}

0 commit comments

Comments
 (0)