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
Flatten Metrics Tags for Objects #3789
Comments
Hi, The following snippet add tags from an object. const moreTags = { appName: "Test" };
const myTags = { browser: "Firefox", app_version: "1.0.0" };
Sentry.metrics.increment("button_click", 1, {
tags: {
...moreTags,
...myTags,
},
}); This won't work (result will be const myTags = { browser: "Firefox", app_version: "1.0.0" };
Sentry.metrics.increment("button_click", 1, {
tags: {
myTags,
},
}); |
In case the previous responses have not solved the issue, please feel free to comment here or open a new issue. |
Hi @krystofwoldrich, You are correct
Does not work and it would be nice to work so this is a feature request to flatten a JSON object. I mentioned this works on Python: https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/metrics.py#L692 The SDK develop page mentions that if the SDK has a way to support sending non-string values it can be sent https://develop.sentry.dev/sdk/metrics/#aggregator-behavior and being able to flatten a JSON object to key value should be achievable. |
@krystofwoldrich Could we reopen? Its not solved yet. |
Currently if you send a JSON object as a tag to Sentry Metrics, it appears on sentry as [Object object].
It would be nice to flatten the tag so that all values of the object are sent as individual tags.
The Python SDK does this already
https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/metrics.py#L692
The text was updated successfully, but these errors were encountered: