forked from phoenix/litellm-mirror
fix importing Span
This commit is contained in:
parent
7c1183e76e
commit
87533bacf7
3 changed files with 26 additions and 8 deletions
|
@ -1,12 +1,18 @@
|
||||||
import os
|
import os
|
||||||
from typing import Optional
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from litellm.integrations.custom_logger import CustomLogger
|
from litellm.integrations.custom_logger import CustomLogger
|
||||||
from litellm._logging import verbose_logger
|
from litellm._logging import verbose_logger
|
||||||
from litellm.types.services import ServiceLoggerPayload, ServiceTypes
|
from litellm.types.services import ServiceLoggerPayload
|
||||||
from opentelemetry.trace import Span
|
from typing import Union, Optional, TYPE_CHECKING, Any
|
||||||
from datetime import datetime
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from opentelemetry.trace import Span as _Span
|
||||||
|
|
||||||
|
Span = _Span
|
||||||
|
else:
|
||||||
|
Span = Any
|
||||||
|
|
||||||
LITELLM_TRACER_NAME = "litellm"
|
LITELLM_TRACER_NAME = "litellm"
|
||||||
LITELLM_RESOURCE = {"service.name": "litellm"}
|
LITELLM_RESOURCE = {"service.name": "litellm"}
|
||||||
|
|
|
@ -17,14 +17,20 @@ from litellm.proxy._types import (
|
||||||
LiteLLM_OrganizationTable,
|
LiteLLM_OrganizationTable,
|
||||||
LitellmUserRoles,
|
LitellmUserRoles,
|
||||||
)
|
)
|
||||||
from typing import Optional, Literal, Union
|
from typing import Optional, Literal, TYPE_CHECKING, Any
|
||||||
from litellm.proxy.utils import PrismaClient, ProxyLogging, log_to_opentelemetry
|
from litellm.proxy.utils import PrismaClient, ProxyLogging, log_to_opentelemetry
|
||||||
from litellm.caching import DualCache
|
from litellm.caching import DualCache
|
||||||
import litellm
|
import litellm
|
||||||
from opentelemetry.trace import Span
|
|
||||||
from litellm.types.services import ServiceLoggerPayload, ServiceTypes
|
from litellm.types.services import ServiceLoggerPayload, ServiceTypes
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from opentelemetry.trace import Span as _Span
|
||||||
|
|
||||||
|
Span = _Span
|
||||||
|
else:
|
||||||
|
Span = Any
|
||||||
|
|
||||||
all_routes = LiteLLMRoutes.openai_routes.value + LiteLLMRoutes.management_routes.value
|
all_routes = LiteLLMRoutes.openai_routes.value + LiteLLMRoutes.management_routes.value
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,18 @@ import sys, os, platform, time, copy, re, asyncio, inspect
|
||||||
import threading, ast
|
import threading, ast
|
||||||
import shutil, random, traceback, requests
|
import shutil, random, traceback, requests
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Optional, List, Callable, get_args, Set
|
from typing import Optional, List, Callable, get_args, Set, Any, TYPE_CHECKING
|
||||||
import secrets, subprocess
|
import secrets, subprocess
|
||||||
import hashlib, uuid
|
import hashlib, uuid
|
||||||
import warnings
|
import warnings
|
||||||
import importlib
|
import importlib
|
||||||
from opentelemetry.trace import Span
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from opentelemetry.trace import Span as _Span
|
||||||
|
|
||||||
|
Span = _Span
|
||||||
|
else:
|
||||||
|
Span = Any
|
||||||
|
|
||||||
|
|
||||||
def showwarning(message, category, filename, lineno, file=None, line=None):
|
def showwarning(message, category, filename, lineno, file=None, line=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue