Update api/extensions/otel/runtime.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
非法操作 2026-03-09 14:44:27 +08:00 committed by GitHub
parent a28cb993b8
commit 4f5af0b43c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,8 +44,10 @@ def flush_telemetry() -> None:
"""
provider = trace.get_tracer_provider()
if hasattr(provider, "force_flush"):
with contextlib.suppress(Exception):
try:
provider.force_flush()
except Exception:
logger.exception("otel: failed to flush trace provider")
metric_provider = metrics.get_meter_provider()
if hasattr(metric_provider, "force_flush"):