-
-
Notifications
You must be signed in to change notification settings - Fork 455
Do not report cached events as lost #4575
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
Changes from all commits
0d0c782
d521a60
a320001
b435169
c1cee9b
59250c4
270a4c3
039ffbc
3fd31b6
10e42ce
e45908a
63b9d7b
0f2e1a2
b1a54ca
29f057b
d4ba02b
4425a1b
2c7271a
644dcd8
78bb822
c1a6766
9ac34bb
b4ac53c
ffd313f
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 |
---|---|---|
|
@@ -6,10 +6,17 @@ | |
|
||
public interface IEnvelopeCache extends Iterable<SentryEnvelope> { | ||
|
||
@Deprecated | ||
void store(@NotNull SentryEnvelope envelope, @NotNull Hint hint); | ||
|
||
default boolean storeEnvelope(@NotNull SentryEnvelope envelope, @NotNull Hint hint) { | ||
store(envelope, hint); | ||
return true; | ||
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. I think we should actually return |
||
} | ||
|
||
@Deprecated | ||
default void store(@NotNull SentryEnvelope envelope) { | ||
store(envelope, new Hint()); | ||
storeEnvelope(envelope, new Hint()); | ||
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. Bug: Cache Store Failure MaskingThe default implementation of 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. We have to maintain backward compatibility and thus cannot replace the method directly. We are overriding |
||
} | ||
|
||
void discard(@NotNull SentryEnvelope envelope); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,7 @@ private static QueuedThreadPoolExecutor initExecutor( | |
final EnvelopeSender envelopeSender = (EnvelopeSender) r; | ||
|
||
if (!HintUtils.hasType(envelopeSender.hint, Cached.class)) { | ||
envelopeCache.store(envelopeSender.envelope, envelopeSender.hint); | ||
envelopeCache.storeEnvelope(envelopeSender.envelope, envelopeSender.hint); | ||
} | ||
|
||
markHintWhenSendingFailed(envelopeSender.hint, true); | ||
|
@@ -271,7 +271,7 @@ public void run() { | |
TransportResult result = this.failedResult; | ||
|
||
envelope.getHeader().setSentAt(null); | ||
envelopeCache.store(envelope, hint); | ||
boolean cached = envelopeCache.storeEnvelope(envelope, hint); | ||
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. Since envelopes that were cached previously have a no-op envelope cache here in |
||
|
||
HintUtils.runIfHasType( | ||
hint, | ||
|
@@ -311,14 +311,17 @@ public void run() { | |
|
||
// ignore e.g. 429 as we're not the ones actively dropping | ||
if (result.getResponseCode() >= 400 && result.getResponseCode() != 429) { | ||
HintUtils.runIfDoesNotHaveType( | ||
hint, | ||
Retryable.class, | ||
(hint) -> { | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelopeWithClientReport); | ||
}); | ||
if (!cached) { | ||
HintUtils.runIfDoesNotHaveType( | ||
hint, | ||
Retryable.class, | ||
(hint) -> { | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope( | ||
DiscardReason.NETWORK_ERROR, envelopeWithClientReport); | ||
}); | ||
} | ||
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. Bug: Envelope Cache Logic FailsThe Locations (5)
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. Envelopes that have already been cached will have the |
||
} | ||
|
||
throw new IllegalStateException(message); | ||
|
@@ -332,10 +335,12 @@ public void run() { | |
retryable.setRetry(true); | ||
}, | ||
(hint, clazz) -> { | ||
LogUtils.logNotInstanceOf(clazz, hint, options.getLogger()); | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelopeWithClientReport); | ||
if (!cached) { | ||
LogUtils.logNotInstanceOf(clazz, hint, options.getLogger()); | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelopeWithClientReport); | ||
} | ||
}); | ||
throw new IllegalStateException("Sending the event failed.", e); | ||
} | ||
|
@@ -348,10 +353,12 @@ public void run() { | |
retryable.setRetry(true); | ||
}, | ||
(hint, clazz) -> { | ||
LogUtils.logNotInstanceOf(clazz, hint, options.getLogger()); | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelope); | ||
if (!cached) { | ||
LogUtils.logNotInstanceOf(clazz, hint, options.getLogger()); | ||
options | ||
.getClientReportRecorder() | ||
.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelope); | ||
} | ||
}); | ||
} | ||
return result; | ||
|
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.
could you also explicitly implement it in
AndroidEnvelopeCache
? I recall there were some issues with desugaring on Unity, where it would crash with NoSuchMethodError for default methods in coresentry