Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
26 lines
731 B
Python
26 lines
731 B
Python
import threading
|
|
import aworld.trace as trace
|
|
import os
|
|
import time
|
|
from aworld.trace.instrumentation.threading import instrument_theading
|
|
from aworld.logs.util import logger, trace_logger
|
|
|
|
os.environ["MONITOR_SERVICE_NAME"] = "otlp_example"
|
|
trace.configure()
|
|
instrument_theading()
|
|
|
|
|
|
def child_thread_func():
|
|
logger.info("child thread running")
|
|
with trace.span("child_thread") as span:
|
|
trace_logger.info("child thread running")
|
|
time.sleep(1000)
|
|
|
|
|
|
def main():
|
|
logger.info("main running")
|
|
with trace.span("test_fastapi") as span:
|
|
trace_logger.info("start run child_thread_func")
|
|
threading.Thread(target=child_thread_func).start()
|
|
threading.Thread(target=child_thread_func).start()
|