Skip to content

Commit

Permalink
handle json decode error
Browse files Browse the repository at this point in the history
Helps to keep an eye on the problem.
  • Loading branch information
cherusk committed Nov 24, 2023
1 parent 8f2346d commit 784df81
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion prometheus_ss_exporter/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ def provide_tcp_stats(self):

self._reset_io()

return json.loads(sk_stats_raw)
sk_stats_parsed = dict()
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("-----")

return sk_stats_parsed


class Condenser:
Expand Down

0 comments on commit 784df81

Please sign in to comment.