Skip to content
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

Using setContext on transaction fails ingestion for simple types #3350

Open
adinauer opened this issue Apr 12, 2024 · 3 comments
Open

Using setContext on transaction fails ingestion for simple types #3350

adinauer opened this issue Apr 12, 2024 · 3 comments

Comments

@adinauer
Copy link
Member

Integration

sentry

Java Version

any

Version

7.8.0

Steps to Reproduce

Use setContext on transaction and set any of String, Boolean or number as value.

Expected Result

Event is ingested

Actual Result

Ingestion doesn't work for these values.

@adinauer
Copy link
Member Author

adinauer commented Apr 12, 2024

In Scope.java we wrap simple values with a HashMap and key value. See

/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull Boolean value) {
final Map<String, Boolean> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}
/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull String value) {
final Map<String, String> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}
/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull Number value) {
final Map<String, Number> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}
/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull Collection<?> value) {
final Map<String, Collection<?>> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}
/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull Object[] value) {
final Map<String, Object[]> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}
/**
* Sets the Scope's contexts
*
* @param key the context key
* @param value the context value
*/
@Override
public void setContexts(final @NotNull String key, final @NotNull Character value) {
final Map<String, Character> map = new HashMap<>();
map.put("value", value);
setContexts(key, map);
}

@romtsn
Copy link
Member

romtsn commented Apr 17, 2024

@adinauer is the event just dropped, or just the values that are set incorrectly are not showing up?

@adinauer
Copy link
Member Author

The simple values in Contexts are dropped and the ingested JSON and UI have some info about it but the event shows up in Sentry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Discussion
Development

No branches or pull requests

2 participants