Skip to content

Commit

Permalink
Update charm tracing lib to v1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
shayancanonical committed Jun 6, 2024
1 parent 33e24ce commit 61405ad
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/charms/tempo_k8s/v1/charm_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def my_tracing_endpoint(self) -> Optional[str]:
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version

LIBPATCH = 6
LIBPATCH = 7

PYDEPS = ["opentelemetry-exporter-otlp-proto-http==1.21.0"]

Expand Down Expand Up @@ -540,11 +540,13 @@ def wrapped_function(*args, **kwargs): # type: ignore
name = getattr(callable, "__qualname__", getattr(callable, "__name__", str(callable)))
with _span(f"{'(static) ' if static else ''}{qualifier} call: {name}"): # type: ignore
if static:
# fixme: do we or don't we need [1:]?
# The _trace_callable decorator doesn't always play nice with @staticmethods.
# Sometimes it will receive 'self', sometimes it won't.
# return callable(*args, **kwargs) # type: ignore
return callable(*args[1:], **kwargs) # type: ignore
# The _trace_callable decorator doesn't play super nice with @staticmethods.
# if you call MyObj().mystaticmethod we'll receive the MyObj instance as first argument,
# if you call MyObj.mystaticmethod we won't.
try:
inspect.signature(callable).bind(*args, **kwargs)
except TypeError:
return callable(*args[1:], **kwargs) # type: ignore
return callable(*args, **kwargs) # type: ignore

# wrapped_function.__signature__ = sig
Expand Down

0 comments on commit 61405ad

Please sign in to comment.