-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent transform of attribute values #2010
Comments
Ah apologies, I just saw this related issue and comment from @cijothomas #1946 (comment). If this is our stance then this would alleviate the concern of risky calls to |
This needs some more clarification though. E.g. if you interpreted the OTel spec very strictly, then int values (32 bit in .NET) are not valid, only long. And what about unsigned? |
I've certainly been bitten by conversion issues in this area (originally with the new relic exporter) so ended up with a custom processor that in the OnEnd updates the tags to be something that it handled, but I still use with the OpenTelemetry Exporter. If it's a string it's left as a string
(I now look at it, and realize that Object is never primitive, so should just be IsPrimative and not Char) If they don't meet the above test, then they get converted to strings, but with certain standardization: Everything else is put through: I've no doubt that arrays won't be correct (however, we've not used arrays for tags yet) So it would be useful to know what OTel will do with the above types, and if I need to maintain the conversions. Perhaps it'd be useful if there was something I could call to check if OTel can handle the Type, so I can munge anything OTel can't. |
Also how far do you go, eg should anything that's |
Given that the .NET API is not strict (allows |
I'm leaning toward not handling enums, DateTime, TimeSpan, and "everything else". Different users may want these things formatted differently, so rather than the SDK imposing an opinion, I'd prefer users handle |
That's fine, as everyone will have different needs (some will want datetime as unix epoch etc), for me it'd be nice to know if something is already handled before attempting to handle it (rather than having a hard coded list, although I suspect it won't change much) I don't know if that's a hook needed or similar that can add more conversions, or if processor is enough. |
I think handling just array keeps things simple. Handling |
+1 to this |
This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this issue is still a concern. |
There has been some recent discussion about how to handle the differences in
what the .NET APIs allows as attribute values and what is declared in the OpenTelemetry specification.
Opening this issue to continue the discussion. (#1966, #1973)
The specification states that an attribute values is either:
The API for setting a tag on a .NET Activity is broader in scope than what the OpenTelemetry specification requires.
A tag's value can be any type.
Currently, the exporters in this project convert tag values to a string, boolean, double, or int64 - or an array of these - as appropriate.
I propose we continue to embrace the flexibility of the .NET Activity API and ensure that we are consistently converting all C# built-in types to the most appropriate type declared in the OpenTelemetry specification as follows:
For the most part, I think this is pretty close to what the exporters already do, but there are a few open questions:
byte[]
,char[]
, ordecimal[]
, for example, are converted to the stringSystem.Byte[]
andSystem.Char[]
, andSystem.Decimal[]
.The text was updated successfully, but these errors were encountered: