observability: harden flush span attributes
* Normalize the host-pool layout to a string (a None attribute would make the OTel SDK drop the whole flush span). * Drop any remaining None-valued flush attributes for the same reason.
This commit is contained in:
@@ -907,7 +907,8 @@ class HiCacheController:
|
||||
)
|
||||
batch_telemetry.flush_note("sglang.flush_io_backend", self.io_backend)
|
||||
batch_telemetry.flush_note(
|
||||
"sglang.flush_layout", getattr(self.mem_pool_host, "layout", None)
|
||||
"sglang.flush_layout",
|
||||
str(getattr(self.mem_pool_host, "layout", None) or ""),
|
||||
)
|
||||
batch_telemetry.flush_note(
|
||||
"sglang.flush_ack_queue_before", len(self.ack_write_queue)
|
||||
|
||||
@@ -1470,6 +1470,9 @@ class BackupFlushTracer:
|
||||
for name, value in self.counts.items():
|
||||
attrs["sglang.flush_" + name] = int(value)
|
||||
attrs.update(self.attrs)
|
||||
# OTel rejects None; keep a single malformed dimension from dropping the
|
||||
# whole span.
|
||||
attrs = {k: v for k, v in attrs.items() if v is not None}
|
||||
try:
|
||||
from opentelemetry import trace as otel_trace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user