mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
Addressing minor feedback on length of generated, fallback traceId.
This commit is contained in:
parent
8741863b49
commit
acb4f624dd
2 changed files with 4 additions and 4 deletions
|
|
@ -267,7 +267,7 @@ class NewRelicLogger(CustomLogger):
|
|||
|
||||
if not trace_id:
|
||||
# Generate a random trace_id for grouping AI monitoring events
|
||||
trace_id = str(uuid.uuid4())
|
||||
trace_id = uuid.uuid4().hex
|
||||
verbose_logger.debug(
|
||||
f"New Relic trace_id not available from distributed tracing headers. "
|
||||
f"Generated trace_id={trace_id} for AI monitoring event grouping."
|
||||
|
|
|
|||
|
|
@ -211,14 +211,14 @@ class TestGetTraceContext:
|
|||
kwargs = make_kwargs()
|
||||
trace_id, span_id = self.logger._get_trace_context(kwargs)
|
||||
assert trace_id is not None
|
||||
assert len(trace_id) == 36 # UUID format
|
||||
assert len(trace_id) == 32 # 32-char lowercase hex, matches W3C traceparent format
|
||||
|
||||
def test_generates_uuid_when_traceparent_malformed(self):
|
||||
kwargs = make_kwargs(traceparent="not-valid")
|
||||
trace_id, span_id = self.logger._get_trace_context(kwargs)
|
||||
# Falls back to a generated UUID
|
||||
# Falls back to a 32-char lowercase hex, matching W3C traceparent format
|
||||
assert trace_id is not None
|
||||
assert len(trace_id) == 36
|
||||
assert len(trace_id) == 32
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue