-
-
Notifications
You must be signed in to change notification settings - Fork 451
Extend Logs API to allow passing in attributes
#4402
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: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Extend Logs API to allow passing in `attributes` ([#4402](https://github.com/getsentry/sentry-java/pull/4402)) If none of the above apply, you can opt out of this check by adding |
Performance metrics 🚀
|
} | ||
|
||
@SuppressWarnings("AnnotateFormatMethod") | ||
private void captureLog( | ||
final @Nullable Map<String, Object> attributes, |
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.
I don't like it too much that it's the first param but I guess it must be like this because of the varargs right?
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.
I would like it more for this to be the last param but I don't think that's possible. Either way it's fine, I would expect most users to not go through this API
3a26d0a
to
5ca032d
Compare
Sorry pushed on this branch by mistake, should be restored, please double check |
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.
Did some manual tests and everything works as intended except for serialization of arbitrary objects as attributes, opened a PR on top of this to fix that #4409
final @NotNull HashMap<String, SentryLogEventAttributeValue> attributes = new HashMap<>(); | ||
|
||
if (incomingAttributes != null) { |
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.
Should we create a copy of the attributes (here or in the capture method) to avoid having a map that could be changed while we iterate on it?
📜 Description
Extend Logs API to allow passing in
attributes
💡 Motivation and Context
Filtering Logs in Sentry via custom attributes.
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps