Skip to content

(feat-V7) Log Tracing #4827

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

Merged
merged 31 commits into from
Jun 11, 2025
Merged

(feat-V7) Log Tracing #4827

merged 31 commits into from
Jun 11, 2025

Conversation

lucas-zimerman
Copy link
Collaborator

@lucas-zimerman lucas-zimerman commented May 13, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

Blocked by:

📜 Description

Add the required changes on the Client in order to capture logs. All platforms will be supported with the initial PR (web, iOS and Android)

💡 Motivation and Context

Fixes #4856

💚 How did you test it?

Locally, with native SDKs disabled for testing the JavaScript integration, and with native SDKs enabled to test the Native integration

Pii

Pii seems to be filtered serverside so we don't need to do anything on the SDK.
image

📝 Checklist

  • 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.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

  • Implement tests
  • Decide what todo with internal logs sent to logger. (Doesn't seems to be sent)
  • Redirect BeforeLog from native to JS Layer
  • Add documentation.

@lucas-zimerman lucas-zimerman changed the base branch from main to v7 May 13, 2025 14:22
Copy link
Contributor

github-actions bot commented May 13, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 418.04 ms 405.11 ms -12.93 ms
Size 17.75 MiB 19.58 MiB 1.83 MiB

Baseline results on branch: v7

Startup times

Revision Plain With Sentry Diff
3c99746 399.51 ms 429.09 ms 29.58 ms
472960b 418.84 ms 405.38 ms -13.46 ms
f870f2d 444.67 ms 449.62 ms 4.95 ms

App size

Revision Plain With Sentry Diff
3c99746 17.75 MiB 19.58 MiB 1.83 MiB
472960b 17.75 MiB 19.58 MiB 1.83 MiB
f870f2d 17.75 MiB 19.58 MiB 1.83 MiB

Previous results on branch: lz/v7-test-logs

Startup times

Revision Plain With Sentry Diff
959bf26 456.37 ms 449.80 ms -6.57 ms

App size

Revision Plain With Sentry Diff
959bf26 17.75 MiB 19.58 MiB 1.83 MiB

Copy link
Contributor

github-actions bot commented May 13, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1215.81 ms 1217.98 ms 2.17 ms
Size 2.63 MiB 3.79 MiB 1.16 MiB

Baseline results on branch: v7

Startup times

Revision Plain With Sentry Diff
3c99746+dirty 1215.12 ms 1222.31 ms 7.18 ms
472960b+dirty 1213.96 ms 1222.58 ms 8.62 ms
f870f2d+dirty 1227.18 ms 1232.30 ms 5.12 ms

App size

Revision Plain With Sentry Diff
3c99746+dirty 2.63 MiB 3.78 MiB 1.15 MiB
472960b+dirty 2.63 MiB 3.79 MiB 1.15 MiB
f870f2d+dirty 2.63 MiB 3.79 MiB 1.15 MiB

Previous results on branch: lz/v7-test-logs

Startup times

Revision Plain With Sentry Diff
959bf26+dirty 1218.46 ms 1237.24 ms 18.78 ms

App size

Revision Plain With Sentry Diff
959bf26+dirty 2.63 MiB 3.78 MiB 1.15 MiB

Copy link
Contributor

github-actions bot commented May 13, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1224.22 ms 1226.91 ms 2.69 ms
Size 3.19 MiB 4.36 MiB 1.17 MiB

Baseline results on branch: v7

Startup times

Revision Plain With Sentry Diff
3c99746+dirty 1227.65 ms 1228.81 ms 1.16 ms
472960b+dirty 1243.67 ms 1233.57 ms -10.11 ms
f870f2d+dirty 1230.08 ms 1238.88 ms 8.80 ms

App size

Revision Plain With Sentry Diff
3c99746+dirty 3.19 MiB 4.35 MiB 1.16 MiB
472960b+dirty 3.19 MiB 4.36 MiB 1.17 MiB
f870f2d+dirty 3.19 MiB 4.36 MiB 1.17 MiB

Previous results on branch: lz/v7-test-logs

Startup times

Revision Plain With Sentry Diff
959bf26+dirty 1224.94 ms 1235.58 ms 10.64 ms

App size

Revision Plain With Sentry Diff
959bf26+dirty 3.19 MiB 4.35 MiB 1.16 MiB

@lucas-zimerman
Copy link
Collaborator Author

image
logs are now correctly captured on Android,iOS and JS.

@lucas-zimerman
Copy link
Collaborator Author

build errors will be fixed on #4860

@@ -182,7 +182,7 @@ export const NATIVE: SentryNativeWrapper = {
typeof itemHeader.content_type === 'string' ? itemHeader.content_type : 'application/octet-stream';
bytesPayload = itemPayload;
} else {
bytesContentType = 'application/json';
bytesContentType = 'application/vnd.sentry.items.log+json';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we use the new content type for all requests or only the ones that contain logs? @krystofwoldrich @kahest
This can create a break changes on self -hosted, and I am not sure which version has support for logging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

on Sentry JavaScript for example, they use application/vnd.sentry.items.log+json by default on all requests

Copy link
Contributor

github-actions bot commented May 27, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 404.85 ms 417.24 ms 12.39 ms
Size 7.15 MiB 8.34 MiB 1.18 MiB

Baseline results on branch: v7

Startup times

Revision Plain With Sentry Diff
472960b+dirty 394.39 ms 376.18 ms -18.20 ms
3c99746+dirty 400.65 ms 399.59 ms -1.06 ms
f870f2d+dirty 398.49 ms 434.24 ms 35.75 ms

App size

Revision Plain With Sentry Diff
472960b+dirty 7.15 MiB 8.34 MiB 1.18 MiB
3c99746+dirty 7.15 MiB 8.34 MiB 1.18 MiB
f870f2d+dirty 7.15 MiB 8.34 MiB 1.18 MiB

Previous results on branch: lz/v7-test-logs

Startup times

Revision Plain With Sentry Diff
959bf26+dirty 380.57 ms 381.71 ms 1.14 ms

App size

Revision Plain With Sentry Diff
959bf26+dirty 7.15 MiB 8.34 MiB 1.18 MiB

CHANGELOG.md Outdated
@@ -61,6 +84,10 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
- `@sentry/utils` package, the exports were moved to `@sentry/core`
- Standalone `Client` interface & deprecate `BaseClient`

### Self Hosted

- It is recommended to use Sentry Self Hosted version `24.8.0` this and future versions.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I validated that capture of events/exceptions are working on 24.8.0, but we should at least recommend the first version suggested here getsentry/self-hosted#3560

CHANGELOG.md Outdated
@@ -61,6 +84,10 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
- `@sentry/utils` package, the exports were moved to `@sentry/core`
- Standalone `Client` interface & deprecate `BaseClient`

### Self Hosted

- It is recommended to use Sentry Self Hosted version `25.2.0` or new for React Native V7 or newer
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this change affects all events/transactions due to the content type of the request being changed.

25.2.0 is a safe value for it getsentry/self-hosted#3560, even if we don't officially support logs, it'll not drop other types of content

@lucas-zimerman lucas-zimerman changed the title (WIP) Log Tracing (feat-V7) Log Tracing May 27, 2025
@lucas-zimerman lucas-zimerman marked this pull request as ready for review May 28, 2025 10:28
@lucas-zimerman
Copy link
Collaborator Author

lucas-zimerman commented May 28, 2025

@krystofwoldrich @antonis it's ready for review :D

Copy link
Collaborator

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM and worked as expected in my tests 🎸

@lucas-zimerman
Copy link
Collaborator Author

As tested here #4911 the failed tests are unrelated to this PR

@lucas-zimerman lucas-zimerman merged commit 8af9fb7 into v7 Jun 11, 2025
80 of 84 checks passed
@lucas-zimerman lucas-zimerman deleted the lz/v7-test-logs branch June 11, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants