Skip to content

Commit

Permalink
datadog: use self.config.get_current_span
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Apr 13, 2024
1 parent d053b78 commit 2346e4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions automon/integrations/openTelemetryWrapper/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):

def add_event(self, name: str, attributes: types.Attributes = None, **kwargs):
logger.debug(dict(name=name, attributes=attributes, kwargs=kwargs))
return self.config.opentelemetry.trace.get_current_span().add_event(
return self.config.get_current_span().add_event(
name=name,
attributes=attributes,
**kwargs
Expand All @@ -28,9 +28,9 @@ async def clear(self):
logger.debug('clear')
return await self.config.clear()

def current_span(self):
def get_current_span(self):
logger.debug('current_span')
return self.config.current_span()
return self.config.get_current_span()

async def is_ready(self):
if await self.config.is_ready():
Expand All @@ -46,7 +46,7 @@ async def pop_finished_spans(self):

async def record_exception(self, exception: Exception):
logger.error(f'{exception}')
span = await self.current_span()
span = await self.get_current_span()
span.set_status(Status(StatusCode.ERROR))
return span.record_exception(exception=exception)

Expand Down
2 changes: 1 addition & 1 deletion automon/integrations/openTelemetryWrapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def clear(self):
logger.debug('clear')
return self.memory_processor.clear()

def current_span(self):
def get_current_span(self):
logger.debug('get_current_span')
return opentelemetry.trace.get_current_span()

Expand Down

0 comments on commit 2346e4f

Please sign in to comment.