From a74382a1e897d6067801ae270c065262250ee97e Mon Sep 17 00:00:00 2001 From: Nam Vu Date: Sat, 21 Sep 2024 19:49:01 +0700 Subject: [PATCH] fix: api/core/ops/ops_trace_manager.py (#8501) --- api/core/ops/ops_trace_manager.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/core/ops/ops_trace_manager.py b/api/core/ops/ops_trace_manager.py index 6f17bade9748e7..876790f5b88899 100644 --- a/api/core/ops/ops_trace_manager.py +++ b/api/core/ops/ops_trace_manager.py @@ -176,11 +176,18 @@ def get_ops_trace_instance( return None app: App = db.session.query(App).filter(App.id == app_id).first() + + if app is None: + return None + app_ops_trace_config = json.loads(app.tracing) if app.tracing else None - if app_ops_trace_config is not None: - tracing_provider = app_ops_trace_config.get("tracing_provider") - else: + if app_ops_trace_config is None: + return None + + tracing_provider = app_ops_trace_config.get("tracing_provider") + + if tracing_provider is None or tracing_provider not in provider_config_map: return None # decrypt_token