Skip to content

Commit 323f493

Browse files
committed
Merge branch '2.0.x' into 1.0.x
2 parents a18081f + c1f85d8 commit 323f493

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
@@ -4,12 +4,13 @@
44
use Jaeger\Http\HttpCodeTag;
55
use Jaeger\Http\HttpMethodTag;
66
use Jaeger\Http\HttpUriTag;
7+
use Jaeger\Symfony\Tag\DebugRequestTag;
78
use Jaeger\Symfony\Tag\SymfonyComponentTag;
89
use Jaeger\Symfony\Tag\SymfonyVersionTag;
9-
use Jaeger\Tag\DoubleTag;
10-
use Jaeger\Tag\LongTag;
10+
use Jaeger\Symfony\Tag\TimeMicroTag;
11+
use Jaeger\Symfony\Tag\TimeSourceTag;
12+
use Jaeger\Symfony\Tag\TimeValueTag;
1113
use Jaeger\Tag\SpanKindServerTag;
12-
use Jaeger\Tag\StringTag;
1314
use Jaeger\Tracer\TracerInterface;
1415
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1516
use Symfony\Component\HttpFoundation\Request;
@@ -86,11 +87,15 @@ public function onRequest(GetResponseEvent $event)
8687
$value = $request->server->get('REQUEST_TIME_FLOAT', microtime(true));
8788
$startTime = (int)($value * 1000000);
8889
$requestSpan
89-
->addTag(new StringTag('time.source', $source))
90-
->addTag(new DoubleTag('time.value', $value))
91-
->addTag(new LongTag('time.micro', $startTime))
90+
->addTag(new TimeSourceTag($source))
91+
->addTag(new TimeValueTag($value))
92+
->addTag(new TimeMicroTag($startTime))
9293
->start($startTime);
9394
}
95+
if ($requestSpan->getContext()->isDebug()
96+
&& ($requestId = (string)$requestSpan->getItem('debug.request'))) {
97+
$requestSpan->addTag(new DebugRequestTag($requestId));
98+
}
9499
$this->spans->push($requestSpan);
95100

96101
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)