MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / _end_init_trace_atexit

Function _end_init_trace_atexit

agentops/client/client.py:22–35  ·  view source on GitHub ↗

Global atexit handler to end the client's auto-initialized trace during shutdown.

()

Source from the content-addressed store, hash-verified

20
21
22def _end_init_trace_atexit():
23 """Global atexit handler to end the client's auto-initialized trace during shutdown."""
24 global _client_init_trace_context, _client_legacy_session_for_init_trace
25 if _client_init_trace_context is not None:
26 logger.debug("Auto-ending client's init trace during shutdown.")
27 try:
28 # Use global tracer to end the trace directly
29 if tracer.initialized and _client_init_trace_context.span.is_recording():
30 tracer.end_trace(_client_init_trace_context, end_state="Shutdown")
31 except Exception as e:
32 logger.warning(f"Error ending client's init trace during shutdown: {e}")
33 finally:
34 _client_init_trace_context = None
35 _client_legacy_session_for_init_trace = None # Clear its legacy wrapper too
36
37
38class Client:

Callers

nothing calls this directly

Calls 2

is_recordingMethod · 0.80
end_traceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…