in skywalking/agent/__init__.py [0:0]
def __init_threading(self) -> None:
"""
This method initializes all the threads for the agent and reporters.
Upon os.fork(), callback will reinitialize threads and queues by calling this method
Heartbeat thread is started by default.
Segment reporter thread and segment queue is created by default.
All other queues and threads depends on user configuration.
"""
self._finished = Event()
__heartbeat_thread = Thread(name='HeartbeatThread', target=self.__heartbeat, daemon=True)
__heartbeat_thread.start()
__segment_report_thread = Thread(name='SegmentReportThread', target=self.__report_segment, daemon=True)
__segment_report_thread.start()
if config.agent_meter_reporter_active:
__meter_report_thread = Thread(name='MeterReportThread', target=self.__report_meter, daemon=True)
__meter_report_thread.start()
if config.agent_pvm_meter_reporter_active:
from skywalking.meter.pvm.cpu_usage import CPUUsageDataSource
from skywalking.meter.pvm.gc_data import GCDataSource
from skywalking.meter.pvm.mem_usage import MEMUsageDataSource
from skywalking.meter.pvm.thread_data import ThreadDataSource
MEMUsageDataSource().register()
CPUUsageDataSource().register()
GCDataSource().register()
ThreadDataSource().register()
if config.agent_log_reporter_active:
__log_report_thread = Thread(name='LogReportThread', target=self.__report_log, daemon=True)
__log_report_thread.start()
if config.agent_profile_active:
# Now only profiler receives commands from OAP
__command_dispatch_thread = Thread(name='CommandDispatchThread', target=self.__command_dispatch,
daemon=True)
__command_dispatch_thread.start()
__query_profile_thread = Thread(name='QueryProfileCommandThread', target=self.__query_profile_command,
daemon=True)
__query_profile_thread.start()
__send_profile_thread = Thread(name='SendProfileSnapShotThread', target=self.__send_profile_snapshot,
daemon=True)
__send_profile_thread.start()