@@ -77,6 +77,7 @@ extern "C" {
7777#endif
7878
7979static int otel_enabled_cfg = 0 ;
80+ static int enable_proc = 0 ;
8081static int *otel_enabled = NULL ;
8182static int otel_log_level = L_DBG ;
8283static int otel_use_batch = 1 ;
@@ -99,7 +100,6 @@ static __thread int otel_log_in_cb;
99100
100101static __thread profiling_ctx_t otel_parent_ctx;
101102static __thread int otel_parent_ctx_set;
102- static int otel_trace_registered;
103103static int otel_log_consumer_registered;
104104
105105static opentelemetry::nostd::shared_ptr<oteltrace::Tracer> otel_tracer;
@@ -719,6 +719,7 @@ profiling_handlers_t otel_trace_handlers = {
719719
720720static const param_export_t params[] = {
721721 { " enable" , INT_PARAM , &otel_enabled_cfg },
722+ { " proc_profiling" , INT_PARAM , &enable_proc},
722723 { " log_level" , INT_PARAM , &otel_log_level },
723724 { " use_batch" , INT_PARAM , &otel_use_batch },
724725 { " service_name" , STR_PARAM , &otel_service_name.s },
@@ -768,6 +769,14 @@ static int mod_init(void)
768769 *otel_enabled = otel_enabled_cfg;
769770 }
770771
772+ if (enable_proc)
773+ otel_trace_handlers.accepted_data_types |= PROFILING_DATA_TYPE_PROC ;
774+
775+ if (register_profiling_handler (&otel_trace_handlers) != 0 ) {
776+ LM_ERR (" failed to register profiling hooks\n " );
777+ return -1 ;
778+ }
779+
771780 if (!otel_is_enabled ()) {
772781 LM_INFO (" opentelemetry module disabled\n " );
773782 }
@@ -790,14 +799,6 @@ static int child_init(int rank)
790799 otel_log_in_cb = 0 ;
791800 otel_parent_ctx_clear ();
792801
793- if (!otel_trace_registered) {
794- if (register_profiling_handler (&otel_trace_handlers) != 0 ) {
795- LM_ERR (" failed to register profiling hooks\n " );
796- return -1 ;
797- }
798- otel_trace_registered = 1 ;
799- }
800-
801802 if (!otel_log_consumer_registered) {
802803 if (register_log_consumer (OTEL_CONSUMER_NAME , otel_log_consumer,
803804 otel_log_level, 0 ) != 0 ) {
0 commit comments