Skip to content

Commit

Permalink
Merge pull request #36 from cherusk/handle_json_decode_error
Browse files Browse the repository at this point in the history
improve decode error handling further
  • Loading branch information
cherusk committed Nov 24, 2023
2 parents 85bbb0c + 48ff746 commit 4fe33d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prometheus_ss_exporter/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def provide_tcp_stats(self):

self._reset_io()

sk_stats_parsed = dict()
sk_stats_parsed = dict(TCP=dict(flows=list()))
try:
sk_stats_parsed = json.loads(sk_stats_raw)
except json.decoder.JSONDecodeError as err:
logging.error("Failed parsing sample")
logging.error("-----")
logging.error(sk_stats_parsed)
logging.error(sk_stats_raw)
logging.error("-----")

return sk_stats_parsed
Expand Down

0 comments on commit 4fe33d4

Please sign in to comment.