Skip to content

Commit 4605f3a

Browse files
committed
Merge branch '2.0.x'
2 parents 4914725 + c1f85d8 commit 4605f3a

File tree

5 files changed

+67
-6
lines changed

5 files changed

+67
-6
lines changed

src/Bridge/RequestSpanListener.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use Jaeger\Http\HttpCodeTag;
77
use Jaeger\Http\HttpMethodTag;
88
use Jaeger\Http\HttpUriTag;
9+
use Jaeger\Symfony\Tag\DebugRequestTag;
910
use Jaeger\Symfony\Tag\SymfonyComponentTag;
1011
use Jaeger\Symfony\Tag\SymfonyVersionTag;
11-
use Jaeger\Tag\DoubleTag;
12-
use Jaeger\Tag\LongTag;
12+
use Jaeger\Symfony\Tag\TimeMicroTag;
13+
use Jaeger\Symfony\Tag\TimeSourceTag;
14+
use Jaeger\Symfony\Tag\TimeValueTag;
1315
use Jaeger\Tag\SpanKindServerTag;
14-
use Jaeger\Tag\StringTag;
1516
use Jaeger\Tracer\TracerInterface;
1617
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1718
use Symfony\Component\HttpFoundation\Request;
@@ -88,11 +89,15 @@ public function onRequest(GetResponseEvent $event)
8889
$value = $request->server->get('REQUEST_TIME_FLOAT', microtime(true));
8990
$startTime = (int)($value * 1000000);
9091
$requestSpan
91-
->addTag(new StringTag('time.source', $source))
92-
->addTag(new DoubleTag('time.value', $value))
93-
->addTag(new LongTag('time.micro', $startTime))
92+
->addTag(new TimeSourceTag($source))
93+
->addTag(new TimeValueTag($value))
94+
->addTag(new TimeMicroTag($startTime))
9495
->start($startTime);
9596
}
97+
if ($requestSpan->getContext()->isDebug()
98+
&& ($requestId = (string)$requestSpan->getItem('debug.request'))) {
99+
$requestSpan->addTag(new DebugRequestTag($requestId));
100+
}
96101
$this->spans->push($requestSpan);
97102

98103
return $this;

src/Tag/DebugRequestTag.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Jaeger\Symfony\Tag;
5+
6+
use Jaeger\Tag\StringTag;
7+
8+
class DebugRequestTag extends StringTag
9+
{
10+
public function __construct(string $value)
11+
{
12+
parent::__construct('debug.request', $value);
13+
}
14+
}

src/Tag/TimeMicroTag.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Jaeger\Symfony\Tag;
5+
6+
use Jaeger\Tag\LongTag;
7+
8+
class TimeMicroTag extends LongTag
9+
{
10+
public function __construct(int $value)
11+
{
12+
parent::__construct('time.micro', $value);
13+
}
14+
}

src/Tag/TimeSourceTag.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Jaeger\Symfony\Tag;
5+
6+
use Jaeger\Tag\StringTag;
7+
8+
class TimeSourceTag extends StringTag
9+
{
10+
public function __construct(string $value)
11+
{
12+
parent::__construct('time.source', $value);
13+
}
14+
}

src/Tag/TimeValueTag.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Jaeger\Symfony\Tag;
5+
6+
use Jaeger\Tag\DoubleTag;
7+
8+
class TimeValueTag extends DoubleTag
9+
{
10+
public function __construct(float $value)
11+
{
12+
parent::__construct('time.value', $value);
13+
}
14+
}

0 commit comments

Comments
 (0)