Skip to content

Commit 440bf02

Browse files
committed
Better json encoding and fix error logging.
1 parent b99b9ff commit 440bf02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

instana/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, sensor):
4545

4646
def to_json(self, o):
4747
try:
48-
return json.dumps(o, default=lambda o: o.to_dict(),
48+
return json.dumps(o, default=lambda o: o.__dict__,
4949
sort_keys=False, separators=(',', ':')).encode()
5050
except Exception as e:
5151
l.error("to_json: ", e, o)
@@ -103,7 +103,7 @@ def full_request_response(self, url, method, o, body, header):
103103
except Exception as e:
104104
# No need to show the initial 404s or timeouts. The agent
105105
# should handle those correctly.
106-
if type(e) is urllib2.HTTPError and e.code != 404:
106+
if not (type(e) is urllib2.HTTPError and e.code == 404):
107107
l.error("%s: full_request_response: %s" % (threading.current_thread().name, str(e)))
108108

109109
return (b, h)

0 commit comments

Comments
 (0)