Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmk-ui-job-scheduler: remove potential timeout
Calling any function decorated with `@tracer.start_as_current_span` will cause `opentelemetry/sdk/trace/export/__init__.py::shutdown` to timeout in the parent process. This only happens if tracing is active. Thus, calling `trace.init_tracing` before `daemonize` is unsafe. Below a minimal example: ```python import os from pathlib import Path from cmk.ccc.daemon import daemonize from cmk.ccc.site import get_omd_config, omd_site, resource_attributes_from_config from cmk import trace from cmk.trace.export import exporter_from_config, init_span_processor from cmk.trace.logs import add_span_log_handler tracer = trace.get_tracer() def main() -> None: omd_root = Path(os.environ.get("OMD_ROOT", "")) init_span_processor( trace.init_tracing( service_namespace="", service_name="example-service", service_instance_id=omd_site(), extra_resource_attributes=resource_attributes_from_config(omd_root), ), exporter_from_config(trace.trace_send_config(get_omd_config(omd_root))), ) add_span_log_handler() testme() print("testme is done") daemonize() @tracer.start_as_current_span("example") def testme() -> None: pass ``` Change-Id: I93f2d5b7542907a88180e4933fa3d71beb800711 (cherry picked from commit bf6e3f7)
- Loading branch information