Skip to content

Commit

Permalink
ensure zipkin tags and attributes are cast to strings (#1406)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc authored Oct 16, 2024
1 parent 4cd63c3 commit 05ef43d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SpanConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ private function convertSpan(SpanDataInterface $span): array
}

if ($span->getTotalDroppedEvents() > 0) {
$row['tags'][self::KEY_DROPPED_EVENTS_COUNT] = $span->getTotalDroppedEvents();
$row['tags'][self::KEY_DROPPED_EVENTS_COUNT] = (string) $span->getTotalDroppedEvents();
}

if ($span->getTotalDroppedLinks() > 0) {
$row['tags'][self::KEY_DROPPED_LINKS_COUNT] = $span->getTotalDroppedLinks();
$row['tags'][self::KEY_DROPPED_LINKS_COUNT] = (string) $span->getTotalDroppedLinks();
}

$droppedAttributes = $span->getAttributes()->getDroppedAttributesCount()
+ $span->getInstrumentationScope()->getAttributes()->getDroppedAttributesCount()
+ $span->getResource()->getAttributes()->getDroppedAttributesCount();

if ($droppedAttributes > 0) {
$row['tags'][self::KEY_DROPPED_ATTRIBUTES_COUNT] = $droppedAttributes;
$row['tags'][self::KEY_DROPPED_ATTRIBUTES_COUNT] = (string) $droppedAttributes;
}

if (($span->getKind() === SpanKind::KIND_CLIENT) || ($span->getKind() === SpanKind::KIND_PRODUCER)) {
Expand Down Expand Up @@ -201,7 +201,7 @@ private static function toAnnotation(EventInterface $event): array
'value' => $value,
];
if ($event->getAttributes()->getDroppedAttributesCount() > 0) {
$annotation[self::KEY_DROPPED_ATTRIBUTES_COUNT] = $event->getAttributes()->getDroppedAttributesCount();
$annotation[self::KEY_DROPPED_ATTRIBUTES_COUNT] = (string) $event->getAttributes()->getDroppedAttributesCount();
}

return $annotation;
Expand Down

0 comments on commit 05ef43d

Please sign in to comment.