-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
base: feat/logs
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/logs #2920 +/- ##
=============================================
+ Coverage 87.68% 87.73% +0.04%
=============================================
Files 275 275
Lines 9089 9114 +25
=============================================
+ Hits 7970 7996 +26
+ Misses 1119 1118 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -8,19 +8,19 @@ class SentryLogAttribute { | |||
return SentryLogAttribute._(value, 'string'); | |||
} | |||
|
|||
factory SentryLogAttribute.boolean(bool value) { | |||
factory SentryLogAttribute.bool(bool value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this so the name is in line with the dart type.
return SentryLogAttribute._(value, 'boolean'); | ||
} | ||
|
||
factory SentryLogAttribute.integer(int value) { | ||
factory SentryLogAttribute.int(int value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this so the name is in line with the dart type.
return SentryLogAttribute._(value, 'integer'); | ||
} | ||
|
||
factory SentryLogAttribute.double(double value) { | ||
return SentryLogAttribute._(value, 'double'); | ||
} | ||
|
||
// In the future the SDK will also support string[], boolean[], integer[], double[] values. | ||
// In the future the SDK will also support string[], bool[], int[], double[] values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this so the name is in line with the dart type.
required this.level, | ||
required this.body, | ||
required this.attributes, | ||
this.severityNumber, | ||
}); | ||
}) : traceId = traceId ?? SentryId.empty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The traceId
is always set in the client, no point in having it be required in the constr.
@@ -485,6 +485,75 @@ class SentryClient { | |||
); | |||
} | |||
|
|||
@internal | |||
Future<void> captureLog( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matched attributes and traceId application as close as i could to the Python implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also leave parameterize strings out for now
_options.sdk, | ||
); | ||
|
||
// TODO: Make sure the Android SDK understands the log envelope type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reminder, this was an issue when we introduced feedback. The Native Android SDK would just ignore the envelope because it did not know about the type.
log.attributes['sentry.sdk.name'] = SentryLogAttribute.string( | ||
_options.sdk.name, | ||
); | ||
log.attributes['sentry.sdk.version'] = SentryLogAttribute.string( | ||
_options.sdk.version, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if these keys will be used multiple times? if yes we can consider putting them in a constants files or something.
we have a constants.dart
in the dart package
📜 Description
captureLog
toSentryClient
enableLogs
toSentryOptions
BeforeSendLogCallback
toSentryOptions
💡 Motivation and Context
Relates to #2915
Relates to #2919
Closes #2922
💚 How did you test it?
Unit tests
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps
Hub & New Loggers