Closed siavash-mohseni closed 2 years ago
Hey @siavash-mohseni thanks for using this package.
That's an interesting bug. So, ideally, nested dictionaries are handled with this recursive function. Are you passing in null values by any chance? Can you provide an example of an attribute payload that fails?
And I'd love the help if you wanted to work around that statement. My other thought is that your nested attributes don't have String
keys and thus there is no recursion.
Hi @tshedor, Thanks for your answer.
I think my attributes are fairly simple. Something like this:
{ "exception": "exception message", "stackTrace": "stack trace string", "context": { "key1": "value1", "key2": "value2" } }
None of the values are null and all the keys are Strings.
I debugged the code and first time in recursive function it is coverting the context
successfully to [AttributeKey : AttributeValue]
but when it tries to convert the whole attributes and exit the function it return null.
It seems that the conversion is not successful when you have a nested dictionary in attributes here:
return unencodedAttributes as? [AttributeKey : AttributeValue]
](https://github.com/GetDutchie/datadog_flutter/blob/787890c3d43961a4b07b0102fb7fbd8f64a6c915/ios/Classes/SwiftDatadogFlutterPlugin.swift#L347)
If I remove the context node, or replace its value with a String it will work successfully.
I'm not a Swift expert, but it seems to me that the nested dictionary is not being considered a Codable type and Swift is not able to convert it accordingly.
Thanks a lot 👍
I am having a similar issue with List<String>
custom attributes not propagating to datadog for iOS devices when added to the user with the extraInfo
parameter.
When I add attributes to the user like:
await DatadogFlutter.setUserInfo(id: user.id, extraInfo: {
'organizations': ['demo', 'demo_probation'],
});
the attributes show up as Custom Attributes for Android devices but not for iOS.
Hi @tshedor, we are eagerly watching this issue. I checked with the engineers on my team to see if we could submit a fix for this but unfortunately we won't be able 😞 I wanted to ask here if you plan to fix this and if so, do you know when? Thank you! 🙏🏼
@siavash-mohseni @xacaciax Please update to 1.5.2
Hi @tshedor ,
Even with the latest update that has a commit regarding fixing the attributes in iOS, attributes are not still passed.
I have a sample attribute with a value like this:
{ "key1":"value1", "key2":"value2" }
it works fine if the attributes are only simple values, but passing a dictionary will break the following cast in iOS code:
return unencodedAttributes as? [AttributeKey : AttributeValue]
](https://github.com/GetDutchie/datadog_flutter/blob/787890c3d43961a4b07b0102fb7fbd8f64a6c915/ios/Classes/SwiftDatadogFlutterPlugin.swift#L347)I understand that you mentioned in the comments that dictionary attributes support are limited. Still, since Datadog supports up to 10 level inner attributes, I think it is worth adding.
Would you please let me know if I could be any of help adding this?
Thanks :)