Skip to content

Commit

Permalink
opentelemetry: add pop_finished_spans
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Mar 27, 2024
1 parent 68f1f89 commit 7e5dadb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions automon/integrations/openTelemetryWrapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ async def is_ready(self):
async def get_finished_spans(self):
return self.memory_processor.get_finished_spans()

async def pop_finished_spans(self):
"""ideal is to lock, pop spans, and clear"""
spans = await self.get_finished_spans()
clear = await self.clear()
return spans

async def test(self):
with self.tracer.start_as_current_span("rootSpan"):
with self.tracer.start_as_current_span("childSpan"):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import unittest
import asyncio

from automon.integrations.openTelemetryWrapper import OpenTelemetryConfig


class MyTestCase(unittest.TestCase):
config = OpenTelemetryConfig()

if asyncio.run(config.is_ready()):
test = asyncio.run(config.test())

def test_pop_finished_spans(self):
spans = asyncio.run(self.config.pop_finished_spans())
self.assertIsNotNone(spans)

pass

pass


if __name__ == '__main__':
unittest.main()

0 comments on commit 7e5dadb

Please sign in to comment.