-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
Pass MDC tags as Sentry tags #1954
Conversation
Codecov Report
@@ Coverage Diff @@
## 6.x.x #1954 +/- ##
========================================
Coverage ? 80.61%
Complexity ? 2946
========================================
Files ? 214
Lines ? 10928
Branches ? 1451
========================================
Hits ? 8810
Misses ? 1592
Partials ? 526 Continue to review full report at Codecov.
|
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.
Lgtm. @adinauer ?
if (mdcProperties.containsKey(mdcTag)) { | ||
event.setTag(mdcTag, mdcProperties.get(mdcTag)); | ||
// remove from all tags applied to logging event | ||
mdcProperties.remove(mdcTag); |
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.
@bruno-garcia do we want to add entries only to either tags or context not both?
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 in tags is fine, no need to dupe 👍
@@ -11,6 +11,8 @@ | |||
dsn="https://[email protected]/5428563" | |||
minimumBreadcrumbLevel="DEBUG" | |||
minimumEventLevel="WARN" | |||
debug="true" | |||
mdcTags="userId" |
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 this sample also show how to set multiple?
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.
Sample updated.
@@ -11,6 +11,7 @@ | |||
<debug>true</debug> | |||
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard --> | |||
<dsn>https://[email protected]/5428563</dsn> | |||
<mdcTag>userId</mdcTag> |
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 this sample also show how to set multiple?
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.
is <mdcTag>
correct here? or should it be <mdcTags>
?
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.
It is correct. under the hood it calls addMdcTag
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.
Sample updated.
@@ -32,6 +32,7 @@ | |||
private final @NotNull List<String> inAppExcludes = new CopyOnWriteArrayList<>(); | |||
private final @NotNull List<String> inAppIncludes = new CopyOnWriteArrayList<>(); | |||
private final @NotNull List<String> tracingOrigins = new CopyOnWriteArrayList<>(); | |||
private final @NotNull List<String> mdcTags = new CopyOnWriteArrayList<>(); |
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.
Can anyone think of a name that's a bit more generic than MDC Tags?
In case any other SDK wants to add support for a similar feature it might be nice if they can use the same name.
Something like logContextTags
or promoteLogContextEntriesToTags
?
We should then probably mention somewhere that this takes MDC entries and puts them into sentry tags so people can actually find this feature when searching for MDC.
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.
Perhaps contextTags
? I am open to change it to anything more suitable.
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.
contextTags
sounds good to me. Can you please rename it? Sorry for the inconvenience but I'd rather change it now than deprecate and rename later as we've already been asked to pick a name that can be used for more than just the Java SDK.
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.
Done.
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.
lgtm
Hi @adinauer, has this PR been actually released ? It's missing in CHANGELOG.md and documentation. |
Hello @verglor, yes it has been released with version |
📜 Description
Add option to specify MDC tag names that are mean to be applied as Sentry tags to Sentry events instead of putting into event contexts as we used to do.
💡 Motivation and Context
Fixes #1148
💚 How did you test it?
Unit & Integration tests.
📝 Checklist