From 2200bf6be6d2c3175092c8203abb0808aa3fa001 Mon Sep 17 00:00:00 2001 From: naisanzaa Date: Wed, 27 Mar 2024 05:13:41 -0400 Subject: [PATCH] opentelemetry: add consumer and producer --- automon/integrations/openTelemetryWrapper/client.py | 12 ++++++++++++ automon/integrations/openTelemetryWrapper/config.py | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/automon/integrations/openTelemetryWrapper/client.py b/automon/integrations/openTelemetryWrapper/client.py index 5be560be..8528ceda 100644 --- a/automon/integrations/openTelemetryWrapper/client.py +++ b/automon/integrations/openTelemetryWrapper/client.py @@ -23,6 +23,18 @@ async def is_ready(self): async def get_finished_spans(self): return await self.config.get_finished_spans() + async def start_consumer(self): + """adds spans from memory to queue""" + while True: + pass + return + + async def start_producer(self): + """""" + while True: + pass + return + async def to_dict(self): return [ json.loads(span.to_json()) diff --git a/automon/integrations/openTelemetryWrapper/config.py b/automon/integrations/openTelemetryWrapper/config.py index 92e11bff..1126e16e 100644 --- a/automon/integrations/openTelemetryWrapper/config.py +++ b/automon/integrations/openTelemetryWrapper/config.py @@ -1,3 +1,5 @@ +import asyncio + from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor @@ -20,6 +22,9 @@ def __init__(self): self.tracer = trace.get_tracer(__name__) + self.queue_consumer = asyncio.Queue() + self.queue_producer = asyncio.Queue() + async def clear(self): return self.memory_processor.clear()