Hi Thanks for providing the details. Before we discuss deeper, there is a scenario we need to clear. Span#create and span#close could be in two interceptors. How could you make sure the created span could be closed? Because otherwise, this disable mechanism could cause the span can't close correctly, which causes the tracing context leaks directly.
Sheng Wu 吴晟 Twitter, wusheng1108 技颠 <[email protected]> 于2020年11月13日周五 下午2:17写道: > Hello everyone, > I would like to share a new feature with SkyWalking, called “Dynamically > close some plugins of java agent”. > > > Background > 1.in our production environment, there have been several failures or > fusing of online business due to incompatible SkyWalking agent plugins. > 2.some business applications do not need to monitor the links of certain > plugins. > Therefore, we have developed a dynamic plugin shutdown function, which is > used to shut down the link monitoring of a plugin of a certain application > in an emergency, or close all plugins under the application. > > > Structure > Agent(dynamic close java agent plugin) — gRPC protocol — OAP Server — > SkyWalking-Rocketbot-UI > > > More detail > OAP Server: > 1.Store plugin status information of each instance agent > 2.Provide GraphQL API to change cluster/instance plugin status. > This means that the plugin status of the application/instance is managed > in OAP, and the agent obtains the plugin status of the application/instance > by querying OAP. > > > SkyWalking-Rocketbot-UI: > 1. Manage the plugin status of each application/instance > > > Agent: > 1. Establish the relationship between the plug-in and the enhanced class. > After obtaining that the plug-in is closed, close all interceptors under > the plug-in. In principle, we only need to modify ConstructorInter, > InstMethodsInter, InstMethodsInterWithOverrideArgs, StaticMethodsInter, > StaticMethodsInterWithOverrideArgs and some bootstrap template > interceptors. We need to determine whether the interceptor corresponding to > the current class is closed in the interception method of these > interceptors. If it is closed, we directly call the original method, > skipping the execution of the before, after, handleMethodException methods > of the relevant interceptor. > 2. Query the plugin status of the current instance at a certain interval. > 3. Update the plugin state in the agent with the plug-n state obtained by > querying OAP. > > > Question: > 1.Why can only dynamically close the plugin, but not dynamically open the > plugin? > Because some interceptors need some initialization information, for > example, when the plug-in is used for the first time, the plug-in is turned > off, causing some information to not be initialized. When it is turned on, > calling getSkyWalkingDynamicField returns null. At this time, some > NullPointerException may occur. > > > > My English is not very good, and some parts may be unclear. Please forgive > me.
