Skip to content

Commit

Permalink
fix zipkin tag value type
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Aug 24, 2021
1 parent 35d20d5 commit 931a280
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/Tracing/Exporter/ZipkinExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ private function convertAttributes(array $attributes): array
$tags = [];

foreach ($attributes as $k => $v) {
if (is_bool($v)) {
$v = (string) $v;
}
$tags[$k] = $v;
$tags[$k] = (string) $v;
}

return $tags;
Expand Down
4 changes: 3 additions & 1 deletion tests/Tracing/TransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function testZipkin()
$span = $tracer->getActiveSpan();
$event = $span->addEvent('hello world');
$span->setAttribute('nick', 'nekufa');
$span->setAttribute('counter', 27);
$span->end();

$client = new MockHttpClient([
Expand All @@ -38,8 +39,9 @@ function ($method, $url, $options) use ($span, $event) {
$this->assertSame($row->duration, (int) $duration);

$this->assertEquals($row->localEndpoint, (object) [ 'serviceName' => 'tester' ]);
$this->assertCount(1, get_object_vars($row->tags));
$this->assertCount(2, get_object_vars($row->tags));
$this->assertSame($row->tags->nick, 'nekufa');
$this->assertSame($row->tags->counter, '27');
$this->assertCount(1, $row->annotations);

[ $annotation ] = $row->annotations;
Expand Down

0 comments on commit 931a280

Please sign in to comment.