Steps to replicate the issue (include links if applicable):
$tracer = MediaWikiServices::getInstance()->getTracer(); $span = $tracer->createSpan( 'Causing problems' )->start(); $span->setAttributes( [ 'expand' => [ 'key_one', 'key_two' ] );
What happens?:
The code doesn't complain about storing the span, but when trying to export it the OtlpHttpExporter fails to export the trace.
I assume that the problem is most likely around the OtlpSerializer - how the data being sent to OTEL collector is serialized. Instead of getting http code 200 during export to the collector, we get 400:
A sample collector response for a failed export is:
http_code: 400
http_response: {"code":3,"message":"ReadObjectCB: expect { or n, but found [, error found in #10 byte of ...|ayValue\":[\"trust_and|..., bigger context ...|\"Lublin\"}},{\"key\":\"expand\",\"value\":{\"arrayValue\":[\"trust_and_relevance\",\"calls_to_action\"]}}]},{\"tra|..."}Request_ID: 86d13b3b-aff4-4059-adaf-68397e282aa8
This error is beggin logged in https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/4e6b470be5150281cea6e64e1efb68126e1f7056/includes/libs/Telemetry/OtlpHttpExporter.php#92
What should have happened instead?:
It should log the trace. Probably it would be good to also have some checks on what can be stored as an attribute as currently there is zero validation.