@@ -117,9 +117,7 @@ defmodule Membrane.Core.Stalker do
117117 end
118118
119119 # Sets component path, logger metadata and adds necessary entries to the process dictionary
120- # Also registers the process with a meaningful name for easier introspection with
121- # stalker if enabled by setting `unsafely_name_processes_for_observer: :components`
122- # in config.exs.
120+ # and labels the process with a meaningful name for easier introspection with stalker
123121 defp setup_process_local_observability ( config , opts ) do
124122 config = parse_observability_config ( config , opts )
125123
@@ -169,23 +167,14 @@ defmodule Membrane.Core.Stalker do
169167 }
170168 end
171169
172- if :components in @ unsafely_name_processes_for_observer do
173- defp register_name_for_stalker ( config ) do
174- if Process . info ( self ( ) , :registered_name ) == { :registered_name , [ ] } do
175- Process . register (
176- self ( ) ,
177- """
178- ##{ config . pid_string } #{ if config . is_name_provided , do: config . name_string } \
179- #{ unless config . is_name_provided , do: " (#{ config . component_type } )" } #{ config . utility_name } "\
180- """
181- |> String . to_atom ( )
182- )
183- end
170+ defp register_name_for_stalker ( config ) do
171+ label =
172+ """
173+ ##{ config . pid_string } #{ if config . is_name_provided , do: config . name_string } \
174+ #{ unless config . is_name_provided , do: " (#{ config . component_type } )" } #{ config . utility_name } "\
175+ """
184176
185- :ok
186- end
187- else
188- defp register_name_for_stalker ( _config ) , do: :ok
177+ Process . set_label ( label )
189178 end
190179
191180 @ doc """
@@ -204,12 +193,22 @@ defmodule Membrane.Core.Stalker do
204193 }
205194 end
206195
196+ if :components in @ unsafely_name_processes_for_observer do
197+ IO . warn (
198+ """
199+ Deprecated `:components` value for :unsafely_name_processes_for_observer option.
200+ Now the processes are always labeled so there is no need to use this option.
201+ """ ,
202+ __STACKTRACE__
203+ )
204+ end
205+
207206 if :links in @ unsafely_name_processes_for_observer do
208207 defp run_link_dbg_process ( pad_ref , observability_data ) do
209208 { :ok , observer_dbg_process } =
210209 Task . start_link ( fn ->
211210 Process . flag ( :trap_exit , true )
212- Process . register ( self ( ) , :"pad #{ inspect ( pad_ref ) } #{ :erlang . pid_to_list ( self ( ) ) } " )
211+ Process . label ( self ( ) , :"pad #{ inspect ( pad_ref ) } #{ :erlang . pid_to_list ( self ( ) ) } " )
213212 process_to_link = Map . get ( observability_data , :observer_dbg_process )
214213 if process_to_link , do: Process . link ( process_to_link )
215214
0 commit comments