sentry-docs icon indicating copy to clipboard operation
sentry-docs copied to clipboard

Java Contexts example should use complex object

Open bruno-garcia opened this issue 4 years ago • 4 comments
trafficstars

Contexts expects an object to be serialized. A String will not be accepted.

https://docs.sentry.io/platforms/java/enriching-events/context/

One alternative is to declare type above and pass an instance, as done in other platforms such as Flutter:

https://docs.sentry.io/platforms/flutter/enriching-events/context/

bruno-garcia avatar Feb 21 '21 00:02 bruno-garcia

@bruno-garcia the Java code will wrap the primitive types or String within an Object with a value field:

it'd become:

"key": {
  "value": your primitive value or String
}

so it's not broken, but it'd be better to align the examples using an object instead, true.

marandaneto avatar Feb 21 '21 10:02 marandaneto

I forgot the work around, I think we should do this everywhere we take Object such as .NET.

Do we create a new key if that already exists? Or will we just override the same key and only the last value set will take effect?

bruno-garcia avatar Feb 21 '21 15:02 bruno-garcia

afaik, it always overwrites it

marandaneto avatar Feb 21 '21 20:02 marandaneto

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Mar 15 '21 00:03 github-actions[bot]