From bf54fbb2c4d2e4de44fb2a4bde2baf6e69433207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Steinkopf=20S=C3=B8hoel?= Date: Tue, 12 Nov 2024 13:45:59 +0100 Subject: [PATCH] Add trace ID to clipboard debug info and title bar --- src/ert/gui/main_window.py | 5 ++++- src/ert/gui/simulation/experiment_panel.py | 2 ++ src/ert/trace.py | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ert/gui/main_window.py b/src/ert/gui/main_window.py index 273157e8779..c314ad3b13f 100644 --- a/src/ert/gui/main_window.py +++ b/src/ert/gui/main_window.py @@ -33,6 +33,7 @@ from ert.gui.tools.plugins import PluginHandler, PluginsTool from ert.gui.tools.workflows import WorkflowsTool from ert.plugins import ErtPluginManager +from ert.trace import getTraceID BUTTON_STYLE_SHEET: str = """ QToolButton { @@ -78,7 +79,9 @@ def __init__( self.config_file = config_file self.log_handler = log_handler - self.setWindowTitle(f"ERT - {config_file} - {find_ert_info()}") + self.setWindowTitle( + f"ERT - {config_file} - {find_ert_info()} - {getTraceID()[:8]}" + ) self.plugin_manager = plugin_manager self.central_widget = QFrame(self) self.central_layout = QHBoxLayout(self.central_widget) diff --git a/src/ert/gui/simulation/experiment_panel.py b/src/ert/gui/simulation/experiment_panel.py index 4a43a30d032..e8fafe87a25 100644 --- a/src/ert/gui/simulation/experiment_panel.py +++ b/src/ert/gui/simulation/experiment_panel.py @@ -33,6 +33,7 @@ format_running_time, get_ert_memory_usage, ) +from ert.trace import getTraceID from ..summarypanel import SummaryPanel from .combobox_with_description import QComboBoxWithDescription @@ -385,6 +386,7 @@ def populate_clipboard_debug_info(self) -> None: kv[field.name.replace("_", " ").capitalize()] = str(field_value) kv["**Status**"] = "" + kv["Trace ID"] = getTraceID() kv["Running time"] = ( format_running_time(self._model.get_runtime()).split(":")[1].strip() ) diff --git a/src/ert/trace.py b/src/ert/trace.py index b68477b6022..ee8eccb29c1 100644 --- a/src/ert/trace.py +++ b/src/ert/trace.py @@ -9,3 +9,7 @@ trace.set_tracer_provider(tracer_provider) tracer = trace.get_tracer("ert.main") + + +def getTraceID() -> str: + return trace.format_trace_id(trace.get_current_span().get_span_context().trace_id)