try to fix exception logging

This commit is contained in:
yunlu.wen 2026-03-02 09:53:11 +08:00
parent 1a6aded8e0
commit 5617d69ca7
2 changed files with 11 additions and 3 deletions

View File

@ -66,12 +66,20 @@ def init_app(app: DifyApp):
exporter = GRPCSpanExporter(
endpoint=endpoint,
# Header field names must consist of lowercase letters, check RFC7540
headers=((("authorization", f"Bearer {dify_config.OTLP_API_KEY}"),) if dify_config.OTLP_API_KEY else None),
headers=(
(
("authorization", f"Bearer {dify_config.OTLP_API_KEY}"),
) if dify_config.OTLP_API_KEY else None
),
insecure=insecure,
)
metric_exporter = GRPCMetricExporter(
endpoint=endpoint,
headers=((("authorization", f"Bearer {dify_config.OTLP_API_KEY}"),) if dify_config.OTLP_API_KEY else None),
headers=(
(
("authorization", f"Bearer {dify_config.OTLP_API_KEY}"),
) if dify_config.OTLP_API_KEY else None
),
insecure=insecure,
)
else:

View File

@ -51,7 +51,7 @@ def process_trace_tasks(file_info):
try:
EnterpriseOtelTrace().trace(trace_info)
except Exception:
logger.warning("Enterprise trace failed for app_id: %s", app_id, exc_info=True)
logger.exception("Enterprise trace failed for app_id: %s", app_id)
if trace_instance:
with current_app.app_context():