Skip to content

Add os and device attributes to Flutter logs #2978

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented Jun 4, 2025

📜 Description

Add os and device attributes to Flutter logs

💡 Motivation and Context

Closes #2966

💚 How did you test it?

Unit tests

📝 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

Copy link
Contributor

github-actions bot commented Jun 4, 2025

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

Generated by 🚫 dangerJS against 9547395

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 92.55319% with 7 lines in your changes missing coverage. Please review.

Project coverage is 87.58%. Comparing base (95280e5) to head (9547395).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ib/src/contexts_enricher/os_contexts_enricher.dart 0.00% 5 Missing ⚠️
...ib/src/integrations/load_contexts_integration.dart 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2978      +/-   ##
==========================================
- Coverage   87.63%   87.58%   -0.05%     
==========================================
  Files         278      282       +4     
  Lines        9176     9213      +37     
==========================================
+ Hits         8041     8069      +28     
- Misses       1135     1144       +9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@denrase denrase marked this pull request as ready for review June 4, 2025 15:08
Copy link
Contributor

github-actions bot commented Jun 4, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1250.19 ms 1251.61 ms 1.42 ms
Size 7.85 MiB 9.42 MiB 1.57 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9da696d 1253.91 ms 1267.68 ms 13.77 ms
3f8357e 1266.21 ms 1274.29 ms 8.08 ms
c70e01a 1273.00 ms 1299.12 ms 26.12 ms
322aa66 1251.68 ms 1275.52 ms 23.84 ms
ef31c7f 1272.43 ms 1295.71 ms 23.29 ms
ca9f398 1227.29 ms 1236.20 ms 8.92 ms
178baee 1230.61 ms 1249.94 ms 19.33 ms
6e9c5a2 1245.59 ms 1260.24 ms 14.65 ms
e82709a 1249.22 ms 1271.35 ms 22.12 ms
3e5078c 1239.73 ms 1248.69 ms 8.96 ms

App size

Revision Plain With Sentry Diff
9da696d 8.42 MiB 9.91 MiB 1.49 MiB
3f8357e 8.43 MiB 9.99 MiB 1.56 MiB
c70e01a 8.16 MiB 9.17 MiB 1.01 MiB
322aa66 8.15 MiB 9.12 MiB 992.53 KiB
ef31c7f 8.09 MiB 9.07 MiB 1000.79 KiB
ca9f398 8.38 MiB 9.74 MiB 1.36 MiB
178baee 8.34 MiB 9.67 MiB 1.33 MiB
6e9c5a2 8.34 MiB 9.66 MiB 1.31 MiB
e82709a 8.33 MiB 9.40 MiB 1.07 MiB
3e5078c 8.28 MiB 9.34 MiB 1.06 MiB

Previous results on branch: feat/add-os-and-device-attributes-to-logs

Startup times

Revision Plain With Sentry Diff
5028a17 1264.92 ms 1275.04 ms 10.13 ms
5c21eb1 1262.75 ms 1277.82 ms 15.07 ms
4040b91 1249.67 ms 1265.33 ms 15.66 ms

App size

Revision Plain With Sentry Diff
5028a17 7.85 MiB 9.42 MiB 1.57 MiB
5c21eb1 7.85 MiB 9.42 MiB 1.57 MiB
4040b91 7.85 MiB 9.42 MiB 1.57 MiB

Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

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

looks good but got a question

Copy link
Contributor

github-actions bot commented Jun 16, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 488.69 ms 534.59 ms 45.89 ms
Size 6.54 MiB 7.53 MiB 1017.43 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
4fecc12 482.25 ms 521.82 ms 39.57 ms
453e1bc 320.41 ms 372.73 ms 52.32 ms
9c5aec6 287.33 ms 320.94 ms 33.61 ms
9f9f94f 331.04 ms 368.92 ms 37.88 ms
547db82 453.40 ms 482.88 ms 29.48 ms
9f05645 349.43 ms 437.24 ms 87.81 ms
ed2ae08 360.06 ms 440.92 ms 80.86 ms
bdd1a23 316.21 ms 364.80 ms 48.59 ms
d4d0807 408.80 ms 437.18 ms 28.38 ms
e8603bb 377.51 ms 444.77 ms 67.26 ms

App size

Revision Plain With Sentry Diff
4fecc12 6.44 MiB 7.50 MiB 1.06 MiB
453e1bc 5.94 MiB 6.95 MiB 1.01 MiB
9c5aec6 5.94 MiB 6.92 MiB 1001.61 KiB
9f9f94f 5.94 MiB 6.95 MiB 1.01 MiB
547db82 6.49 MiB 7.56 MiB 1.07 MiB
9f05645 6.27 MiB 7.20 MiB 958.60 KiB
ed2ae08 6.27 MiB 7.20 MiB 958.73 KiB
bdd1a23 6.16 MiB 7.14 MiB 1011.19 KiB
d4d0807 6.35 MiB 7.35 MiB 1021.70 KiB
e8603bb 6.34 MiB 7.28 MiB 967.80 KiB

Previous results on branch: feat/add-os-and-device-attributes-to-logs

Startup times

Revision Plain With Sentry Diff
5c21eb1 674.37 ms 739.29 ms 64.92 ms
5028a17 487.22 ms 568.45 ms 81.23 ms
4040b91 452.50 ms 525.48 ms 72.98 ms

App size

Revision Plain With Sentry Diff
5c21eb1 6.54 MiB 7.53 MiB 1017.10 KiB
5028a17 6.54 MiB 7.53 MiB 1017.61 KiB
4040b91 6.54 MiB 7.53 MiB 1017.43 KiB

@denrase denrase requested a review from buenaflor June 17, 2025 11:58
Comment on lines +560 to +563
final contexts = Contexts();
for (final enricher in _options.contextsEnrichers) {
await enricher.enrich(contexts);
}
Copy link
Contributor

@buenaflor buenaflor Jun 17, 2025

Choose a reason for hiding this comment

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

I'm still thinking about the on/emit method.

Can't we register a hook in Flutter init where within we enrich the log? that way we don't need to pass contexts enricher between dart and flutter

e.g

// in flutter package
_hub.on('beforeCaptureLog', (log) {
  // get os and device info and add them to the log attributes
});

// or
_hub.addObserver('beforeCaptureLog', (log) {
  // get os and device info and add them to the log attributes
});

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.

Add os and device attributes to Flutter logs
2 participants