Skip to content

Add SentryAttribute.flattened #4417

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

adinauer
Copy link
Member

📜 Description

Add SentryAttribute.flattened to allow flattening objects into separate key/value pairs of simple types. e.g.:

SentryAttribute.flattened("p", new Point(10, 20)) will add multiple attributes under the hood: p.x=10 and p.y=20.

This is currently done only for a single level, however we can expand it to more depth if needed.

💡 Motivation and Context

Provide API that takes care of flattening without having to manually set each attribute.

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented May 19, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add `SentryAttribute.flattened` ([#4417](https://github.com/getsentry/sentry-java/pull/4417))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 628254d

@adinauer adinauer marked this pull request as draft May 19, 2025 10:36
Copy link
Contributor

github-actions bot commented May 22, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 438.08 ms 479.96 ms 41.88 ms
Size 1.58 MiB 2.08 MiB 510.55 KiB

Baseline results on branch: feat/better-attributes-api

Startup times

Revision Plain With Sentry Diff
fe70d60 401.20 ms 545.47 ms 144.27 ms

App size

Revision Plain With Sentry Diff
fe70d60 1.58 MiB 2.08 MiB 510.53 KiB

Base automatically changed from feat/better-attributes-api to feat/logs-attributes-in-api May 22, 2025 10:08
Base automatically changed from feat/logs-attributes-in-api to main May 22, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants