Data processing method for interpreted language script and related equipment

By performing static injection and data collection on the script run side, the problems of high development costs and poor stability on the script development side are solved, automatic data collection and reporting are realized, and the stability and management efficiency of script services are improved.

CN119127137APending Publication Date: 2024-12-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310696399.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-12
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, the script development side needs additional development in the control of the script operation process, resulting in high development costs and poor script service stability, and it is impossible to grasp the script operation status in a timely manner.

Method used

By performing static injection on the script run end, using rewritten underlying functions and data detection functions to collect and report script run data, reducing the development burden of developers and realizing automatic data collection and reporting.

Benefits of technology

It reduces the development cost of script development, improves the stability of script services, timely grasps the operation status of scripts, and reduces development and operation and maintenance work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127137A_ABST
    Figure CN119127137A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method for an interpreted language script and related equipment, and the method comprises the steps: rewriting a bottom layer function through a script data processing end, and transmitting injection data containing the rewritten bottom layer function and a script main function to a script operation end together by the script data processing end, static injection is conducted on the script main function on the basis of the injection data at the script operation end, the injected script main function is obtained, in this way, when the script operation end operates the injected script main function, a rewriting bottom layer function is called, and script operation data are automatically collected and reported through a data detection function in the rewriting bottom layer function; thus, developers of the script development end do not need to concern how to collect and report the script operation data, and only need to put energy into research and development of business requirements, the development cost of the script development end can be greatly reduced, the script operation condition can be mastered in time, and the stability of script service can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method and related equipment for interpreted language scripts. Background Art

[0002] With the booming development of Internet business, various business systems supporting the development of the Internet are very complex and large. At present, most business systems split different business functions based on the microservice architecture, and entrust different development ends to develop scripts corresponding to each function. Each script can be deployed independently and has wide applicability in other business systems in the future.

[0003] The script development end can publish the developed scripts through the script management platform. The script management platform is not only responsible for the release of the scripts, but also can manage the running process of the scripts to ensure the normal operation of the scripts.

[0004] At present, in the process of script development, the script development side needs to perform additional development according to the requirements of the script management platform in order to realize the control of the script running process in addition to business-related development work, such as integrating a software development kit (SDK) or implementing an application programming interface (API) or exposing a service address in the script and displaying the script running data in the service address, etc., and the code needs to be re-developed each time the script is upgraded, which not only increases the additional development cost of the script development side, but also is not conducive to the script management work of the script management platform, resulting in the inability to timely grasp the running status of the script, affecting the stability of the script service. Summary of the invention

[0005] In order to solve the current problems of high development cost and poor script service stability in script running process control, this application provides a data processing method and related equipment for interpreted language scripts:

[0006] According to a first aspect of the present application, a data processing method for an interpreted language script is provided, which is applied to a script execution end, and the method comprises:

[0007] Obtain a script data packet; the script data packet includes a script main function and injected data, the script main function is developed by the script development end based on an interpreted language; the injected data includes rewriting underlying functions, and the rewriting underlying functions includes the original underlying functions and data detection functions;

[0008] Perform static injection on the script main function based on the injection data to obtain the injected script main function;

[0009] During the running of the injected script main function, if the call of the underlying function is triggered to be rewritten, the script task is executed through the original underlying function, the script running data generated during the execution of the script task is collected through the data detection function, and the script running data is reported to the script data processing end.

[0010] According to a second aspect of the present application, a data processing method for an interpreted language script is provided, which is applied to a script data processing end, and the method comprises:

[0011] Sending a script data packet to the script running end; the script data packet includes a script main function and injected data, the script main function is developed by the script development end based on an interpreted language; the injected data includes rewriting underlying functions, and the rewriting underlying functions include original underlying functions and data detection functions;

[0012] Receive the script running data sent by the script running end; the script running data is statically injected into the script main function by the script running end based on the injection data, and is obtained through the original underlying function and the data detection function during the running process of the injected script main function.

[0013] According to a third aspect of the present application, there is provided a data processing device for an interpreted language script, which is applied to a script running end, and the device comprises:

[0014] The acquisition module is used to acquire the script data packet; the script data packet includes the script main function and injection data, the script main function is developed by the script development end based on the interpreted language; the injection data includes rewriting the underlying function, and the rewriting underlying function includes the original underlying function and the data detection function;

[0015] An injection module is used to statically inject the script main function based on the injection data to obtain the injected script main function;

[0016] The data reporting module is used to execute the script task through the original underlying function if the call of the underlying function is triggered to be rewritten during the running of the main function of the injected script, collect the script running data generated during the execution of the script task through the data detection function, and report the script running data to the script data processing end.

[0017] According to a third aspect of the present application, there is provided a data processing device for an interpreted language script, which is applied to a script data processing end, and the device comprises:

[0018] The sending module is used to send the script data packet to the script running end; the script data packet includes the script main function and injection data, the script main function is developed by the script development end based on the interpreted language; the injection data includes rewriting the underlying function, and the rewriting underlying function includes the original underlying function and the data detection function;

[0019] The receiving module is used to receive the script running data sent by the script running end; the script running data is statically injected into the script main function by the script running end based on the injection data, and is obtained through the original underlying function and the data detection function during the running process of the injected script main function.

[0020] According to a fifth aspect of the present application, an electronic device is provided, comprising a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or at least one program is loaded and executed by the processor to implement the data processing method for interpreted language scripts as in the first aspect or the second aspect.

[0021] According to the sixth aspect of the present application, a computer-readable storage medium is provided, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the data processing method for interpreted language scripts as in the first aspect or the second aspect.

[0022] According to a seventh aspect of the present application, a computer program is provided, which, when executed by a processor, implements the data processing method for interpreted language scripts as described in the first aspect or the second aspect.

[0023] The present application provides a data processing method and related equipment for interpretive language scripts, which have the following technical effects:

[0024] The underlying function is rewritten through the script data processing end, and the rewritten underlying function includes the original underlying function and the data detection function. The script data processing end sends the injection data containing the rewritten underlying function together with the script main function to the script running end, and the script main function is statically injected into the script running end based on the injection data to obtain the injected script main function. In this way, the script running end will call the rewritten underlying function when running the injected script main function, and automatically collect and report the script running data through the data detection function in the rewritten underlying function; in this way, the developers on the script development end do not need to worry about how to realize the collection and reporting of script running data, but only need to devote their energy to the research and development of business needs, which can greatly reduce the development cost of the script development end; the script development end can start the script through the script data processing end to access the script running data detection system without perception, which is very beneficial for the script data processing end to grasp the script running status in time, and can improve the stability of the script service. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0026] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;

[0027] Figure 2 It is a flowchart of a data processing method for an interpreted language script provided in an embodiment of the present application;

[0028] Figure 3 This is a schematic diagram of a process of processing data by a script execution end provided in an embodiment of the present application;

[0029] Figure 4 It is a schematic diagram of a static injection process provided by an embodiment of the present application;

[0030] Figure 5 This is a flowchart of a script running data processing provided by an embodiment of the present application;

[0031] Figure 6 This is a schematic diagram of a process of processing data by a script data processing terminal provided in an embodiment of the present application;

[0032] Figure 7 It is a schematic diagram of the first front-end page provided in the embodiment of the present application;

[0033] Figure 8 is a schematic diagram of a second front-end page provided in an embodiment of the present application;

[0034] Fig. 9 is a schematic diagram of a third front-end page provided in an embodiment of the present application;

[0035] Fig.10 This is a flowchart of a script running data processing provided by an embodiment of the present application;

[0036] Fig.11 This is a schematic diagram of a process of processing data by a script data processing terminal provided in an embodiment of the present application;

[0037] Fig.12 It is a block diagram of a data processing device for interpreted language scripts provided by an embodiment of the present application;

[0038] Fig.13 It is a block diagram of a data processing device for interpreted language scripts provided by an embodiment of the present application;

[0039] Fig.14 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0041] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0043] Interpreted language: The program is translated into machine language at runtime.

[0044] Compiled language: The source code is first compiled into machine language, and then the machine runs the machine code.

[0045] Static injection: A technique used by interpreted languages ​​to append and modify the original code before the interpreter runs.

[0046] Dynamic injection: A technique for modifying runtime parameters and variables while a program is running.

[0047] See also Figure 1 , Figure 1It is a schematic diagram of an application environment provided by an embodiment of the present application, and the application environment may include a script development terminal 01, a script data processing terminal 02, and a script running terminal 03, wherein the script development terminal 01 develops scripts based on business needs, and publishes the scripts to the script running terminal 03 through the script data processing terminal 02, and the script running terminal 03 loads and runs the scripts, and reports the script running data to the script data processing terminal 02 at the same time. The script data processing terminal 02 processes the script running data and then displays it to the script start terminal 01. Here, the script can be a scheduled task script, that is, a script that is automatically triggered for execution at a set time. Taking the business scenario as an e-commerce platform as an example, the scheduled task script can include a points synchronization script; the script can also be a script that provides services to the outside, for example, it can provide a points query service to users of the script running terminal 03; generally, each function on the e-commerce platform corresponds to a script, and the data processing method of the embodiment of the present application is applicable to scheduled task scripts and service scripts in different business scenarios. It should be noted that Figure 1 Just an example.

[0048] Among them, the script data processing terminal 02 is responsible for providing a distributed operating environment for a large number of scripts and script services, and performing real-time analysis and statistics on script running data to ensure that each script and script service can run normally and stably. In the related art, if real-time analysis and statistics of script running data are to be achieved, the script development end 01 needs to install the corresponding SDK or implement the API interface in the script by means of marking when developing the script, so that when the script is executed, the script running data is reported to the script data processing end 02 by means of the API or SDK method, so as to achieve real-time analysis and statistics of the script running data; or, in addition to the marking method, the script development end 01 can adopt the service opening long polling method, that is, the script development end 01 exposes an accessible service address in the script, and displays the script running data in a fixed format in the service address; or, the script development end 01 modifies the script log output in a fixed format according to the requirements of the script data processing end 02, and outputs the log file to a specified directory; however, the above method causes the script development end 01 to increase other additional work besides business needs and has a high learning cost. Each time the script is upgraded, the code needs to be redeveloped, which greatly increases the development and operation costs, and even requires the opening of unnecessary services, which poses a network security risk and is vulnerable to external attacks.

[0049] Based on this, in an embodiment of the present application, the script data processing end 02 packages the injection data and the script main function developed by the script development end 01 based on the interpreted language to form a script data packet and sends it to the script running end 03, wherein the injection data includes the underlying function rewritten by the script data processing end 02, that is, a data detection function is added to the original underlying function called by the script main function, and the function name of the rewritten underlying function is consistent with the function name of the original underlying function, so it is called the rewritten underlying function. In this way, after receiving the script data packet, the script running end 03 first statically injects the script main function based on the injection data, and then executes the injected script main function, so that the injected script main function can call the rewritten underlying function, and realize the collection and reporting of the script running data through the data detection function therein. In this way, there is no need for the script development end 01 to modify the code of the script main function. The subsequent script running end 03 can replace the underlying function called in the script main function with the rewritten underlying function through static injection. The developer of the script development end 01 does not need to worry about how to collect and report the script running data, but only needs to devote his energy to the research and development of business needs. As long as the startup script is run through the script data processing end 02, the script running data detection system can be accessed without perception, and the real-time analysis and statistical data displayed to it by the script data processing end 02 can be used to quickly understand the script running status.

[0050] The script running terminal 03 can be a physical device such as a smart phone, a computer (such as a desktop computer, a tablet computer, a laptop computer), an augmented reality (AR) / virtual reality (VR) device, a digital assistant, an intelligent voice interaction device (such as an intelligent speaker), an intelligent wearable device, an intelligent home appliance, a vehicle-mounted terminal, etc., or it can be software running in a physical device, such as a computer program. The operating system corresponding to the client can be an Android system (Android system), an iOS system (a mobile operating system developed by Apple), a Linux system (an operating system), a Microsoft Windows system (Microsoft Windows operating system), etc.

[0051] The script data processing end 02 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server may include a network communication unit, a processor, a memory, and the like.

[0052] The following is based on Figure 1 The application environment introduces a specific embodiment of the data processing method for interpreted language scripts in this application. Figure 2 It is a flowchart of a data processing method for interpreted language scripts provided in an embodiment of the present application. The present application provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 2 As shown, the method may include:

[0053] S201: The script data processing end sends the script data packet to the script running end.

[0054] In the embodiment of the present application, the script data packet includes a script main function and injected data, wherein the script main function is developed by the script development end based on an interpreted language, such as the currently widely used Python language; the script main function is essentially the core logic code written by the developer to achieve a certain business requirement, and is generally started by the script development end; according to actual business needs, the script main function can be configured as a timed trigger, such as database synchronization; the script main function can also provide services to the outside, such as providing business query services to users of the script running end. Since the interpreted language needs to be loaded and run through an interpreter based on the source code, it is necessary to send the script main function to the script running end, and the script running end runs the script main function through its own interpreter to execute the corresponding script task.

[0055] The injected data is provided by the script data processing end, and the injected data includes rewriting the underlying function, and the rewriting underlying function includes the original underlying function and the data detection function. Generally, the interpreter of the interpreted language has many functions built-in to implement common functions, such as network requests, print logs, etc., which are collectively referred to as underlying functions; when the script running end runs the script main function through the interpreter, the script main function will call the underlying function in the interpreter to implement some common functions. Based on this, in the embodiment of the present application, the script data processing end rewrites these underlying functions, that is, adds a section of data detection function on the basis of the original underlying function to constitute a rewriting underlying function, and the function name of the rewriting underlying function is consistent with that of the original underlying function; the script data processing end sends the rewritten underlying function together with the script main function to the script running end, and injects the rewritten underlying function into the script main function by static injection at the script running end to obtain the injected script main function, so that the injected script main function will call the rewriting underlying function, and collect and report the script running data by rewriting the data detection function in the underlying function. Therefore, the data processing method of the embodiment of the present application is suitable for interpreted language scripts. For compiled language scripts, the script development end still needs to use the method of dot-marking or open service to realize the collection and statistics of script running data.

[0056] In some possible embodiments, the script development end releases the developed script main function for the first time through the script data processing end, and the above-mentioned script data processing end sends the script data packet to the script running end, which may include the following steps: in response to the script publishing instruction sent by the script development end, the script data processing end packages the script main function released for the first time with the injection data to form a script data packet, and sends the script data packet to the script running end.

[0057] After receiving the script data packet for the first time, the script running end downloads and decompresses it, obtains the script main function and injection data from the script data packet, and then statically injects the script main function based on the injection data; for the script main function that is triggered to run regularly, it only needs to be injected once, and the injected script main function is loaded each subsequent time it is triggered to run; and considering that the script development end may iteratively update the script main function, the script development end will upload the iterative version to the script data processing end each time it is iteratively updated. In order to ensure that the script running end runs the latest iterative version of the script main function, the script data processing end can actively detect the version of the script main function. Then, the above-mentioned sending of the script data packet to the script running end may also include the following steps:

[0058] In response to the script start instruction sent by the script development end, the version information of the main function of the script to be started is checked; if the matching degree value between the version information and the version information of the main function of the script currently running on the script running end is less than a preset degree value, the main function of the script to be started and the injection data are packaged into a script data packet, and the script data packet is sent to the script running end.

[0059] Specifically, the script start instruction carries the version information of the script main function to be started, and the version information is the latest iteration version information of the script main function; the script data processing end compares the version information with the version information of the script main function currently running on the script running end to determine whether the version information of the currently running script main function is the latest iteration version information. The version information can be represented by a number, and the corresponding preset degree value can be set to 1. Then, when the version information of the script main function to be started is inconsistent with the version information of the script main function currently running on the script running end, the script data processing end can package the script main function to be started with the injection data to form a new script data packet, and then send it to the script running end again. The script running end re-statically injects the script main function based on the latest iteration version to obtain the injected script main function.

[0060] In the above embodiment, the script data processing end actively detects the version information of the script main function currently running on the script running end. When there is a version update of the script main function, the latest iterative version of the script main function is promptly sent to the script running end without the intervention of the script development end, which can reduce the script development and operation work.

[0061] S203: The script execution end statically injects the script main function based on the injection data to obtain the injected script main function.

[0062] In the present application embodiment, Figure 3 As shown, after receiving the script data packet, the script execution end decompresses the script data packet to obtain the script main function, and then confirms the code language of the script main function. When the script main function uses an interpreted language, the script main function is statically injected based on the injection data to obtain the injected script main function. For compiled language scripts, the script execution data can be reported through the SDK integrated in the script or the connected API.

[0063] In some possible embodiments, the script execution end modifies the script main function based on the injected data to implement static injection; the injected data includes not only rewriting the underlying function, but also the task processing function and the end data detection function; the above S203 may specifically include the following: Figure 4 The following steps are shown:

[0064] S401: At the start of the script main function, add a declaration for overriding the underlying function, add a task processing function, replace the variables specified by the script development end with class variables, and add a startup method for starting the injected script main function.

[0065] In this step, the script running end first adds a declaration of using the rewritten underlying function at the starting position of the script main function, so that when the subsequent script main function is running, the rewritten underlying function is called instead of the original underlying function built into the interpreter.

[0066] Secondly, the script running end also adds a task processing function at the starting position of the script main function. The task processing function is used to process script running exceptions or tasks specified by the script data processing end. Here, the specified tasks may include actively accessing the preset storage area to pull access restricted tasks. The specific processing process will be explained in detail below and will not be repeated here.

[0067] Secondly, the script running end also replaces the variables specified by the script development end with class variables, so as to facilitate the subsequent loading of the specified variable data when the script is started to realize dynamic injection; that is, in a further embodiment, the data processing method of the embodiment of the present application also includes the following steps: during the startup process of the main function of the script after injection, the variable data specified by the script development end is loaded; and the default variable data of the class variable is replaced with the specified variable data.

[0068] Specifically, for different script running ends, different specified variable data can be loaded when the script is started, forming a dynamic modification process to achieve dynamic injection. For example, for the linked database address, the script development end can configure different database addresses for different script running ends, and different script running ends automatically load their own configured database addresses when starting the script to replace the default database address. It should be noted that the script development end can configure any variable through the script data processing end to achieve dynamic injection, such as the number of script concurrency, the users served by the script, etc.

[0069] Secondly, the main function of the script after static injection is equivalent to a new function, and a new startup method needs to be written to start the main function of the script after injection. Therefore, a startup method for starting the main function of the script after injection needs to be added at the starting position of the main function of the script.

[0070] S403: Add an end data detection function at the end position of the script main function to obtain the injected script main function.

[0071] In this step, the script running end adds an end data detection function at the end position of the script main function. The end data detection function is used to inform the script data processing end that the data detection task is finished. After the above operation, the injected script main function is obtained.

[0072] In the above embodiment, the script running end rewrites the underlying function through static injection and dynamic injection, and can realize automatic reporting of script running data without the script developer changing the code. It can also flexibly modify the specified variables dynamically, so that it can be connected to the data detection service of the script data processing end without the script developer's perception, thereby ensuring the normal and stable operation of the script main function in the script running end.

[0073] S205: During the running of the main function of the injected script, if the script running end triggers the call of the rewritten underlying function, the script task is executed through the original underlying function, the script running data generated during the execution of the script task is collected through the data detection function, and the script running data is reported to the script data processing end.

[0074] In the embodiment of the present application, the script data processing end adds a data detection function in the rewriting of the underlying function. The data detection function may include a method for data collection, a method for data statistics, and a method for data reporting, etc. Figure 3 As shown, when the script running end runs the injected script main function, the hook function is used to capture the call instruction of the underlying function. When the instruction to call the underlying function is captured, the call to the rewritten underlying function is triggered, and the script task is executed by rewriting the original underlying function in the underlying function. The script task includes but is not limited to network request, printing log and outputting abnormal information, etc., and then the script running data generated in the process of executing the script task is collected and reported through the data detection function. Here, the script running data may include the requested network information, script log data, script running abnormal data and the device data of the script running end such as CPU usage, memory usage, etc. The reporting of script running data can be achieved through the http / https interface.

[0075] In addition, when the script running end runs the injected script main function, it also initializes and instantiates the task processing function, and loads the specified variable data to realize dynamic injection; among them, the task processing function can be configured to periodically pull access restriction tasks from the preset storage area. The main purpose of the access restriction task is to control the access traffic of the service.

[0076] In an embodiment of the present application, after the script data processing end receives the script execution data sent by the script execution end, it can perform real-time analysis and statistics on the script execution data, and subsequently display the statistical results to the script development end in a visual form.

[0077] In some possible embodiments, the data processing method of the embodiment of the present application may also include the following: Figure 5 The following steps are shown:

[0078] S501: The script data processing end obtains the specified business indicator sent by the script development end.

[0079] In this step, the specified business indicator may be a statistical indicator, which is configured by the script development end according to actual business needs; for example, in the business scenario of an e-commerce platform, common specified business indicators include the number of product visits, the number of service calls, etc.

[0080] S503: Analyze and statistically process the script running data according to the specified business indicator to determine the indicator data value corresponding to the specified business indicator.

[0081] In this step, the script data processing end can analyze and statistically process the script running data reported by the script running end to obtain the indicator data value corresponding to the specified business indicator. Figure 6 As shown, Figure 6 It is a schematic diagram of the process of processing data by a script data processing end provided in an embodiment of the present application; the script running data reported by the script running end may include the following types of data: business data, traffic data and log data. It should be noted that the classification of data can be implemented by the script running end or by the script data processing end; the script data processing end performs corresponding data processing according to different data types; in this embodiment, the script data processing end mainly analyzes and counts the business data to determine the indicator data value corresponding to the specified business indicator.

[0082] Specifically, Figure 6 As shown, the script data processing end receives business data uniformly through a message middleware such as rabbitmq, and then analyzes and counts the business data according to the statistical method of the specified business indicator through the real-time statistics module, obtains the indicator data value corresponding to the specified business indicator, and then writes the specified business indicator and the corresponding indicator data value into the data warehouse; for traffic data, the traffic data here may include the number of service visits, and can also be processed in accordance with the processing method of business data, that is, the script data processing end receives traffic data uniformly through the message middleware, and then counts the number of visits to each service through the real-time statistics module and writes the statistical results into the data warehouse; in addition, for log data, the script data processing end can directly store it in a specified data search and analysis engine such as Elasticsearch for easy query.

[0083] S505: Display the indicator data value to the script development end in a visual form.

[0084] In this step, the script data processing end can display the indicator data values ​​obtained based on the script running data statistics to the script development end in the form of charts through the front-end page; similarly, log data and traffic data can be displayed to the script development end through the front-end page.

[0085] like Figures 7 to 9 As shown, Figures 7 to 9 They are schematic diagrams of several front-end pages provided in the embodiments of the present application, Figure 7 The front-end page shown provides the indicator data value of the specified business indicator, as well as the trend chart of the indicator data value changing over time. Figure 8 The front-end page shown shows log data, which may include the time when various events occurred during script execution and the specific content of the events. In addition, the script execution end can also display the device data of the script execution end, such as CPU usage, memory usage, and hard disk data, through the front-end page. It can also display the running status of all scripts on the script development end, and provide corresponding operation controls to start or stop the running of the script. Furthermore, for scripts that provide access services, the script data processing end can provide service access restrictions, such as Fig. 9 As shown, the script development end can fill in at least one of the script task name, script running end and service address to be restricted through the front-end page, and set the service access upper limit or service access frequency, which is the number of service accesses within a specific time; the specific page settings can be personalized according to actual application needs. Figures 7 to 9 The front-end page is just an example.

[0086] In the above embodiment, the script data processing end can provide a front-end page to the script development end to display the script running data in a visual form, so that the developer can intuitively understand the status of the script running end and the script being run by the script running end; the script development end can observe the script running status in real time through the front-end page and can restrict service access. Subsequently, the script running end can automatically control the access data of the corresponding service to avoid failure of access service.

[0087] In some possible embodiments, when the number of service accesses or the frequency of service accesses reaches a preset threshold, the access frequency can be actively reduced or the access service can be stopped or the script can be stopped according to the preset method. The data processing method of the embodiment of the present application can also include the following: Fig.10 The following steps are shown:

[0088] S1001: The script data processing end parses and processes the network request data to determine the service address requested by the script execution end.

[0089] Specifically, the script data processing end faces multiple script running ends. Fig.11 A script running end is shown as an example in the figure. The script data processing end counts the traffic data in the script running data reported by each script running end through the message middleware to obtain network request data. The network request data includes information such as the service address requested to be accessed by the script running end and the identification of the script running end; the script data processing end parses and processes the network request data to obtain the identification of the script running end and the service address requested to be accessed by the script running end; the script data processing end can update the current access data of the service address in real time, so as to perform traffic control in a timely manner when the access data reaches the restricted access data.

[0090] S1003: The script data processing end obtains the current access data and restricted access data of the service address.

[0091] Specifically, as described above, the script development end can limit the service access upper limit or service access frequency. Therefore, the restricted access data here refers to the service access upper limit or service access frequency set by the script development end; the corresponding current access data includes the current service access times or the current service access frequency; thus, the script data processing end can detect the current access data according to the service access upper limit or service access frequency set by the script development end.

[0092] S1005: If the current access data reaches the restricted access data, the script data processing end generates an access restriction task for the service address.

[0093] In this step, if the current access data reaches the restricted access data, the script data processing end generates an access restriction task for the service address, and the access restriction task indicates that the request to access the service address is restricted to avoid causing the service to crash.

[0094] S1007: The script data processing end writes the access restriction task of the service address into a preset storage area; the preset storage area can be read by the script running end.

[0095] In this step, if Fig.11 As shown, the script data processing end writes the access restriction task of the service address into a preset storage area so that the script running end can read it.

[0096] S1009: The script execution end accesses the preset storage area through the task processing function.

[0097] In this step, if Fig.11 As shown, during the execution of the script main function, the script execution end triggers the call of the task processing function, and accesses the preset storage area through the task processing function to pull the access restriction task. The task processing function can be configured to access the preset storage area according to a fixed period so as to perform traffic access control in a timely manner.

[0098] S1011: If the script execution end reads the access restriction task written by the script data processing end from the preset storage area, it determines the service address corresponding to the access restriction task, stops sending network requests to the service address or sends network requests to the service address after a preset time period.

[0099] In this step, if the script execution end reads the access restriction task written by the script data processing end from the preset storage area and determines the service address that needs access control from the access restriction task, the script execution end can stop sending network requests to the service address, or send network requests to the service address after a preset time period. Specifically, the access restriction task can carry corresponding access control rules to instruct the script execution end to stop sending network requests to the service address or send network requests to the service address after a preset time period; the preset time period can be determined by the script development end according to the service actually accessed, and can be a few seconds or a few minutes by way of example.

[0100] In the above embodiment, the script data processing end detects the current access data of the corresponding service address based on the access restriction data set by the script development end. When the set access restriction data is reached, the access restriction task can be automatically generated according to the access control rules set by the development end. The script running end automatically pulls the access restriction task and implements the corresponding access control rules during the execution of the script main function, thereby slowing down the network request speed, avoiding service crashes and causing script operation abnormalities, and improving service reliability and script operation stability.

[0101] In summary, the embodiment of the present application provides a data processing method for interpreted language scripts, which sends the injection data including the rewriting of the underlying function together with the script main function to the script running end through the script data processing end, and statically injects the script main function based on the injection data at the script running end to obtain the injected script main function, so that the injected script main function will call the rewriting underlying function, and automatically collect and report the script running data through the data detection function in the rewriting underlying function; in this way, the developers at the script development end do not need to worry about how to realize the collection and reporting of script running data, but only need to devote their energy to the research and development of business needs, which can greatly reduce the development cost of the script development end; the script development end can access the script running data detection system imperceptibly by running the startup script at the script data processing end, which is very beneficial for the script data processing end to grasp the script running status in time, and can improve the stability of the script service.

[0102] The present application also provides a data processing device for an interpreted language script, which is applied to a script execution end, such as Fig.12 As shown, the data processing device 120 includes:

[0103] The acquisition module 1201 is used to acquire a script data packet; the script data packet includes a script main function and injection data, the script main function is developed by the script development end based on an interpreted language; the injection data includes a rewritten underlying function, and the rewritten underlying function includes an original underlying function and a data detection function;

[0104] The injection module 1202 is used to statically inject the script main function based on the injection data to obtain the injected script main function;

[0105] The data reporting module 1203 is used to execute the script task through the original underlying function if the call of the underlying function is triggered to be rewritten during the running of the main function of the injected script, collect the script running data generated during the execution of the script task through the data detection function, and report the script running data to the script data processing end.

[0106] In some possible embodiments, the injected data also includes a task processing function and an end data detection function; the injection module 1202 is also used to add a declaration of overriding the underlying function at the starting position of the script main function, add a task processing function, replace the variables specified by the script development end with class variables, and add a startup method for starting the injected script main function; the task processing function is used to process script running exceptions or tasks specified by the script data processing end; at the end position of the script main function, an end data detection function is added to obtain the injected script main function.

[0107] In some possible embodiments, the injection module 1202 is further used to load the variable data specified by the script development end during the startup process of the main function of the injected script; and replace the default variable data of the class variable with the specified variable data.

[0108] In some possible embodiments, the device also includes a service access control module, which is used to access a preset storage area through a task processing function; if an access restriction task written by the script data processing end is read from the preset storage area, the service address corresponding to the access restriction task is determined, and network requests to the service address are stopped or network requests are sent to the service address after a preset time period.

[0109] The present application also provides a data processing device for an interpreted language script, which is applied to a script data processing terminal, such as Fig.13 As shown, the data processing device 130 includes:

[0110] The sending module 1301 is used to send the script data packet to the script running end; the script data packet includes the script main function and injection data, the script main function is developed by the script development end based on the interpreted language; the injection data includes the rewritten underlying function, and the rewritten underlying function includes the original underlying function and the data detection function;

[0111] The receiving module 1302 is used to receive the script running data sent by the script running end; the script running data is statically injected into the script main function by the script running end based on the injection data, and is obtained through the original underlying function and the data detection function during the running process of the injected script main function.

[0112] In some possible embodiments, the device also includes a real-time statistical analysis module for obtaining specified business indicators sent by the script development end; analyzing and statistically processing the script operation data according to the specified business indicators to determine the indicator data value corresponding to the specified business indicators; and displaying the indicator data value to the script development end in a visual form.

[0113] In some possible embodiments, the sending module 1301 is also used to respond to a script publishing instruction sent by the script development end, package the script main function to be published for the first time and the injection data to form a script data packet, and send the script data packet to the script running end; or; respond to a script start instruction sent by the script development end, detect the version information of the script main function to be started; if the matching degree value between the version information and the version information of the script main function currently running on the script running end is less than a preset degree value, package the script main function to be started and the injection data to form a script data packet, and send the script data packet to the script running end.

[0114] In some possible embodiments, the script execution data includes network request data; the real-time statistical analysis module is also used to parse and process the network request data to determine the service address requested by the script execution end; obtain the current access data and restricted access data of the service address; when the current access data reaches the restricted access data, generate an access restriction task for the service address; write the access restriction task for the service address to a preset storage area; the preset storage area can be read by the script execution end.

[0115] It should be noted that the device in the device embodiment and the method embodiment are based on the same inventive concept.

[0116] An embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement a data processing method for interpreted language scripts as provided in the above method embodiment.

[0117] Further, Fig.14 The hardware structure diagram of an electronic device for implementing the data processing method for an interpreted language script provided in an embodiment of the present application is shown. The electronic device may participate in constituting or include the data processing device for an interpreted language script provided in an embodiment of the present application. Fig.14 As shown, the electronic device 100 may include one or more (1002a, 1002b, ..., 1002n are used to illustrate) processors 1002 (the processor 1002 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1004 for storing data, and a transmission device 1006 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. For example, the electronic device 100 may also include more than Fig.14 More or fewer components as shown, or with Fig.14 Different configurations shown.

[0118] It should be noted that the one or more processors 1002 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the electronic device 100 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0119] The memory 1004 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the data processing method for interpreted language scripts described in the embodiments of the present application. The processor 1002 executes various functional applications and data processing by running the software programs and modules stored in the memory 1004, that is, realizing the above-mentioned data processing method for interpreted language scripts. The memory 1004 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1004 may further include a memory remotely arranged relative to the processor 1002, and these remote memories may be connected to the electronic device 100 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0120] The transmission device 1006 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the electronic device 100. In one example, the transmission device 1006 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one embodiment, the transmission device 1006 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.

[0121] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 100 (or mobile device).

[0122] An embodiment of the present application also provides a computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to a data processing method for interpreted language scripts in an implementation method embodiment, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data processing method for interpreted language scripts provided in the above-mentioned method embodiment.

[0123] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0124] An embodiment of the present application further provides a computer program, which, when executed by a processor, implements a data processing method for an interpreted language script in a method embodiment.

[0125] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of the present application are described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0126] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and electronic device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0127] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0128] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A data processing method for an interpreted language script, characterized in that: Applied to the script running end, the method includes: Acquire a script data packet; the script data packet includes a script main function and injection data, the script main function is developed by the script development end based on an interpreted language; the injection data includes a rewritten underlying function, the rewritten underlying function includes an original underlying function and a data detection function; Perform static injection on the script main function based on the injection data to obtain the injected script main function; During the running process of the injected script main function, if the call of the rewritten underlying function is triggered, the script task is executed through the original underlying function, the script running data generated during the execution of the script task is collected through the data detection function, and the script running data is reported to the script data processing end.

2. The data processing method for interpreted language script according to claim 1, characterized in that: The injected data also includes a task processing function and an end data detection function; the script main function is statically injected based on the injected data to obtain the injected script main function, including: At the start position of the script main function, a declaration of using the rewritten underlying function is added, the task processing function is added, the variables specified by the script development end are replaced with class variables, and a startup method for starting the injected script main function is added; the task processing function is used to process script running abnormalities or tasks specified by the script data processing end; At the termination position of the script main function, the end data detection function is added to obtain the injected script main function.

3. The data processing method for interpreted language script according to claim 2, characterized in that: The method further comprises: During the startup process of the injected script main function, loading the variable data specified by the script development end; Replace the default variable data of the class variable with the specified variable data.

4. The data processing method for interpreted language script according to claim 2, characterized in that: The method further comprises: Accessing a preset storage area through the task processing function; If the access restriction task written by the script data processing end is read from the preset storage area, the service address corresponding to the access restriction task is determined, and network requests to the service address are stopped or network requests are sent to the service address after a preset time period.

5. A data processing method for an interpreted language script, characterized in that: Applied to the script data processing end, the method includes: Sending a script data packet to a script running end; the script data packet includes a script main function and injection data, the script main function is developed by the script development end based on an interpreted language; the injection data includes a rewritten underlying function, the rewritten underlying function includes an original underlying function and a data detection function; Receive script running data sent by the script running end; the script running data is statically injected into the script main function by the script running end based on the injection data, and is obtained through the original underlying function and the data detection function during the running process of the injected script main function.

6. The data processing method for interpreted language script according to claim 5, characterized in that: The method further comprises: Obtaining the specified business indicator sent by the script development end; Analyze and statistically process the script running data according to the specified business indicator to determine the indicator data value corresponding to the specified business indicator; The indicator data value is displayed to the script development end in a visual form.

7. The data processing method for interpreted language script according to claim 5, characterized in that: The step of sending the script data packet to the script execution terminal includes: In response to the script publishing instruction sent by the script development end, the script main function published for the first time and the injection data are packaged to form the script data packet, and the script data packet is sent to the script execution end; or; In response to the script start instruction sent by the script development end, the version information of the script main function to be started is detected; if the matching degree value between the version information and the version information of the script main function currently running on the script running end is less than a preset degree value, the script main function to be started and the injection data are packaged to form the script data packet, and the script data packet is sent to the script running end.

8. The data processing method for interpreted language script according to claim 5, characterized in that: The script execution data includes network request data; the method further includes: Parsing the network request data to determine the service address requested by the script execution end; Obtaining current access data and restricted access data of the service address; When the current access data reaches the restricted access data, generating an access restriction task for the service address; The access restriction task of the service address is written into a preset storage area; the preset storage area can be read by the script execution end.

9. A data processing device for an interpreted language script, characterized in that: Applied to the script running end, the device comprises: An acquisition module is used to acquire a script data packet; the script data packet includes a script main function and injection data, the script main function is developed by the script development end based on an interpreted language; the injection data includes a rewritten underlying function, the rewritten underlying function includes an original underlying function and a data detection function; An injection module, used for statically injecting the script main function based on the injection data to obtain the injected script main function; A data reporting module is used to, during the running process of the injected script main function, if the call of the rewritten underlying function is triggered, execute the script task through the original underlying function, collect the script running data generated during the execution of the script task through the data detection function, and report the script running data to the script data processing end.

10. A data processing device for an interpreted language script, characterized in that: Applied to a script data processing end, the device comprises: A sending module, used for sending a script data packet to a script running end; the script data packet includes a script main function and injection data, the script main function is developed by the script development end based on an interpreted language; the injection data includes a rewritten underlying function, the rewritten underlying function includes an original underlying function and a data detection function; A receiving module is used to receive script running data sent by the script running end; the script running data is statically injected into the script main function by the script running end based on the injection data, and is obtained through the original underlying function and the data detection function during the running process of the injected script main function.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the data processing method for interpreted language scripts according to any one of claims 1 to 8.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data processing method for interpreted language scripts according to any one of claims 1 to 8.

13. A computer program, characterized in that When the computer program is executed by a processor, the data processing method for an interpreted language script according to any one of claims 1 to 8 is implemented.