From 0e7804c176c4b09d95b7985400aa38ce544cb7fc Mon Sep 17 00:00:00 2001 From: Grzegorz Drozd <1885137+GrzegorzDrozd@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:55:41 +0200 Subject: [PATCH] Fix missing metrics attributes in console exporter (#1558) This PR fixes a case that when using console exporter for metrics, attributes are not included in the export. --- Common/Attribute/Attributes.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Common/Attribute/Attributes.php b/Common/Attribute/Attributes.php index 800a10f..1df6a92 100644 --- a/Common/Attribute/Attributes.php +++ b/Common/Attribute/Attributes.php @@ -6,12 +6,13 @@ use function array_key_exists; use IteratorAggregate; +use JsonSerializable; use Traversable; /** * @psalm-suppress MissingTemplateParam */ -final class Attributes implements AttributesInterface, IteratorAggregate +final class Attributes implements AttributesInterface, IteratorAggregate, JsonSerializable { /** * @internal @@ -48,6 +49,11 @@ public function count(): int return \count($this->attributes); } + public function jsonSerialize(): mixed + { + return $this->attributes; + } + public function getIterator(): Traversable { foreach ($this->attributes as $key => $value) {