Fix empty 'args' and 'kwargs' when using 'hide_args' with Jaeger

When 'hide_args=True' is used in @profiler.trace() decorator
along with Jaeger driver, trace 'args' and 'kwargs' function
parameters are empty, which leads to a key error.

This change introduces a key check before adding those parameters to
tags.

Change-Id: I312da1b175a04d4ddee7f823111b8320dd4777d6
This commit is contained in:
Daria Kobtseva 2020-06-21 12:29:42 +02:00
parent 8569b6d65f
commit 61a0ff8ace
1 changed files with 4 additions and 2 deletions

View File

@ -140,8 +140,10 @@ class Jaeger(base.Driver):
tags["http.scheme"] = info["request"]["scheme"]
elif info.get("function"):
# RPC, function calls
tags["args"] = info["function"]["args"]
tags["kwargs"] = info["function"]["kwargs"]
if "args" in info["function"]:
tags["args"] = info["function"]["args"]
if "kwargs" in info["function"]:
tags["kwargs"] = info["function"]["kwargs"]
tags["name"] = info["function"]["name"]
return tags