Skip to content

Conversation

@buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Nov 18, 2025

📜 Description

Implemented according to spec.

  • Set on the global scope will apply to logs (and metrics and spans in the future)
  • Same key on log and scope -> log attribute takes precedence
  • Added optional unit

Important behaviours:

  • Scope can clone attributes
  • attributes set in withScope takes precedence over global scope
  • log attributes take precedence over any scope

Note: we'll have to wait till the array types are supported by relay

💡 Motivation and Context

Closes #3345

💚 How did you test it?

Unit test, manual test

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against ceddd30

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1269.35 ms 1262.88 ms -6.47 ms
Size 5.53 MiB 6.02 MiB 501.34 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
cdf371b 1246.24 ms 1251.10 ms 4.86 ms
6f47800 1247.52 ms 1259.37 ms 11.85 ms
0fb45d0 1273.24 ms 1286.44 ms 13.19 ms
5a95d04 1263.17 ms 1265.37 ms 2.20 ms
0fb3800 1256.60 ms 1266.28 ms 9.68 ms
3615e19 1225.02 ms 1234.57 ms 9.55 ms
0929dbf 1275.89 ms 1282.22 ms 6.33 ms
1f639ee 1252.43 ms 1257.82 ms 5.38 ms
73a3c38 1263.37 ms 1277.90 ms 14.53 ms
7b21e8b 1256.79 ms 1267.12 ms 10.33 ms

App size

Revision Plain With Sentry Diff
cdf371b 5.53 MiB 6.02 MiB 501.23 KiB
6f47800 7.86 MiB 9.44 MiB 1.58 MiB
0fb45d0 7.86 MiB 9.44 MiB 1.58 MiB
5a95d04 5.53 MiB 6.01 MiB 487.81 KiB
0fb3800 7.86 MiB 9.44 MiB 1.58 MiB
3615e19 7.86 MiB 9.44 MiB 1.58 MiB
0929dbf 7.86 MiB 9.54 MiB 1.69 MiB
1f639ee 5.53 MiB 6.00 MiB 479.95 KiB
73a3c38 7.86 MiB 9.44 MiB 1.58 MiB
7b21e8b 5.53 MiB 6.00 MiB 479.96 KiB

Previous results on branch: feat/set-attributes

Startup times

Revision Plain With Sentry Diff
9a99d54 1273.40 ms 1279.94 ms 6.54 ms
03bbc0e 1239.96 ms 1245.02 ms 5.06 ms
224eab1 1256.65 ms 1259.18 ms 2.54 ms
796bba9 1230.78 ms 1236.04 ms 5.27 ms
f33d4f9 1246.96 ms 1253.51 ms 6.55 ms
ad95fde 1242.50 ms 1249.41 ms 6.91 ms
2e39532 1240.10 ms 1242.37 ms 2.27 ms
58126a6 1269.71 ms 1269.73 ms 0.01 ms

App size

Revision Plain With Sentry Diff
9a99d54 5.53 MiB 6.02 MiB 503.76 KiB
03bbc0e 5.53 MiB 6.02 MiB 501.34 KiB
224eab1 5.53 MiB 6.02 MiB 503.77 KiB
796bba9 5.53 MiB 6.02 MiB 501.79 KiB
f33d4f9 5.53 MiB 6.02 MiB 503.77 KiB
ad95fde 5.53 MiB 6.02 MiB 503.77 KiB
2e39532 5.53 MiB 6.02 MiB 503.77 KiB
58126a6 5.53 MiB 6.02 MiB 503.49 KiB

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 72.09302% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.31%. Comparing base (3ddf010) to head (ceddd30).

Files with missing lines Patch % Lines
...ckages/dart/lib/src/protocol/sentry_attribute.dart 59.09% 9 Missing ⚠️
packages/dart/lib/src/hub_adapter.dart 0.00% 4 Missing ⚠️
packages/dart/lib/src/sentry.dart 0.00% 4 Missing ⚠️
packages/dart/lib/src/hub.dart 80.00% 2 Missing ⚠️
packages/dart/lib/src/noop_hub.dart 0.00% 2 Missing ⚠️
packages/dart/lib/src/sentry_logger_formatter.dart 77.77% 2 Missing ⚠️
...ckages/dart/lib/src/logs_enricher_integration.dart 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3352      +/-   ##
==========================================
- Coverage   88.35%   88.31%   -0.04%     
==========================================
  Files         291      291              
  Lines        9917     9957      +40     
==========================================
+ Hits         8762     8794      +32     
- Misses       1155     1163       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 365.28 ms 358.15 ms -7.13 ms
Size 13.93 MiB 15.18 MiB 1.25 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a69a51f 437.18 ms 450.60 ms 13.42 ms
2d34233 470.54 ms 558.90 ms 88.36 ms
ec78888 457.94 ms 519.96 ms 62.02 ms
e45c0e1 447.29 ms 558.33 ms 111.04 ms
8825ed8 447.65 ms 456.90 ms 9.25 ms
cf443d2 464.64 ms 479.04 ms 14.40 ms
8541716 437.14 ms 443.65 ms 6.51 ms
81f83eb 471.40 ms 522.14 ms 50.74 ms
e1ab497 429.30 ms 439.00 ms 9.70 ms
c26ed0a 465.52 ms 476.38 ms 10.86 ms

App size

Revision Plain With Sentry Diff
a69a51f 13.93 MiB 15.06 MiB 1.13 MiB
2d34233 6.54 MiB 7.55 MiB 1.01 MiB
ec78888 6.54 MiB 7.69 MiB 1.15 MiB
e45c0e1 6.54 MiB 7.70 MiB 1.16 MiB
8825ed8 13.93 MiB 14.93 MiB 1.00 MiB
cf443d2 13.93 MiB 15.00 MiB 1.06 MiB
8541716 13.93 MiB 15.00 MiB 1.06 MiB
81f83eb 6.54 MiB 7.69 MiB 1.15 MiB
e1ab497 13.93 MiB 15.06 MiB 1.13 MiB
c26ed0a 13.93 MiB 14.93 MiB 1.00 MiB

Previous results on branch: feat/set-attributes

Startup times

Revision Plain With Sentry Diff
f33d4f9 416.44 ms 427.43 ms 10.99 ms
ad95fde 474.23 ms 475.93 ms 1.70 ms
2e39532 399.96 ms 398.65 ms -1.31 ms
58126a6 468.30 ms 472.46 ms 4.16 ms
9a99d54 395.15 ms 387.08 ms -8.06 ms
03bbc0e 412.87 ms 428.78 ms 15.91 ms
796bba9 402.40 ms 433.27 ms 30.87 ms
224eab1 364.32 ms 377.29 ms 12.97 ms

App size

Revision Plain With Sentry Diff
f33d4f9 13.93 MiB 15.18 MiB 1.25 MiB
ad95fde 13.93 MiB 15.18 MiB 1.25 MiB
2e39532 13.93 MiB 15.18 MiB 1.25 MiB
58126a6 13.93 MiB 15.18 MiB 1.25 MiB
9a99d54 13.93 MiB 15.18 MiB 1.25 MiB
03bbc0e 13.93 MiB 15.18 MiB 1.25 MiB
796bba9 13.93 MiB 15.18 MiB 1.25 MiB
224eab1 13.93 MiB 15.18 MiB 1.25 MiB

@buenaflor buenaflor marked this pull request as ready for review November 19, 2025 13:41
Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a test missing or just the comment? We should also look into the Cursor comment, where we don't apply scope attributes in the client to the log.

// scope attribute
expect(attrs['scopeOnly'], scopeAttributes['scopeOnly']);

// TODO logger.fmt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing or just the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you commented an outdated diff, this comment is already gone

@buenaflor
Copy link
Contributor Author

buenaflor commented Nov 20, 2025

@denrase updated the impl to apply the merging of the attributes of the scope only in client.captureLog, which should be the central place to do this

Also the package analysis are meant to fail because we changed api in the main Dart package. we really need to check out if there are better package analysis workflows out there..

@buenaflor buenaflor requested a review from denrase November 20, 2025 13:12
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.

Implement Global Attributes API

3 participants