Skip to content

Commit e4cc860

Browse files
committed
Fix error on background
1 parent 1ca6e33 commit e4cc860

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/Bridge/RequestSpanListener.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function onTerminate(PostResponseEvent $event)
5656
return $this;
5757
}
5858

59+
$this->tracer->finish($this->spans->pop());
5960
$this->tracer->finish(
6061
$this->spans->pop()->addTag(new HttpCodeTag($event->getResponse()->getStatusCode()))
6162
);
@@ -78,16 +79,18 @@ public function onResponse(FilterResponseEvent $event)
7879
}
7980

8081
$request = $event->getRequest();
81-
$this->tracer->start(
82-
$this->nameGenerator->generate() . ':background',
83-
[
84-
new HttpMethodTag($request->getMethod()),
85-
new HttpUriTag($request->getRequestUri()),
86-
new SpanKindServerTag(),
87-
new SymfonyComponentTag(),
88-
new SymfonyVersionTag(),
89-
new SymfonyBackgroundTag(),
90-
]
82+
$this->spans->push(
83+
$this->tracer->start(
84+
'background',
85+
[
86+
new HttpMethodTag($request->getMethod()),
87+
new HttpUriTag($request->getRequestUri()),
88+
new SpanKindServerTag(),
89+
new SymfonyComponentTag(),
90+
new SymfonyVersionTag(),
91+
new SymfonyBackgroundTag(),
92+
]
93+
)
9194
);
9295

9396
return $this;

0 commit comments

Comments
 (0)