Skip to content

Commit

Permalink
Merge pull request #5638 from snwoods/private/stevenwo/CA-391381
Browse files Browse the repository at this point in the history
CA-391381: Avoid errors for Partial Callables in observer.py
  • Loading branch information
bernhardkaindl authored May 24, 2024
2 parents 72dbbf3 + 84c8f1c commit cc4a203
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python3/packages/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import runpy
import sys
import traceback
import types
from datetime import datetime, timezone
from logging.handlers import SysLogHandler
from typing import List, Sequence
Expand Down Expand Up @@ -288,7 +289,9 @@ def instrument_function(wrapped, _, args, kwargs):
# class or classmethod
aspan.set_attribute("xs.span.args.str", str(args))
aspan.set_attribute("xs.span.kwargs.str", str(kwargs))
else:
elif isinstance(wrapped, wrapt.PartialCallableObjectProxy):
pass
elif isinstance(wrapped, (types.FunctionType, types.MethodType)):
# function, staticmethod or instancemethod
bound_args = inspect.signature(wrapped).bind(*args, **kwargs)
bound_args.apply_defaults()
Expand Down

0 comments on commit cc4a203

Please sign in to comment.