Method, device and electronic device for quickly loading plug-in of Java probe

By dividing the plug-ins of Java probes into internal and external plug-ins, and loading the required plug-ins based on index information and adaptation information, the problem of inefficiency when starting Java probes is solved, achieving faster loading and startup.

CN118193082BActive Publication Date: 2025-02-18NETWORKBENCH SYST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410395481.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-02
Publication Date
2025-02-18
Estimated Expiration
2044-04-02

AI Technical Summary

Technical Problem

As the number and types of components increase, Java probes need to load more plug-ins when starting, resulting in lower startup efficiency.

Method used

By dividing the plug-in into internal plug-in and external plug-in, it is stored in different paths, responding to the target probe startup instructions, determining the plug-in index information, obtaining adaptation information, and loading the target plug-in that meets the conditions according to the preset configuration conditions. .

Benefits of technology

Reduces the number of plug-ins loaded when Java probe is started, shortens the loading time, and improves the startup efficiency of Java probes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118193082B_ABST
    Figure CN118193082B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device and electronic device for quickly loading plug-ins of a Java probe, wherein the method determines the index information corresponding to the target plug-in to be loaded by responding to the startup instruction of the target probe, wherein the location where the index information is stored is different for different plug-in types, and the adaptation information of the target plug-in is obtained based on the determined index information, and then the adaptation information of the plug-in is used to determine whether each plug-in meets the preset configuration conditions, and if so, the target plug-in that meets the preset configuration conditions is loaded. The embodiments of the present application are selected to determine the target plug-in that meets the preset configuration conditions based on the index information, and then record this part of the plug-in. In this way, the number of plug-ins loaded when the Java probe is started can be reduced, the time for the Java probe to load the plug-in can be shortened, and it helps to improve the startup efficiency of the Java probe.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development technology, and in particular to a method, device and electronic device for quickly loading a Java probe plug-in. Background Art

[0002] In the field of software development technology, the essence of a software application is composed of business codes and various components related to its own business. Business codes call components to improve development efficiency and operational reliability. In the process of business development, in order to test the business code, the operating performance data of each component will be monitored and collected. Java probes are usually used to dynamically modify Java bytecode to implement testing of business code. Specifically, with the help of the embedding capability of Java probes, the plug-in for performance data acquisition is embedded in the code of the business component, and the plug-in extracts the performance data of the component, and further analyzes the operation of the business code based on the extracted performance data.

[0003] However, as the number and types of components available on the market increase, the number of compatible plug-ins also increases, which results in a large number and type of plug-ins that need to be loaded when the probe is started, which further makes the probe startup efficiency low. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method, device and electronic device for quickly loading a plug-in of a Java probe, so as to shorten the time for loading the plug-in of the Java probe and further improve the efficiency of starting the Java probe.

[0005] In a first aspect, the present application provides a method for quickly loading a Java probe plug-in, the method comprising:

[0006] In response to a start instruction of a target probe, determine index information corresponding to each plug-in corresponding to the target probe, wherein the plug-in type includes: an external plug-in and an internal plug-in, the index information of the external plug-in is recorded in an external plug-in directory, and the index information of the internal plug-in is recorded in a probe core package;

[0007] Based on the determined index information, obtaining adaptation information of each of the plug-ins;

[0008] If the adaptation information of the plug-in meets the preset configuration condition, the target plug-in that meets the preset configuration condition is loaded.

[0009] According to the first aspect, in a second possible embodiment, the method further includes:

[0010] Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification;

[0011] If the adaptation code of the plug-in does not support dynamic modification, the plug-in whose adaptation code does not support dynamic modification is determined to be an internal plug-in; if the adaptation code of the plug-in supports dynamic modification, the plug-in whose adaptation code supports dynamic modification is determined to be an external plug-in.

[0012] According to the first aspect, in a third possible embodiment, the method further includes:

[0013] The index information of each internal plug-in is aggregated into an internal index idx file, and the internal index idx file is stored in the probe core package.

[0014] According to the first aspect, in a fourth possible embodiment, the method further includes:

[0015] Generate an external index idx file according to the index information of each external plug-in, and store the external index idx file in the external plug-in directory.

[0016] An independent monitoring thread is used to monitor the changes of each external plug-in. If there is an external plug-in with a plug-in change, the external index idx file is updated based on the changed external plug-in.

[0017] According to the fourth possible embodiment of the first aspect, in a fifth possible embodiment, the method further includes:

[0018] If the independent monitoring thread detects the presence of a newly added external plug-in, the index information of the newly added external plug-in is added to the external index idx file;

[0019] Reload the adapted program class according to the changed index information in the external index idx file.

[0020] According to the first aspect, in a sixth possible embodiment, the method further includes:

[0021] If the adaptation information of the plug-in meets the preset configuration conditions, read and parse the target plug-in;

[0022] An embedding operation is performed based on the target plug-in to extract performance data of the target business application based on the embedded target plug-in.

[0023] In a second aspect, the present application provides a device for quickly loading a Java probe plug-in, the device 40 comprising:

[0024] The determination module 401 is used to determine the index information corresponding to each plug-in corresponding to the target probe in response to the start instruction of the target probe, wherein the plug-in type includes: external plug-in and internal plug-in, the index information of the external plug-in is recorded in the external plug-in directory, and the index information of the internal plug-in is recorded in the probe core package;

[0025] The acquisition module 402 is used to acquire the adaptation information of each of the plug-ins based on the determined index information;

[0026] The loading module 403 is used to load a target plug-in that meets the preset configuration condition if the adaptation information of the plug-in meets the preset configuration condition.

[0027] In conjunction with the second aspect, in a second possible embodiment, the acquisition module 402 is further configured to:

[0028] Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification;

[0029] The determination module 401 is also used to determine that the plug-in whose adaptation code does not support dynamic modification is an internal plug-in if the plug-in adaptation code does not support dynamic modification, and to determine that the plug-in whose adaptation code supports dynamic modification is an external plug-in if the plug-in adaptation code supports dynamic modification.

[0030] In combination with the second aspect, in a third possible embodiment, the device further includes:

[0031] The index file processing module 404 is used to aggregate the index information of each internal plug-in into an internal index idx file, and store the internal index idx file in the probe core package.

[0032] In combination with the second aspect, in a fourth possible embodiment, the device further includes:

[0033] The index file processing module 404 is used to generate an external index idx file according to the index information of each external plug-in, and store the external index idx file in the external plug-in directory.

[0034] The monitoring module 405 is used to monitor the changes of each external plug-in by using an independent monitoring thread. If there is an external plug-in with a changed plug-in, the external index idx file is updated based on the changed external plug-in.

[0035] In combination with the fourth possible embodiment of the second aspect, in a fifth possible embodiment, the monitoring module 405 is further used to:

[0036] If the independent monitoring thread detects the presence of a newly added external plug-in, the index information of the newly added external plug-in is added to the external index idx file; and the adapted program class is reloaded according to the changed index information in the external index idx file.

[0037] In combination with the second aspect, in a sixth possible embodiment, the device further includes:

[0038] The embedding processing module 406 is used to read and parse the target plug-in if the adaptation information of the plug-in meets the preset configuration conditions; perform embedding operation based on the target plug-in to extract performance data of the target business application based on the embedded target plug-in.

[0039] In a third aspect, the present application provides an electronic device, the electronic device comprising:

[0040] a processor; and a memory storing a program,

[0041] The program includes instructions, which, when executed by the processor, enable the processor to execute the method for quickly loading a Java probe plug-in according to the first aspect.

[0042] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method for quickly loading a Java probe plug-in according to the first aspect.

[0043] Beneficial effects of this application:

[0044] An embodiment of the present application provides a method, device and electronic device for quickly loading a Java probe plug-in, wherein the method determines index information corresponding to a target plug-in to be loaded in response to a startup instruction of a target probe, wherein the location where the index information is stored is different for different plug-in types, and based on the determined index information, the adaptation information of the target plug-in is obtained, and then based on the adaptation information of the plug-in, it is determined whether each plug-in meets a preset configuration condition, and if so, the target plug-in that meets the preset configuration condition is loaded.

[0045] Since the number of plug-ins adapted to a business application is less than the number of plug-ins corresponding to a Java probe, the embodiment of the present application is selected. By dividing the plug-ins into internal plug-ins and external plug-ins, and then storing the index information of different plug-ins in different paths, when the Java probe is started and the adapted plug-in needs to be loaded, all the plug-ins corresponding to the Java probe are not directly loaded, but the method provided by the present application is first used to determine the target plug-in that meets the preset configuration conditions based on the index information, and then record this part of the plug-in. In this way, the number of plug-ins loaded when the Java probe is started can be reduced, the time for the Java probe to load the plug-in can be shortened, and it helps to improve the startup efficiency of the Java probe. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Further details, features and advantages of the present application are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0047] Figure 1 A schematic diagram of a process of a method for quickly loading a Java probe plug-in provided in an embodiment of the present application is shown;

[0048] Figure 2 A schematic diagram of a process for monitoring changes in external plug-ins provided in an embodiment of the present application is shown;

[0049] Figure 3 Another schematic diagram showing a method for quickly loading a Java probe plug-in provided in an embodiment of the present application

[0050] Figure 4 A schematic diagram of the logical structure of a device for quickly loading a Java probe plug-in provided in an embodiment of the present application is shown;

[0051] Figure 5 A schematic diagram of a logical structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0052] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.

[0053] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0054] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0055] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0056] Before describing the specific embodiments of the present application, various professional terms that may be involved in this article are explained here:

[0057] Java framework: A Java framework usually refers to a semi-finished software structure that provides preset tool classes and components to help developers build applications more efficiently.

[0058] Components: A series of reusable software functions provided by the Java framework, usually referring to modules or class libraries that encapsulate specific functions, which can simplify the development process and improve the reusability of code. The components commonly involved in this article include: HttpClient component, JDBC (Java Database Connectivity) component, Jedis component, OkHttp component, etc.

[0059] Java plug-in (hereinafter referred to as plug-in): Java plug-in is a software component designed to meet specific functional requirements and can extend the functionality of existing applications or libraries. Java plug-in adds new features by implementing predefined interfaces, thereby enhancing the capabilities of the original software.

[0060] Java probe (hereinafter referred to as probe): Probe is a technology that can dynamically modify Java bytecode, and is often used in scenarios such as program debugging and performance diagnostic analysis. Java bytecode refers to the intermediate representation of a compiled Java program that can be executed on a Java virtual machine (JVM). Java bytecode does not depend on any specific hardware or operating system. As long as the JVM is installed on the device, the bytecode file can be run. Probes can expand functionality through bytecode enhancement technology without modifying the original code of the program, thereby reducing the intrusion into the business code.

[0061] Among them, in this application, the probe provides basic component adaptation capabilities, such as embedding, code indicator extraction, etc. The plug-in provides the logic for extracting component performance data, and each code of the plug-in is the relevant code for extracting component performance data. The plug-in code needs to be embedded into the component code through the probe's embedding capability. The performance data extracted by the plug-in also needs to be summarized, stored and sent through the probe's capabilities.

[0062] Tranform: In the JVM, bytecode transformation is a process that allows bytecode to be modified when class files are loaded. This mechanism is mainly implemented through Java's Instrumentation API and Java Agents. Bytecode transformation provides developers with the ability to dynamically modify, enhance, or monitor bytecode while the application is running without modifying the source code.

[0063] Business application: Business application is essentially composed of its own business code and various components. Business code calls components to improve development efficiency and operation reliability. Different components are usually developed by professional organizations (such as business teams). Compared with developing each function by yourself, it is more reliable to use common components to achieve the effect. The operation of components is related to business code. Components are called by business code, and there is a direct relationship between the calling method and parameters. Therefore, the operation of business code can be monitored at the component level.

[0064] As there are more and more open source and commercial components on the market, the number and types of components available in the business application process are also increasing. This means that the amount of code for business applications will increase accordingly, and the number of classes for a large number of applications is conservatively greater than 30,000. In the process of using probes to detect the performance data of components, the number of plug-ins for monitoring probes is also increasing. Usually when the probe is started, the plug-in for the probe used to monitor the startup is loaded first, the adaptation information of the plug-in (such as the index information of the plug-in) is extracted, and then the component is adapted according to the extracted adaptation information. The plug-in that is successfully adapted can be embedded and performance data extracted. However, as the amount of business code increases, the number of plug-ins also increases, which results in a large number of plug-ins that need to be loaded during the probe startup process, which is easy to make the probe startup time gradually increase and the probe startup efficiency is low.

[0065] For example, in the scenario where APM (Application Performance Management & Monitoring) monitors application performance, the Java probe plug-in involves the adaptation of various components and even private components. The number of plug-ins has exceeded 300. At the moment of application startup, the probe needs to read a large amount of index information of these plug-ins. When there are bottlenecks in the CPU and disk IO, this will be an important factor affecting the application startup speed. In the microservice scenario, a long application startup will cause the probe activity to time out, and the business application code will re-pull up the probe, which will further cause the probe to be repeatedly started, thereby causing business accidents.

[0066] In view of this, the present application provides a method, device and electronic device for quickly loading a Java probe plug-in, wherein the method for quickly loading a Java probe plug-in can be applied to any electronic device capable of plug-in loading, including but not limited to personal mobile terminals (such as mobile phones, tablets, smart wearable devices, etc.), computers, servers, etc.

[0067] Among them, the first aspect, such as Figure 1 As shown, the method for quickly loading a Java probe plug-in provided by the present application may include the following steps:

[0068] S11, in response to the start instruction of the target probe, determine the index information corresponding to each plug-in corresponding to the target probe. The plug-in types include: external plug-in and internal plug-in, the index information of the external plug-in is recorded in the external plug-in directory, and the index information of the internal plug-in is recorded in the probe core package;

[0069] S12. Acquire the adaptation information of each of the plug-ins based on the determined index information;

[0070] S13. If the adaptation information of the plug-in meets the preset configuration condition, load the target plug-in that meets the preset configuration condition.

[0071] Since the number of plug-ins adapted to a business application is less than the number of plug-ins corresponding to a Java probe, the embodiment of the present application is selected. By dividing the plug-ins into internal plug-ins and external plug-ins, and then storing the index information of different plug-ins in different paths, when the Java probe is started and the adapted plug-in needs to be loaded, all the plug-ins corresponding to the Java probe are not directly loaded, but the method provided by the present application is first used to determine the target plug-in that meets the preset configuration conditions based on the index information, and then record this part of the plug-in. In this way, the number of plug-ins loaded when the Java probe is started can be reduced, the time for the Java probe to load the plug-in can be shortened, and it helps to improve the startup efficiency of the Java probe.

[0072] The above steps S11 to S13 are described in detail below:

[0073] In step S11, the target probe is a pre-designed tool for dynamically modifying bytecodes for business application software programs. Among them, the types of target probes (i.e., target Java Agents) may include: performance monitoring probes, debugging probes, hot deployment probes, security probes, and custom probes. Among them, performance probes are used to monitor the performance indicators of applications, such as CPU usage, memory consumption, thread status, etc. Debug probes are used to help developers diagnose and debug programs at runtime, such as detecting memory leaks, thread deadlocks, etc. Hot deployment probes are used to allow application code to be updated without stopping the application server, thereby improving system availability and maintenance efficiency. Security probes are used to enhance the security of applications, such as detecting potential security vulnerabilities and malicious behavior. Custom probes are used for developers to write specific Agents according to their actual needs to implement specific functions or optimize programs.

[0074] In the embodiment of the present application, different Java probes will require different plug-ins to be called, but the plug-ins required to be called of the same type are usually similar, including a large number of plug-ins. When executing step S11, the type of the target probe can be determined in response to the startup instruction of the target probe, and then the various plug-ins belonging to the target probe type can be determined based on the type of the target probe. Among them, each plug-in is stored in a specified path, and the target probe loads the plug-in through the specified path when it is started. In the embodiment of the present application, the storage path of this plug-in is determined as the index information of the plug-in. Among them, the specific expression form of the index information of each plug-in can be flexibly set, and this application does not make a strict limitation.

[0075] In the embodiment of the present application, each plug-in corresponding to the target probe is mainly composed of three parts: an embedding class part, a tool class part, and an index file part. Among them, taking the target probe as a performance probe as an example, the embedding class part of the plug-in in the embodiment of the present application: generally refers to the relevant code that needs to be embedded in the monitoring class. For example: com.test.OkController, specifically, the com.test.OkController is:

[0076] package com.test; / / test package

[0077] public void OkController{

[0078] public void ok(){

[0079] / / Embed code (1)

[0080] Inspecter.callOriginal();

[0081] / / Embedding (2)

[0082] }

[0083] }

[0084] Tool class part: usually refers to some auxiliary classes called at the location of embedding (1) or embedding (2) in the above code, which can be used to simplify the number of embedded code classes. Since tool classes involve the problem of class loading isolation, the package name of the data package where the tool class is located needs to be independently identified, that is, an independent package name is used to name the data package where the tool class is located.

[0085] Index file part: A written plug-in usually comes with an index file, which can be used to increase the loading speed of the plug-in. The index file has different forms of expression. Some are written in the preset configuration file (such as in the METAINFO.MF configuration file), and some are separate files.

[0086] In step S11, the index information of the plug-in may refer to the relevant description information of the plug-in, which is determined according to the index format. As an example, the index format of the plug-in may be as follows:

[0087] *plugins / xxx-xxx-plugin-9.1.jar / / index file package name

[0088] Name:xxx-xxx-plugin-9.1 / / index file name

[0089] Version:3.6.8 / / version number

[0090] Time:1705922748000 / / Modification time

[0091] Enabled: true / / Is it enabled?

[0092] Exact-Inspect-Method-Annotations: / / Precise embedding, adapted according to method annotations. The method annotations match to embed

[0093] Base-Inspect-Method-Signatures: / / The signature of the method adapted by the base class embedding

[0094] Base-Inspect-Class-Annotations: / / Base class embedding, adapted according to class annotations. The embedding can be done if the annotations of the current class match or the annotations of the parent class (you can iterate upward to match the parent class) match

[0095] Base-Inspect-Method-Annotations: / / Base class embedding, adapted according to method annotations. The method annotations of the current class match or the parent class (you can iterate upward to match the parent class) can be embedded.

[0096] Illegal-Classes: / / Ignore the embedding code. After the class matches, the plugin will no longer adapt.

[0097] Inspect-Classes: / / The adaptation requires that the class must exist

[0098] Exact-Inspect-Class-Annotations: / / Precise embedding, adapted according to class annotations

[0099] Exact-Inspect-Classes: / / Precise embedding, adapted according to class name

[0100] Base-Inspect-Classes: / / Base class embedding, adapted according to the class name. The current class name or the parent class (can be iterated upward to match the parent class) class name matching can be embedded

[0101] Since the number of plug-ins adapted by the probe has reached more than 300, although the index file can improve the parsing speed, considering the update iteration of the plug-in and the customized adaptation of the plug-in, relying on only one index file to dynamically maintain all the plug-ins will be inefficient and cumbersome, and the logic will be very complicated. Based on this, in the embodiment of the present application, the plug-ins can be divided based on factors such as maintenance cost and logic complexity, and then different plug-ins can be divided into set categories.

[0102] Based on this, in some embodiments, the method for quickly loading a Java probe plug-in provided in the embodiments of the present application further includes the following steps:

[0103] Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification;

[0104] If the adaptation code of the plug-in does not support dynamic modification, the plug-in whose adaptation code does not support dynamic modification is determined to be an internal plug-in; if the adaptation code of the plug-in supports dynamic modification, the plug-in whose adaptation code supports dynamic modification is determined to be an external plug-in.

[0105] Specifically, we can query the plug-in's adaptation code and determine whether the plug-in's adaptation code supports dynamic modification based on actual needs. Then, based on whether the plug-in's adaptation code supports dynamic modification, we divide the plug-in into internal plug-ins and external plug-ins. An internal plug-in means that the plug-in's adaptation code will not change dynamically, and the adaptation code will not change at runtime, that is, the internal plug-in is a plug-in that does not support dynamic changes. Correspondingly, an external plug-in means a plug-in that supports dynamic changes.

[0106] Specifically, in the embodiment of the present application, the plug-in that does not support update iteration is set in the internal plug-in and directly packaged into the probe. In this way, when maintaining the index file, this part of the internal plug-in can be ignored, which further helps to improve the parsing speed.

[0107] In some embodiments, the internal plug-in and the external plug-in need to be processed separately. Based on this, the method for quickly loading a plug-in in a Java probe provided in the embodiment of the present application further includes the following steps:

[0108] The index information of each internal plug-in is aggregated into an internal index idx file, and the internal index idx file is stored in the probe core package.

[0109] The index information in this internal index idx file does not support dynamic modification. It can add new internal plug-in index information, but does not support updating the old internal plug-in index information.

[0110] The process of storing the internal index idx file in the probe core package may include the following steps:

[0111] Compile and package the core code -> add plugins -> generate index files -> package the probe core package

[0112] Among them, the generated index file is generated based on the index information of the internal plug-in. The specific core code compilation and packaging, plug-in addition, and probe core package encapsulation can refer to the relevant technical documents, and this application is not strictly limited here.

[0113] In addition, for external plug-ins, the method for quickly loading plug-ins for Java probes provided in the embodiment of the present application may also include the following steps:

[0114] An external index idx file is generated according to the index information of each external plug-in, and the external index idx file is stored in the external plug-in directory.

[0115] Specifically, plug-ins that may change at any time during operation are identified as external plug-ins, and then an external index idx file is generated based on the index information of these plug-ins that will change, and stored in the external plug-in directory of the plug-in. Correspondingly, the plug-ins in the external plug-in directory are all changeable. However, the timeliness of the index file is the key to whether the index file is valid. Therefore, in an embodiment of the present application, an independent monitoring thread is created to regularly detect whether the external plug-in has changed. Among them, the thread can determine whether the plug-in in the external plug-in directory has changed by monitoring the modification time of the plug-in. If there is an external plug-in whose modification time has changed, the external index idx file is updated based on the changed external plug-in.

[0116] As an implementation method, the index file may be generated by referring to the following example:

[0117] *<file path>

[0118] Plugin 1

[0119] *<file path>

[0120] Plugin 2

[0121] *<file path>

[0122] Plugin 3

[0123] *<file path>

[0124] That is to say, the index information interval of a plug-in is from "*<file path>" to the next "*<file path>", that is to say, the content contained in two "*<file path>" is the index information of a plug-in. In this way, the index information of each plug-in can be inserted into the middle of each two "*<file path>" in sequence to achieve differentiated storage one by one. In this way, one index file can support the storage of index information of multiple plug-ins, which helps to reduce memory usage.

[0125] In the embodiment of the present application, each plug-in index information includes the following content:

[0126] Plugin path, version, modification time, whether enabled, precise adapter class, basic class or interface adapter class, annotation adapter class, exclusion adapter and other information.

[0127] In the embodiment of the present application, the core index information involved in the Java probe plug-in loading process includes:

[0128] Precise adapter class, base class or interface adapter class, annotation adapter class, etc. Among them, precise adapter class refers to full class name adaptation. Base class refers to the base class matching of the class, and interface adapter class refers to the full class name matching of the interface.

[0129] Annotation adapter class refers to class annotation matching.

[0130] In some embodiments, the above process for handling changes to external plug-ins may further include the following steps:

[0131] If the independent monitoring thread detects the presence of a newly added external plug-in, the index information of the newly added external plug-in is added to the external index idx file;

[0132] Reload the adapted program class according to the changed index information in the external index idx file.

[0133] Specifically, as an implementation method, the process of using the independent monitoring thread to monitor plug-in changes can be as follows: Figure 2 As shown, the following steps are included:

[0134] Step 1: Detect whether the modification time of the plug-in has changed, determine whether the plug-in in the external plug-in directory has changed, and determine the type of plug-in change.

[0135] Step 2: If the type of plugin that has changed is a new plugin, then a corresponding index file is added to the external plugin directory for the new plugin.

[0136] Step 3: Load the corresponding plug-in based on the supplemented index file, and then proceed to step 6.

[0137] Step 4: If the type of plugin change is not a new plugin, detect the plugin change and then go to step 5.

[0138] Step 5: Update the index file of the corresponding plug-in in the external plug-in directory based on the changed plug-in, and then execute step 6.

[0139] Step 6: Reload the corresponding class based on the changed index file.

[0140] Step 7: Adapt the corresponding plug-in based on the loaded class.

[0141] Based on this, when executing step S12, the index files of the plug-ins corresponding to the target probe can be loaded first through the storage paths of the plug-ins. Then, the index information of each plug-in is obtained from the loaded index file, and then the adaptation information of each plug-in is obtained based on the information of each category in each plug-in. Then, step S13 is executed to determine whether the adaptation information meets the preset configuration conditions.

[0142] As an implementation method, the method flow of the Java probe fast loading plug-in provided in the embodiment of the present application can be specifically as follows: Figure 3 As shown:

[0143] After receiving the start command of the target probe, the index file is loaded. In this process, the plug-in is not actually loaded, but the index file is loaded to obtain the adaptation information stored in the index file of each plug-in. Know what the adaptation information required by the plug-in includes, such as whether an exact adaptation class is required, whether a base class or interface adaptation class is required, and so on.

[0144] Then, based on the actual purpose of the target Java probe, determine which classes need to be included in the required plug-in, that is, set the plug-in adaptation condition based on the actual purpose of the target Java probe, and the plug-in adaptation condition clearly specifies the classes included in the plug-in. At this time, this plug-in adaptation condition is the preset configuration condition in step S13. And based on this preset configuration condition, create a temporary index plug-in. Among them, the adaptation information of the temporary index plug-in is the same as the adaptation information in the preset configuration condition.

[0145] Based on this, when executing step S13, the plug-in adaptation can be performed by using the preset configuration conditions and the adaptation information of the plug-in in the loaded index file, specifically, the class contained in the plug-in index file is adapted. If the adaptation is successful, either the successfully adapted target plug-in is directly returned. Or the target plug-in is read and parsed, and then the Java probe technology is used to perform an embedding operation based on the target plug-in using the target probe to extract the performance data of the target business application based on the embedded target plug-in.

[0146] The embodiment of the present application is selected, and preset configuration conditions are set according to the needs of the actual target business application and the various types of information of the plug-in specified in the index file, and then a temporary index plug-in is created based on the preset configuration conditions, and the classes of each plug-in under the storage path are adapted based on the temporary index plug-in. When the adaptation is successful, the target plug-in is actually loaded, and the bytecode in the target plug-in is read and parsed. In this process, it can be confirmed again whether the adaptation information of the plug-in meets the actual needs. Then the bytecode data of the plug-in is stored in the memory to reduce the number of plug-ins to be loaded and reduce the storage space occupied by the probe loading plug-in.

[0147] In a second aspect, the present application embodiment provides a device for quickly loading a Java probe plug-in, such as Figure 4 As shown, the device 40 includes:

[0148] The determination module 401 is used to determine the index information corresponding to each plug-in corresponding to the target probe in response to the start instruction of the target probe, wherein the plug-in type includes: external plug-in and internal plug-in, the index information of the external plug-in is recorded in the external plug-in directory, and the index information of the internal plug-in is recorded in the probe core package;

[0149] An acquisition module 402 is used to acquire the adaptation information of each of the plug-ins based on the determined index information;

[0150] The loading module 403 is used to load a target plug-in that meets the preset configuration condition if the adaptation information of the plug-in meets the preset configuration condition.

[0151] In conjunction with the second aspect, in a second possible embodiment, the acquisition module 402 is further configured to:

[0152] Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification;

[0153] The determination module 401 is also used to determine that the plug-in whose adaptation code does not support dynamic modification is an internal plug-in if the plug-in adaptation code does not support dynamic modification, and to determine that the plug-in whose adaptation code supports dynamic modification is an external plug-in if the plug-in adaptation code supports dynamic modification.

[0154] In combination with the second aspect, in a third possible embodiment, the device further includes:

[0155] The index file processing module 404 is used to aggregate the index information of each internal plug-in into an internal index idx file, and store the internal index idx file in the probe core package.

[0156] In combination with the second aspect, in a fourth possible embodiment, the device further includes:

[0157] The index file processing module 404 is used to generate an external index idx file according to the index information of each external plug-in, and store the external index idx file in the external plug-in directory.

[0158] The monitoring module 405 is used to monitor the changes of each external plug-in by using an independent monitoring thread. If there is an external plug-in with a changed plug-in, the external index idx file is updated based on the changed external plug-in.

[0159] In combination with the fourth possible embodiment of the second aspect, in a fifth possible embodiment, the monitoring module 405 is further used for:

[0160] If the independent monitoring thread detects the presence of a newly added external plug-in, the index information of the newly added external plug-in is added to the external index idx file; and the adapted program class is reloaded according to the changed index information in the external index idx file.

[0161] In combination with the second aspect, in a sixth possible embodiment, the device further includes:

[0162] The embedding processing module 406 is used to read and parse the target plug-in if the adaptation information of the plug-in meets the preset configuration conditions; perform embedding operation based on the target plug-in to extract performance data of the target business application based on the embedded target plug-in.

[0163] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0164] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device performs a method according to an embodiment of the present application.

[0165] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present application.

[0166] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present application.

[0167] refer to Figure 5 , the structural block diagram of the electronic device 500 that can be used as the server or client of the present application will now be described, which is an example of hardware devices that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples, and are not intended to limit the implementation of the present application described and / or required herein.

[0168] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0169] A plurality of components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 may be any type of device capable of inputting information to the electronic device 500, and the input unit 506 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 507 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 508 may include, but is not limited to, a disk, an optical disk. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0170] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above. For example, in some embodiments, the aforementioned method of Java probe fast loading plug-in may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. In some embodiments, the computing unit 501 may be configured to execute the aforementioned method of Java probe fast loading plug-in by any other appropriate means (e.g., by means of firmware).

[0171] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0172] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0173] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0175] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0176] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

Claims

1. A method for quickly loading a Java probe plug-in, characterized in that: The method comprises: In response to a start-up instruction of a target probe, index information corresponding to each plug-in corresponding to the target probe is determined, wherein the plug-in types include: external plug-in and internal plug-in, the index information of the external plug-in is recorded in an external plug-in directory, and the index information of the internal plug-in is recorded in a probe core package; wherein the external plug-in is a plug-in whose adaptation code supports dynamic modification, and the internal plug-in is a plug-in whose adaptation code does not support dynamic modification; Based on the determined index information, obtaining adaptation information of each of the plug-ins; If the adaptation information of the plug-in meets the preset configuration conditions, then the target plug-in that meets the preset configuration conditions is loaded, and the target plug-in is read and parsed; wherein the adaptation information includes: precise adaptation class information, basic class information, interface adaptation class information, annotation adaptation class information, and exclusion adaptation information; the preset configuration conditions specify the adaptation information contained in the plug-in; An embedding operation is performed based on the target plug-in to extract performance data of the target business application based on the embedded target plug-in.

2. The method according to claim 1, characterized in that The method further comprises: Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification; If the adaptation code of the plug-in does not support dynamic modification, the plug-in whose adaptation code does not support dynamic modification is determined to be an internal plug-in; if the adaptation code of the plug-in supports dynamic modification, the plug-in whose adaptation code supports dynamic modification is determined to be an external plug-in.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: The index information of each internal plug-in is aggregated into an internal index idx file, and the internal index idx file is stored in the probe core package.

4. The method according to claim 1, characterized in that The method further comprises: Generate an external index idx file according to the index information of each external plug-in, and store the external index idx file in the external plug-in directory; An independent monitoring thread is used to monitor the changes of each external plug-in. If there is an external plug-in with a plug-in change, the external index idx file is updated based on the changed external plug-in.

5. The method according to claim 4, characterized in that The method further comprises: If the independent monitoring thread detects the presence of a newly added external plug-in, the index information of the newly added external plug-in is added to the external index idx file; Reload the adapted program class according to the changed index information in the external index idx file.

6. A device for quickly loading a Java probe plug-in, characterized in that: The device comprises: A determination module, for responding to a start-up instruction of a target probe, determining index information corresponding to each plug-in corresponding to the target probe, wherein the plug-in types include: external plug-in and internal plug-in, the index information of the external plug-in is recorded in an external plug-in directory, and the index information of the internal plug-in is recorded in a probe core package; wherein the external plug-in is a plug-in whose adaptation code supports dynamic modification, and the internal plug-in is a plug-in whose adaptation code does not support dynamic modification; An acquisition module, used for acquiring the adaptation information of each of the plug-ins based on the determined index information; A loading module, used for loading a target plug-in that meets the preset configuration conditions if the plug-in's adaptation information meets the preset configuration conditions; wherein the adaptation information includes: precise adaptation class information, basic class information, interface adaptation class information, annotation adaptation class information, and exclusion adaptation information; the preset configuration conditions specify the adaptation information included in the plug-in; The embedded code processing module is used to read and parse the target plug-in; perform an embedded code operation based on the target plug-in to extract performance data of the target business application based on the embedded target plug-in.

7. The device according to claim 6, characterized in that The acquisition module is further used for: Acquire the attribute information of each plug-in corresponding to the target probe in advance, wherein the attribute information of the plug-in includes: whether the adaptation code of the plug-in supports dynamic modification; The determination module is further configured to determine that the plug-in whose adaptation code does not support dynamic modification is an internal plug-in if the adaptation code of the plug-in does not support dynamic modification, and to determine that the plug-in whose adaptation code supports dynamic modification is an external plug-in if the adaptation code of the plug-in supports dynamic modification; The device also includes: An index file processing module, used to aggregate the index information of each internal plug-in into an internal index idx file, and store the internal index idx file in the probe core package; or, based on the index information of each external plug-in, generate an external index idx file, and store the external index idx file in the external plug-in directory; A monitoring module is used to monitor the changes of each of the external plug-ins using an independent monitoring thread. If there is an external plug-in with a plug-in change, the external index idx file is updated based on the changed external plug-in; if the independent monitoring thread detects the existence of a new external plug-in, the index information of the new external plug-in is added to the external index idx file; and the adapted program class is reloaded according to the changed index information in the external index idx file.

8. An electronic device, characterized in that: The electronic device comprises: Processor; and Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 5.

9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Method and system for loading components

    CN102722396A

  • Plug-in updating method and device of code editor, equipment and storage medium

    CN116755745A