Skip to content

Commit 839f904

Browse files
committed
Add RequestIntegration back
1 parent 2a3de03 commit 839f904

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

DependencyInjection/MonologExtension.php

+29-6
Original file line numberDiff line numberDiff line change
@@ -683,14 +683,40 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
683683
);
684684

685685
if (!empty($handler['environment'])) {
686-
$options->addMethodCall('setEnvironment', [$handler['environment']]);
686+
$options->addMethodCall(
687+
'setEnvironment',
688+
array($handler['environment'])
689+
);
687690
}
688691

689692
if (!empty($handler['release'])) {
690-
$options->addMethodCall('setRelease', [$handler['release']]);
693+
$options->addMethodCall(
694+
'setRelease',
695+
array($handler['release'])
696+
);
691697
}
692698

693-
$builder = new Definition('Sentry\\ClientBuilder', array($options));
699+
$prefix = md5(uniqid(mt_rand(), true));
700+
$container->setDefinition("{$prefix}.sentry.options", $options);
701+
702+
$requestIntegration = new Definition(
703+
'Sentry\\Integration\\RequestIntegration',
704+
array(new Reference("{$prefix}.sentry.options"))
705+
);
706+
707+
$options->addMethodCall(
708+
'setIntegrations',
709+
array(array($requestIntegration))
710+
);
711+
712+
$options->setPublic(false);
713+
714+
// BC Symfony < 4
715+
if (method_exists($options, 'setPrivate')) {
716+
$options->setPrivate(true);
717+
}
718+
719+
$builder = new Definition('Sentry\\ClientBuilder', array(new Reference("{$prefix}.sentry.options")));
694720

695721
$client = new Definition('Sentry\\Client');
696722
$client->setFactory(array($builder, 'getClient'));
@@ -708,9 +734,6 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
708734
array(new Reference($clientId))
709735
);
710736

711-
// can't set the hub to the current hub, getting into a recursion otherwise...
712-
//$hub->addMethodCall('setCurrent', array($hub));
713-
714737
$definition->setArguments(array(
715738
$hub,
716739
$handler['level'],

0 commit comments

Comments
 (0)