You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attaching object-valued tag values to Activity, when they are exported via TagWriter they are converted to their string representation via Convert.ToString.
This leads to issues with the exported attribute values, where one of two things happens:
The object structure and values are not exported. This is the situation with the default object.ToString implementation.
The object structure is not exported. This is the situation when ToString has been overridden and while the object property names + values are visible, it is not efficient to query.
What is the expected behavior?
If we could flatten objects automatically into key/ value pairs, e.g. given an object structure like this:
public record MyRecord(string Foo, string Bar);
When including this as a tag:
using var activity = ActivitySource.StartActivity("my_activity").AddTag("myrecord", new MyRecord("hello", "sir"))
The "myreord" tag would be converted into multiple OTel attributes that followed OTel attribute naming conventions (i.e snake_case + lowercased):
Which alternative solutions or features have you considered?
Currently no alternative exists in the standard library. The presence of Activity.AddTag(string key, object value) means it's very likely that users will incorrectly add
Additional context
No response
The text was updated successfully, but these errors were encountered:
Package
None
Is your feature request related to a problem?
When attaching object-valued tag values to
Activity
, when they are exported viaTagWriter
they are converted to their string representation viaConvert.ToString
.This leads to issues with the exported attribute values, where one of two things happens:
object.ToString
implementation.ToString
has been overridden and while the object property names + values are visible, it is not efficient to query.What is the expected behavior?
If we could flatten objects automatically into key/ value pairs, e.g. given an object structure like this:
When including this as a tag:
The "myreord" tag would be converted into multiple OTel attributes that followed OTel attribute naming conventions (i.e snake_case + lowercased):
As per the discussion in the specification repo around supporting maps, we wouldn't be able to serialize any non-primitive arrays.
Which alternative solutions or features have you considered?
Currently no alternative exists in the standard library. The presence of
Activity.AddTag(string key, object value)
means it's very likely that users will incorrectly addAdditional context
No response
The text was updated successfully, but these errors were encountered: