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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass MDC tags as Sentry tags #1954
Changes from 6 commits
042dcef
c835076
f55be8b
3cffcfb
225c88b
970e591
de4067d
747afcf
01bac90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
dsn="https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563" | ||
minimumBreadcrumbLevel="DEBUG" | ||
minimumEventLevel="WARN" | ||
debug="true" | ||
mdcTags="userId" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Sample updated. |
||
/> | ||
</Appenders> | ||
<Loggers> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563</dsn> | ||
<mdcTag>userId</mdcTag> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is correct. under the hood it calls There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sample updated. |
||
</options> | ||
<!-- Demonstrates how to modify the minimum values --> | ||
<!-- Default for Events is ERROR --> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ public final class ExternalOptions { | |
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 commentThe 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? 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 commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
private @Nullable String proguardUuid; | ||
private final @NotNull Set<Class<? extends Throwable>> ignoredExceptionsForType = | ||
new CopyOnWriteArraySet<>(); | ||
|
@@ -81,6 +82,9 @@ public final class ExternalOptions { | |
for (final String tracingOrigin : propertiesProvider.getList("tracing-origins")) { | ||
options.addTracingOrigin(tracingOrigin); | ||
} | ||
for (final String mdcTag : propertiesProvider.getList("mdc-tags")) { | ||
options.addMdcTag(mdcTag); | ||
} | ||
options.setProguardUuid(propertiesProvider.getProperty("proguard-uuid")); | ||
|
||
for (final String ignoredExceptionType : | ||
|
@@ -212,6 +216,10 @@ public void setProxy(final @Nullable SentryOptions.Proxy proxy) { | |
return inAppIncludes; | ||
} | ||
|
||
public @NotNull List<String> getMdcTags() { | ||
return mdcTags; | ||
} | ||
|
||
public @Nullable String getProguardUuid() { | ||
return proguardUuid; | ||
} | ||
|
@@ -236,6 +244,10 @@ public void addTracingOrigin(final @NotNull String tracingOrigin) { | |
this.tracingOrigins.add(tracingOrigin); | ||
} | ||
|
||
public void addMdcTag(final @NotNull String mdcTag) { | ||
this.mdcTags.add(mdcTag); | ||
} | ||
|
||
public void addIgnoredExceptionForType(final @NotNull Class<? extends Throwable> exceptionType) { | ||
this.ignoredExceptionsForType.add(exceptionType); | ||
} | ||
|
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 馃憤