Skip to content

Commit

Permalink
Sonar cloud flagged issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Jan 23, 2024
1 parent e2bcb8a commit 98724e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions synapseclient/core/async_utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""This utility class is to hold any utilities that are needed for async operations."""
from typing import Any, Callable, Coroutine
from typing import Any, Callable, Coroutine, Union
from opentelemetry import trace


tracer = trace.get_tracer("synapseclient")


def otel_trace_method(
method_to_trace_name,
method_to_trace_name: Union[Callable[..., str], None] = None,
) -> Callable[..., Callable[..., Coroutine[Any, Any, None]]]:
"""
Decorator to trace a method with OpenTelemetry in an async environment. This function
Expand All @@ -32,7 +32,10 @@ async def store(self):
"""

def decorator(f) -> Callable[..., Coroutine[Any, Any, None]]:
"""Function decorator."""

async def wrapper(self, *arg, **kwargs) -> None:
"""Wrapper for the function to be traced."""
trace_name = (
method_to_trace_name(self, *arg, **kwargs)
if method_to_trace_name
Expand Down

0 comments on commit 98724e4

Please sign in to comment.