mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
* fix refactor dd to be an instance of custom logger * migrate dd logger to be async * clean up dd logging * add datadog sync and async code * use batching for datadog logger * add doc string for dd logging * add clear doc string * fix doc string * allow debugging intake url * clean up requirements.txt * allow setting custom batch size on logger * fix dd logging to use compression * fix linting * add dd load test * fix dd load test * fix dd url * add test_datadog_logging_http_request * fix test_datadog_logging_http_request
13 lines
517 B
Python
13 lines
517 B
Python
def make_json_serializable(payload):
|
|
for key, value in payload.items():
|
|
try:
|
|
if isinstance(value, dict):
|
|
# recursively sanitize dicts
|
|
payload[key] = make_json_serializable(value.copy())
|
|
elif not isinstance(value, (str, int, float, bool, type(None))):
|
|
# everything else becomes a string
|
|
payload[key] = str(value)
|
|
except:
|
|
# non blocking if it can't cast to a str
|
|
pass
|
|
return payload
|