Skip to content

Commit

Permalink
Add trace ID to clipboard debug info and title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
HakonSohoel committed Nov 12, 2024
1 parent 5b96e8a commit bf54fbb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ert/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/ert/gui/simulation/experiment_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
)
Expand Down
4 changes: 4 additions & 0 deletions src/ert/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit bf54fbb

Please sign in to comment.