Skip to content

Commit 8466fa6

Browse files
committed
Add trace ID to clipboard debug info and title bar
1 parent 8c679c1 commit 8466fa6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/ert/gui/main_window.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from ert.gui.tools.plugins import PluginHandler, PluginsTool
3434
from ert.gui.tools.workflows import WorkflowsTool
3535
from ert.plugins import ErtPluginManager
36+
from ert.trace import getTraceID
3637

3738
BUTTON_STYLE_SHEET: str = """
3839
QToolButton {
@@ -78,7 +79,9 @@ def __init__(
7879
self.config_file = config_file
7980
self.log_handler = log_handler
8081

81-
self.setWindowTitle(f"ERT - {config_file} - {find_ert_info()}")
82+
self.setWindowTitle(
83+
f"ERT - {config_file} - {find_ert_info()} - {getTraceID()[:8]}"
84+
)
8285
self.plugin_manager = plugin_manager
8386
self.central_widget = QFrame(self)
8487
self.central_layout = QHBoxLayout(self.central_widget)

src/ert/gui/simulation/experiment_panel.py

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
format_running_time,
3434
get_ert_memory_usage,
3535
)
36+
from ert.trace import getTraceID
3637

3738
from ..summarypanel import SummaryPanel
3839
from .combobox_with_description import QComboBoxWithDescription
@@ -383,6 +384,7 @@ def populate_clipboard_debug_info(self) -> None:
383384
kv[field.name.replace("_", " ").capitalize()] = str(field_value)
384385

385386
kv["**Status**"] = ""
387+
kv["Trace ID"] = getTraceID()
386388
kv["Running time"] = (
387389
format_running_time(self._model.get_runtime()).split(":")[1].strip()
388390
)

src/ert/trace.py

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99
trace.set_tracer_provider(tracer_provider)
1010

1111
tracer = trace.get_tracer("ert.main")
12+
13+
14+
def getTraceID() -> str:
15+
return trace.format_trace_id(trace.get_current_span().get_span_context().trace_id)

0 commit comments

Comments
 (0)