setTag recording inconsistent values despite setting the same value in code
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Using the React Native SDK to Sentry.setTag("XXX", true) is producing true and True values in the Sentry UI. While we have been able to work around this, it's concerning the data is not accurate in Sentry.
Only seen it happen for "boolean" values.
Expected Result
Value is always true.
Actual Result
It seems to happen sporadically and just in the Errors dataset AFAIK.
Customer Specific Details in Case: https://www.notion.so/sentry/1c78b10e4b5d80f89aa9c802f6ad74fc
Product Area
Processing
Link
No response
DSN
No response
Version
No response
Assigning to @getsentry/support for routing ⏲️
Routing to @getsentry/product-owners-processing for triage ⏲️
@krystofwoldrich Is there a chance this is due to the SDK in any way? Or are we fairly certain this stems from the ingestion?
Thank you for the message and the ping @tobias-wilfert.
It might be a difference between JS procession of the event in the SDK when using Expo Go/Expo Dev Client and when using Release Build.
The example on the linked notion page shows an issue with a tag equal True 99% and true 1%, which supports the dev vs release suspicion.
I'm looking into it at the moment.
I've tried to reproduce the issue, and both in dev and release, the sdk is sending json with {"test-true": true}, but I see True in the Sentry UI.
@tobias-wilfert Could there be some nondeterministic behavior during processing?
Asked the team and it converting true -> "True" is the intended behaviour here. Would be cool if we could somehow managed to reproduce the true -> "true".
Although I am thinking now that this might probably be a issue in Relay since we have 2 different ways to convert which are used in different contexts: https://github.com/getsentry/relay/blob/4e752d81df91a13b0f944d4859da4099de6d936d/relay-event-schema/src/protocol/types.rs#L680-L682 (True) https://github.com/getsentry/relay/blob/4e752d81df91a13b0f944d4859da4099de6d936d/relay-event-schema/src/protocol/types.rs#L751-L753 (true)
So not sure why we hit the one or the other for the same tag but maybe it has something to do with that 🤔 but if the SDK always sends a boolean than I think it is safe to assume that it is not the culprit.
I've found the culprit, it's related to how we synchronize tags between native and JS.
See the nativeTags vs event.tags.
I'll move this issue to the RN SDK repository.
@krystofwoldrich Thanks so much great investigation work 🙏🏻
The native SDKs, sentry-cocoa and sentry-android, only accept string as a tag type, the RN SDK converts the tags to a string when passing them to the native SDKs.
We will fix this in the RN SDK by stringifying all tags to align with the native SDK.
So the RN SDK will convert true -> 'True' and the same for the other primitives supported by the JS interface.
This has a side effect for native events, which now send true -> 'true', but after the change, they will send true -> 'True', which aligns with the RN/JS layer but could break users queries in Sentry.
This issue will be fixed on the next version of Sentry React Native V7