mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-10 13:29:35 +00:00
feat(core): Support opentelemetry exporter (#1690)
This commit is contained in:
@@ -3,7 +3,7 @@ import contextvars
|
||||
from abc import ABC, abstractmethod
|
||||
from concurrent.futures import Executor, ThreadPoolExecutor
|
||||
from functools import partial
|
||||
from typing import Any, Awaitable, Callable
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from dbgpt.component import BaseComponent, ComponentType, SystemApp
|
||||
|
||||
@@ -67,6 +67,11 @@ async def blocking_func_to_async(
|
||||
return await loop.run_in_executor(executor, run_with_context)
|
||||
|
||||
|
||||
async def blocking_func_to_async_no_executor(func: BlockingFunction, *args, **kwargs):
|
||||
"""Run a potentially blocking function within an executor."""
|
||||
return await blocking_func_to_async(None, func, *args, **kwargs) # type: ignore
|
||||
|
||||
|
||||
class AsyncToSyncIterator:
|
||||
def __init__(self, async_iterable, loop: asyncio.BaseEventLoop):
|
||||
self.async_iterable = async_iterable
|
||||
|
Reference in New Issue
Block a user