Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: Cleanup logs when Firebase RTDB does no exist (#76)
Browse files Browse the repository at this point in the history
The emitted logs when the DB does not exist will now resemble:

```
I0221 20:25:54.661298 93984 firebase_client.py:402] Failed to check debuggee presence at cdbg/debuggees/d-93910f74/registrationTimeUnixMsec: NotFoundError('404 Not Found')
I0221 20:25:54.661362 93984 firebase_client.py:373] registering at https://my-project-cdbg.firebaseio.com, path: cdbg/debuggees/d-93910f74
I0221 20:25:54.690697 93984 firebase_client.py:390] Failed to register debuggee: NotFoundError('404 Not Found')
```
  • Loading branch information
jasonborg committed Feb 21, 2023
1 parent 7d09b9a commit c4b54d4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/googleclouddebugger/firebase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,10 @@ def _RegisterDebuggee(self):

self.register_backoff.Succeeded()
return (False, 0) # Proceed immediately to subscribing to breakpoints.
except BaseException:
except BaseException as e:
# There is no significant benefit to handing different exceptions
# in different ways; we will log and retry regardless.
native.LogInfo(f'Failed to register debuggee: {traceback.format_exc()}')
native.LogInfo(f'Failed to register debuggee: {repr(e)}')
return (True, self.register_backoff.Failed())

def _CheckDebuggeePresence(self):
Expand All @@ -394,9 +394,8 @@ def _CheckDebuggeePresence(self):
snapshot = firebase_admin.db.reference(path).get()
# The value doesn't matter; just return true if there's any value.
return snapshot is not None
except BaseException:
native.LogInfo(
f'Failed to check debuggee presence: {traceback.format_exc()}')
except BaseException as e:
native.LogInfo(f'Failed to check debuggee presence at {path}: {repr(e)}')
return False

def _MarkDebuggeeActive(self):
Expand Down

0 comments on commit c4b54d4

Please sign in to comment.