open-telemetry / opentelemetry-swift

OpenTelemetry API for Swift
https://opentelemetry.io/docs/instrumentation/swift/
Apache License 2.0
209 stars 129 forks source link

LogRecord is out of Spec, expand log body field to type Any #462

Closed bryce-b closed 9 months ago

bryce-b commented 11 months ago

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-body The log data body field should take any type, but the swift implementation only allows strings

jCharv commented 10 months ago

Hey @bryce-b , I've been looking into this for a bit because we'll need LogRecords to accept binary data.

I've tried a very simple solution where I extended AttributeValue with a Data value, and then used AttributeValue as a type for the LogRecord.body. This enables sending binary data both in LogRecord.attributes and in LogRecord.body.

Am I correct to assume that this approach is not suitable for a PR, because this exposes Data value as an Attribute for all other signals as well? I'm not quite sure that this would be a bug or a feature.

bryce-b commented 10 months ago

Replace AttributeValue in LogRecords with something else that is encodable.