Revert "fix custom logger"

This reverts commit 9d2707ecfe.
This commit is contained in:
Ishaan Jaff 2025-01-17 08:26:59 -08:00
parent 9d2707ecfe
commit 2d5f8ea2c6

View file

@ -16,7 +16,6 @@ from typing import Any, Dict, List, Optional, Union
import litellm import litellm
from litellm._logging import verbose_logger from litellm._logging import verbose_logger
from litellm.integrations.custom_batch_logger import CustomBatchLogger from litellm.integrations.custom_batch_logger import CustomBatchLogger
from litellm.integrations.datadog.datadog import DataDogLogger
from litellm.llms.custom_httpx.http_handler import ( from litellm.llms.custom_httpx.http_handler import (
get_async_httpx_client, get_async_httpx_client,
httpxSpecialProvider, httpxSpecialProvider,
@ -25,7 +24,7 @@ from litellm.types.integrations.datadog_llm_obs import *
from litellm.types.utils import StandardLoggingPayload from litellm.types.utils import StandardLoggingPayload
class DataDogLLMObsLogger(DataDogLogger, CustomBatchLogger): class DataDogLLMObsLogger(CustomBatchLogger):
def __init__(self, **kwargs): def __init__(self, **kwargs):
try: try:
verbose_logger.debug("DataDogLLMObs: Initializing logger") verbose_logger.debug("DataDogLLMObs: Initializing logger")
@ -53,7 +52,7 @@ class DataDogLLMObsLogger(DataDogLogger, CustomBatchLogger):
asyncio.create_task(self.periodic_flush()) asyncio.create_task(self.periodic_flush())
self.flush_lock = asyncio.Lock() self.flush_lock = asyncio.Lock()
self.log_queue: List[LLMObsPayload] = [] self.log_queue: List[LLMObsPayload] = []
CustomBatchLogger.__init__(self, **kwargs, flush_lock=self.flush_lock) super().__init__(**kwargs, flush_lock=self.flush_lock)
except Exception as e: except Exception as e:
verbose_logger.exception(f"DataDogLLMObs: Error initializing - {str(e)}") verbose_logger.exception(f"DataDogLLMObs: Error initializing - {str(e)}")
raise e raise e
@ -90,8 +89,11 @@ class DataDogLLMObsLogger(DataDogLogger, CustomBatchLogger):
"data": DDIntakePayload( "data": DDIntakePayload(
type="span", type="span",
attributes=DDSpanAttributes( attributes=DDSpanAttributes(
ml_app=self._get_datadog_service(), ml_app="litellm",
tags=[self._get_datadog_tags()], tags=[
"service:litellm",
f"env:{os.getenv('DD_ENV', 'production')}",
],
spans=self.log_queue, spans=self.log_queue,
), ),
), ),