MCPcopy Create free account
hub / github.com/apache/skywalking-php / select_plugin

Function select_plugin

src/plugin/mod.rs:106–138  ·  view source on GitHub ↗
(class_name: Option<&str>, function_name: &str)

Source from the content-addressed store, hash-verified

104}
105
106fn select_plugin(class_name: Option<&str>, function_name: &str) -> Option<&'static DynPlugin> {
107 let mut selected_plugin = None;
108
109 'plugin: for plugin in &*PLUGINS {
110 if let Some(class_name) = class_name {
111 if let Some(plugin_class_names) = plugin.class_names() {
112 if plugin_class_names.contains(&class_name) {
113 selected_plugin = Some(plugin);
114 break 'plugin;
115 }
116 }
117 if let Some(parent_classes) = plugin.parent_classes() {
118 if let Ok(class) = ClassEntry::from_globals(class_name) {
119 // Iterate parent_classes and skip None.
120 for parent_class in parent_classes.into_iter().flatten() {
121 if class.is_instance_of(parent_class) {
122 selected_plugin = Some(plugin);
123 break 'plugin;
124 }
125 }
126 }
127 }
128 }
129 if let Some(function_name_prefix) = plugin.function_name_prefix() {
130 if function_name.starts_with(function_name_prefix) {
131 selected_plugin = Some(plugin);
132 break 'plugin;
133 }
134 }
135 }
136
137 selected_plugin.map(AsRef::as_ref)
138}
139
140fn log_exception(span: &mut impl HandleSpanObject) -> Option<&mut ZObj> {
141 let mut ex = unsafe { ZObj::try_from_mut_ptr(eg!(exception)) };

Callers 1

select_plugin_hookFunction · 0.85

Calls 3

class_namesMethod · 0.45
parent_classesMethod · 0.45
function_name_prefixMethod · 0.45

Tested by

no test coverage detected