Skip to content

Logs: Integrate in Sentry Client #2920

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 32 commits into from
May 13, 2025
Merged

Logs: Integrate in Sentry Client #2920

merged 32 commits into from
May 13, 2025

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented May 7, 2025

📜 Description

  • Adds captureLog to SentryClient
  • Adds enableLogs to SentryOptions
  • Adds BeforeSendLogCallback to SentryOptions

💡 Motivation and Context

Relates to #2915
Relates to #2919
Closes #2922

💚 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

Hub & New Loggers

Copy link

codecov bot commented May 7, 2025

Codecov Report

Attention: Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.74%. Comparing base (09f8959) to head (b7f74b3).
Report is 1 commits behind head on feat/logs.

Files with missing lines Patch % Lines
dart/lib/src/noop_log_batcher.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           feat/logs    #2920      +/-   ##
=============================================
+ Coverage      87.68%   87.74%   +0.05%     
=============================================
  Files            275      277       +2     
  Lines           9089     9133      +44     
=============================================
+ Hits            7970     8014      +44     
  Misses          1119     1119              

☔ 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 changed the title Logs: Integrate in Sentry Client & Hub Logs: Integrate in Sentry Client May 8, 2025
@denrase denrase marked this pull request as ready for review May 8, 2025 08:37
@denrase denrase requested a review from buenaflor May 12, 2025 08:46
@denrase denrase requested a review from buenaflor May 12, 2025 09:51
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.

Got only one comment left but otherwise looks good

@buenaflor
Copy link
Contributor

cc @philipphofmann

@denrase denrase requested a review from buenaflor May 12, 2025 12:21
@denrase denrase requested a review from buenaflor May 13, 2025 09:02
@denrase denrase requested a review from buenaflor May 13, 2025 09:57
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, let's merge the batch PR and update this PR

@denrase denrase requested a review from buenaflor May 13, 2025 11:39
@denrase denrase merged commit 592c046 into feat/logs May 13, 2025
164 checks passed
@denrase denrase deleted the feat/logs-client branch May 13, 2025 13:10
}
if (processedLog != null) {
_options.logBatcher.addLog(processedLog);
}
Copy link
Member

Choose a reason for hiding this comment

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

should we report a dropped log if null after the beforeSendLog?

void addLog(SentryLog log) {
_logBuffer.add(log);

_flushTimer?.cancel();
Copy link
Member

Choose a reason for hiding this comment

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

canceling the timer here means that, in theory, if a log is added every 4 seconds, we will not flush them for several minutes
Is this the expectation?
Just fyi, Java sends every 5 seconds, regardless of how many logs are there

Copy link
Member

Choose a reason for hiding this comment

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

i guess it's fine as per docs, just ensuring it's wanted

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.

3 participants