File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 5
5
namespace Sentry \SentryBundle \Tests \End2End \App \Controller ;
6
6
7
7
use Doctrine \DBAL \Connection ;
8
+ use Sentry \State \HubInterface ;
9
+ use Sentry \Tracing \SpanContext ;
8
10
use Symfony \Component \HttpFoundation \Response ;
9
11
10
12
class TracingController
11
13
{
14
+ /**
15
+ * @var HubInterface
16
+ */
17
+ private $ hub ;
18
+
12
19
/**
13
20
* @var Connection|null
14
21
*/
15
22
private $ connection ;
16
23
17
- public function __construct (Connection $ connection = null )
24
+ public function __construct (HubInterface $ hub , Connection $ connection = null )
18
25
{
26
+ $ this ->hub = $ hub ;
19
27
$ this ->connection = $ connection ;
20
28
}
21
29
22
30
public function pingDatabase (): Response
23
31
{
32
+ $ this ->hub ->setSpan (
33
+ $ this ->hub ->getSpan ()
34
+ ->startChild ($ this ->createSpan ())
35
+ );
36
+
24
37
if ($ this ->connection ) {
25
38
$ this ->connection ->executeQuery ('SELECT 1 ' );
26
39
}
27
40
28
41
return new Response ('Success ' );
29
42
}
43
+
44
+ private function createSpan (): SpanContext
45
+ {
46
+ $ spanContext = new SpanContext ();
47
+ $ spanContext ->setOp ('mock.span ' );
48
+ $ spanContext ->setDescription ('mocked subspan ' );
49
+
50
+ return $ spanContext ;
51
+ }
30
52
}
Original file line number Diff line number Diff line change 6
6
7
7
services :
8
8
Sentry\SentryBundle\Tests\End2End\App\Controller\TracingController :
9
+ autowire : true
9
10
arguments :
10
- - ' @?doctrine.dbal.default_connection'
11
+ $connection : ' @?doctrine.dbal.default_connection'
11
12
tags :
12
13
- controller.service_arguments
You can’t perform that action at this time.
0 commit comments