Skip to content

Commit

Permalink
Improve log, upd version
Browse files Browse the repository at this point in the history
  • Loading branch information
joente committed Nov 21, 2022
1 parent 37c9108 commit 0ed64d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions pylibagent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
from .check import CheckBase


class SendDataException(Exception):
pass


def _convert_verify_ssl(val):
if val is None or val.lower() in ['true', '1', 'y', 'yes']:
return None # None for default SSL check
Expand Down Expand Up @@ -140,9 +144,8 @@ async def send_data(self, check_key: str, data: dict,

except Exception as e:
msg = str(e) or type(e).__name__
logging.error(
'failed to send data for '
f'check {check_key}: {msg} (url: {url})')
raise SendDataException(
f'failed to send data ({check_key}): {msg} (url: {url})')

def start(self, checks: Iterable[CheckBase],
asset_name: Optional[str] = None):
Expand Down Expand Up @@ -209,6 +212,8 @@ async def _check_loop(self, check):
except Exception as e:
msg = str(e) or type(e).__name__
logging.error(f'check error ({check.key}): {msg}')
except SendDataException as e:
logging.error(str(e))
else:
logging.debug(f'check_loop ({check.key}): ok!')
finally:
Expand Down
2 changes: 1 addition & 1 deletion pylibagent/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.5'
__version__ = '0.1.6'

0 comments on commit 0ed64d6

Please sign in to comment.