Skip to content

Commit

Permalink
ref: Add max tries to Spotlight (#2571)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Pirker <[email protected]>
  • Loading branch information
HazAT and antonpirker committed Dec 7, 2023
1 parent 9bb6bdf commit 22bdc4d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sentry_sdk/spotlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ def __init__(self, url):
# type: (str) -> None
self.url = url
self.http = urllib3.PoolManager()
self.tries = 0

def capture_envelope(self, envelope):
# type: (Envelope) -> None
if self.tries > 3:
logger.warning(
"Too many errors sending to Spotlight, stop sending events there."
)
return
body = io.BytesIO()
envelope.serialize_into(body)
try:
Expand All @@ -33,7 +39,8 @@ def capture_envelope(self, envelope):
)
req.close()
except Exception as e:
logger.exception(str(e))
self.tries += 1
logger.warning(str(e))


def setup_spotlight(options):
Expand Down

0 comments on commit 22bdc4d

Please sign in to comment.