spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.8k stars 87 forks source link

OpenTelemetry integration drops http.url, spams warning logs #1125

Closed devnev closed 1 month ago

devnev commented 1 month ago

Description

When using the opentelemetry integration of spiral, every request causes a log

2024-08-26T08:25:11.578197407Z {"level":"info","ts":1724660711578073811,"logger":"server","msg":"OpenTelemetry: [warning] attribute with non-primitive or non-homogeneous array of primitives dropped: http.url in /var/www/vendor/open-telemetry/sdk/Common/Attribute/AttributesBuilder.php(90)\n"}

How To Reproduce

Any spiral setup with OpenTelemetryBootloader::class in the bootloaders.

Additional Info

Q A
Framework Version 3.13.0
PHP version 8.2.22
Operating system Linux

As far as I can tell, this is because in spiral/framework/src/Http/src/Http.php, the attribute http.url is set to $request->getUri() (a UriInterface), possibly under the assumption that opentelemetry-php will convert this to a string.