-
-
Notifications
You must be signed in to change notification settings - Fork 466
Performance Feature #971
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
Performance Feature #971
Changes from 12 commits
e418a43
fb2dd7e
d90e6f5
a8f183c
f60144e
1da297b
725eca0
0ca29c1
2dacfb7
2fe4df3
41d493f
7260ae0
6f4855b
afd5c04
557ac3e
23cd265
e79a0b0
a9f2da5
d973b8e
0e18588
86eeb87
9e5180d
3cbb1da
d1c3d57
e2e6763
e978227
f6a6e16
bad07df
f50f042
e0a8f0a
8d62fb1
3e2c740
f14de05
048a980
e197af5
4f39a9a
87c070b
7dd242a
fa0d04c
ae84550
0d59ee2
0a67f0c
25e221b
a8ba82d
ec7aa9e
032f6cb
5dd3cce
12bc6bb
ffa560c
19fc07e
1e60688
f1b050a
4d1af25
cd26031
c222864
3c90862
4b7d88f
75ff4bf
3b03e3a
52ba943
8a6fe85
ee2bbe4
b593dc5
91ff82b
6eba18d
3fd9c6f
aef2463
503c6a4
ef16d98
4e7e0fb
d46dc3c
b9d65b3
a568d39
1bfb3ad
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 |
|---|---|---|
|
|
@@ -454,9 +454,7 @@ public void pushScope() { | |
| if (!isEnabled()) { | ||
| options | ||
| .getLogger() | ||
| .log( | ||
| SentryLevel.WARNING, | ||
| "Instance is disabled and this 'pushScope' call is a no-op."); | ||
| .log(SentryLevel.WARNING, "Instance is disabled and this 'pushScope' call is a no-op."); | ||
| } else { | ||
| final StackItem item = stack.peek(); | ||
| if (item != null) { | ||
|
|
@@ -523,7 +521,9 @@ public void configureScope(final @NotNull ScopeCallback callback) { | |
| if (!isEnabled()) { | ||
| options | ||
| .getLogger() | ||
| .log(SentryLevel.WARNING, "Instance is disabled and this 'configureScope' call is a no-op."); | ||
| .log( | ||
| SentryLevel.WARNING, | ||
| "Instance is disabled and this 'configureScope' call is a no-op."); | ||
| } else { | ||
| final StackItem item = stack.peek(); | ||
| if (item != null) { | ||
|
|
@@ -601,4 +601,57 @@ public void flush(long timeoutMillis) { | |
| } | ||
| return clone; | ||
| } | ||
|
|
||
| @Override | ||
| public SentryId captureTransaction(Transaction transaction, Object hint) { | ||
|
||
| SentryId sentryId = SentryId.EMPTY_ID; | ||
| if (!isEnabled()) { | ||
| options | ||
| .getLogger() | ||
| .log( | ||
| SentryLevel.WARNING, | ||
| "Instance is disabled and this 'captureTransaction' call is a no-op."); | ||
| } else if (transaction == null) { | ||
| options | ||
| .getLogger() | ||
| .log(SentryLevel.WARNING, "captureTransaction called with null parameter."); | ||
| } else { | ||
| try { | ||
| final StackItem item = stack.peek(); | ||
| if (item != null) { | ||
| sentryId = item.client.captureTransaction(transaction, item.scope, hint); | ||
| } else { | ||
| options.getLogger().log(SentryLevel.FATAL, "Stack peek was null when captureTransaction"); | ||
| } | ||
| } catch (Exception e) { | ||
| options | ||
| .getLogger() | ||
| .log( | ||
| SentryLevel.ERROR, | ||
| "Error while capturing event with id: " + transaction.getEventId(), | ||
| e); | ||
| } | ||
| } | ||
| this.lastEventId = sentryId; | ||
| return sentryId; | ||
| } | ||
|
|
||
| @Override | ||
| public @Nullable Transaction startTransaction(TransactionContexts transactionContexts) { | ||
|
||
| Transaction transaction = null; | ||
| if (!isEnabled()) { | ||
| options | ||
| .getLogger() | ||
| .log(SentryLevel.WARNING, "Instance is disabled and this 'setExtra' call is a no-op."); | ||
| } else { | ||
| final StackItem item = stack.peek(); | ||
| if (item != null) { | ||
| transaction = new Transaction(transactionContexts); | ||
| item.scope.setTx(transaction); | ||
| } else { | ||
| options.getLogger().log(SentryLevel.FATAL, "Stack peek was null when setExtra"); | ||
| } | ||
| } | ||
| return transaction; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package io.sentry; | ||
|
|
||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| /** Sentry SDK internal logging interface. */ | ||
| public interface ILogger { | ||
|
|
||
|
|
@@ -30,4 +32,14 @@ public interface ILogger { | |
| * @param args the formatting arguments | ||
| */ | ||
| void log(SentryLevel level, Throwable throwable, String message, Object... args); | ||
|
|
||
| /** | ||
| * Whether this logger is enabled for the specified SentryLevel. | ||
| * | ||
| * @param level The SentryLevel to test against. | ||
| * @return True if a log message would be recorded for the level. Otherwise false. | ||
| */ | ||
| default boolean isEnabled(final @Nullable SentryLevel level) { | ||
| return true; | ||
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,15 +28,17 @@ public Session deserializeSession(Reader reader) { | |
| } | ||
|
|
||
| @Override | ||
| public SentryEnvelope deserializeEnvelope(InputStream inputStream) { | ||
| public Transaction deserializeTransaction(Reader reader) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void serialize(SentryEvent event, Writer writer) {} | ||
| public SentryEnvelope deserializeEnvelope(InputStream inputStream) { | ||
maciejwalkowiak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void serialize(Session session, Writer writer) throws IOException {} | ||
| public <T> void serialize(T entity, Writer writer) throws IOException {} | ||
|
Member
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. Not propsing to change this but:
Contributor
Author
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. Technically we can serialize anything that Gson is able to serialize. If we want to make it explicit what can be serialized perhaps we can introduce a a marker interface?
Contributor
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. yeah a marker interface would be ideal, but we could add this as a task along with moving away from reflection for serializing things, so we do a bigger refactoring and just one breaking change.
Contributor
Author
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. 👍 |
||
|
|
||
| @Override | ||
| public void serialize(SentryEnvelope envelope, Writer outputStream) throws Exception {} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.