Engineering package creation method, electronic equipment and storage medium
By automatically creating monitoring project packages through user input, the problem of low configuration efficiency and high labor costs of the monitoring platform in the front-end project is solved. It realizes automated access and consistent configuration, and improves system stability and management efficiency.
Patent Information
- Application Number
- CN202510811469.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-11-14
AI Technical Summary
In existing technologies, the configuration efficiency of monitoring platforms in front-end engineering is low, the labor cost is high, and the consistency and stability of configuration are difficult to guarantee. In particular, the management is complex in a multi-tenant environment, and manual operation is prone to errors.
By allowing users to input runtime environment information and initialization parameters in the parameter settings interface, a monitoring project package is automatically created, enabling automated access to the monitoring platform, reducing manual configuration, and ensuring code standardization and configuration consistency.
It improves configuration efficiency, reduces labor costs, ensures code standardization and system stability, reduces the risk of human error, and supports automated management in multi-tenant environments.
Smart Images

Figure CN120950322A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more particularly to a method for creating engineering packages, electronic devices, and storage media. Background Technology
[0002] In front-end engineering, to monitor and collect front-end exceptions and errors, it is usually necessary to connect the front-end to a monitoring platform and report front-end exceptions and errors to the monitoring platform. For example, the monitoring platform could be the Sentry platform.
[0003] To enable front-end integration with a monitoring platform, developers typically need to manually configure each tenant individually. However, this approach suffers from low configuration efficiency and high labor costs. Summary of the Invention
[0004] This application provides a method for creating engineering packages, an electronic device, and a storage medium, which can improve configuration efficiency and reduce labor costs.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, this application provides a method for creating a project package. The method includes: responding to user input on a parameter setting interface, determining runtime environment information, including the client's technology stack type and environment variable type; based on the runtime environment information, obtaining initialization parameters from a server, the initialization parameters indicating the association between the client and the monitoring platform in the environment variable type, the initialization parameters including a tenant identifier and a project identifier, the tenant identifier uniquely corresponding to the project identifier, the tenant identifier uniquely identifying the client in the environment variable type, and the project identifier indicating the project in the monitoring platform corresponding to the tenant identifier; and automatically creating a monitoring project package based on the runtime environment information and the initialization parameters, the monitoring project package monitoring erroneous operations occurring on clients that have installed the monitoring project package, and reporting relevant information about the erroneous operations to the monitoring platform.
[0007] The method for creating a monitoring project package provided in the first aspect of this application can automatically create the monitoring project package by simply having the user input parameters in the parameter setting interface. This enables automated access to the monitoring platform, eliminating the need for developers to manually configure each tenant individually, thus improving configuration efficiency and reducing labor costs. Furthermore, the method eliminates the need for manual code modifications during the creation of the monitoring project package, ensuring consistency in code standards and configurations, reducing human errors caused by manual configuration, and thereby improving development efficiency and system stability.
[0008] In conjunction with the first aspect above, in one possible implementation, obtaining initialization parameters from the server based on runtime environment information includes: sending a first request message to the server, the first request message being used to obtain the association between the client and the monitoring platform in the environment variable type, the first request message including the environment variable type; and receiving a first response message sent by the server, the first response message including the initialization parameters.
[0009] In conjunction with the first aspect mentioned above, in one possible implementation, a monitoring project package is automatically created based on runtime environment information and initialization parameters. This includes: inserting runtime environment information and initialization parameters into the initial code through a build tool plugin to obtain the inserted code; parsing the inserted code into an abstract syntax tree; restoring the abstract syntax tree into standardized code; and compiling the standardized code to obtain the monitoring project package.
[0010] In conjunction with the first aspect mentioned above, in one possible implementation, the initialization parameters also include a first hash value of the project identifier, which is calculated using a hash function; before automatically creating the monitoring project package based on the runtime environment information and the initialization parameters, the method further includes: calculating a second hash value of the project identifier using a hash function; and confirming that the initialization parameters are correct in response to the first hash value being the same as the second hash value.
[0011] In conjunction with the first aspect mentioned above, in one possible implementation, the technology stack type includes the React type and the Vue type; the process of determining the technology stack type includes: in response to the user's input operation on the parameter setting interface regarding the technology stack type, determining the client's technology stack type.
[0012] In conjunction with the first aspect above, in one possible implementation, the environment variable types include development environment, testing environment, and production environment; the process of determining the environment variable type includes: determining the client's environment variable type in response to the user's input operation on the parameter setting interface regarding the environment variable type.
[0013] In conjunction with the first aspect mentioned above, in one possible implementation, the runtime environment information further includes a sampling rate and / or a log collection strategy. The sampling rate is used to indicate the proportion of erroneous operations recorded by the monitoring platform, and the log collection strategy is used to indicate that the monitoring platform records error logs generated by erroneous operations with an error level of a preset error level. The method further includes: determining the client's sampling rate in response to the user's input of the sampling rate on the parameter setting interface; and / or, determining the client's log collection strategy in response to the user's input of the log collection strategy on the parameter setting interface.
[0014] In conjunction with the first aspect mentioned above, in one possible implementation, after automatically creating the monitoring project package based on the runtime environment information and initialization parameters, the method further includes: in response to the client's error generation command, obtaining the error log generated by the error generation command in the monitoring platform; and in response to the error log being the same as the preset error log, confirming that the monitoring project package is normal.
[0015] Secondly, this application provides a project package creation device, comprising: a determining unit, configured to determine operating environment information in response to user input on a parameter setting interface, the operating environment information including the client's technology stack type and environment variable type; an obtaining unit, configured to obtain initialization parameters from a server based on the operating environment information, the initialization parameters indicating the association between the client and the monitoring platform in the environment variable type, the initialization parameters including a tenant identifier and a project identifier, the tenant identifier uniquely corresponding to the project identifier, the tenant identifier uniquely identifying the client in the environment variable type, and the project identifier indicating the project in the monitoring platform corresponding to the tenant identifier; and a creation unit, configured to automatically create a monitoring project package based on the operating environment information and the initialization parameters, the monitoring project package monitoring erroneous operations occurring on clients that have installed the monitoring project package, and reporting relevant information about the erroneous operations to the monitoring platform.
[0016] In conjunction with the second aspect above, in one possible implementation, the acquisition unit is used to: send a first request message to the server, the first request message being used to acquire the association between the client and the monitoring platform in the environment variable type, the first request message including the environment variable type; and receive a first response message sent by the server, the first response message including initialization parameters.
[0017] In conjunction with the second aspect above, in one possible implementation, the creation unit is used to: insert runtime environment information and initialization parameters into the initial code through a build tool plugin to obtain the inserted code; parse the inserted code into an abstract syntax tree; restore the abstract syntax tree to standardized code, and then compile the standardized code to obtain a monitoring project package.
[0018] In conjunction with the second aspect above, in one possible implementation, the initialization parameters further include a first hash value of the item identifier, which is calculated by a hash function; the device further includes: a processing unit for calculating a second hash value of the item identifier using a hash function; and a comparison unit for confirming that the initialization parameters are correct in response to the first hash value being the same as the second hash value.
[0019] In conjunction with the second aspect above, in one possible implementation, the technology stack type includes the React type and the Vue type; the process of determining the technology stack type includes: in response to the user's input operation on the parameter setting interface regarding the technology stack type, determining the client's technology stack type.
[0020] In conjunction with the second aspect above, in one possible implementation, the environment variable types include development environment, testing environment, and production environment; the process of determining the environment variable type includes: determining the client's environment variable type in response to the user's input operation on the parameter setting interface.
[0021] In conjunction with the second aspect above, in one possible implementation, the operating environment information further includes a sampling rate and / or a log collection strategy. The sampling rate is used to indicate the proportion of erroneous operations recorded by the monitoring platform, and the log collection strategy is used to indicate that the monitoring platform records error logs generated by erroneous operations with an error level of a preset error level. The device further includes: a second determining unit, used to determine the client's sampling rate in response to the user's input operation on the parameter setting interface for the sampling rate; and / or, a third determining unit, used to determine the client's log collection strategy in response to the user's input operation on the parameter setting interface for the log collection strategy.
[0022] In conjunction with the second aspect above, in one possible implementation, the device further includes: a second acquisition unit, configured to acquire error logs generated by error generation instructions in the monitoring platform in response to error generation instructions from the client; and a second comparison unit, configured to confirm that the monitoring project package is normal in response to error logs being the same as preset error logs.
[0023] Thirdly, this application provides an electronic device comprising: a processor and a communication interface; the communication interface and the processor are coupled, the processor being configured to run computer programs or instructions to implement the engineering package creation method as described in the first aspect and any possible implementation thereof.
[0024] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on a terminal, cause the terminal to perform the project package creation method as described in the first aspect and any possible implementation thereof.
[0025] Fifthly, this application provides a computer program product containing instructions that, when run on a package creation apparatus, cause the package creation apparatus to perform the package creation method as described in the first aspect and any possible implementation thereof.
[0026] In a sixth aspect, this application provides a chip comprising: a processor and a memory configured to store processor-executable instructions; wherein the processor is configured to execute the instructions to implement the engineering package creation method as described in the first aspect and any possible implementation thereof.
[0027] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of the device, or it may be packaged separately from the processor of the device; this application does not impose any limitation on this.
[0028] In a seventh aspect, this application provides a project package creation system, comprising: a project package creation apparatus and a server, wherein the project package creation apparatus is used to execute the project package creation method as described in the first aspect and any possible implementation thereof.
[0029] The descriptions of aspects two through seven in this application can be referenced to the detailed description of aspect one; and the beneficial effects of the descriptions of aspects two through seven can be referenced to the analysis of the beneficial effects of aspect one, which will not be repeated here.
[0030] In this application, the name of the aforementioned engineering package creation device does not limit the equipment or functional module itself. In actual implementation, these equipment or functional modules may appear under other names. As long as the function of each equipment or functional module is similar to that of this application, it falls within the scope of the claims of this application and its equivalents.
[0031] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0032] Figure 1 This application provides an architectural diagram of an engineering package creation system.
[0033] Figure 2 A flowchart illustrating a method for creating an engineering package, as provided in this application embodiment;
[0034] Figure 3 A flowchart for calculating a project identifier is provided as an embodiment of this application;
[0035] Figure 4 This is a schematic diagram illustrating different sampling rates for different types of environmental variables, provided as an embodiment of this application.
[0036] Figure 5 A flowchart illustrating another method for creating a project package provided in this application embodiment;
[0037] Figure 6This application provides a schematic diagram of the module division of an engineering package creation system according to an embodiment of the present application.
[0038] Figure 7 This is a schematic diagram of the structure of an engineering package creation device provided in an embodiment of this application;
[0039] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0040] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0041] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0042] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0043] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0044] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0045] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0046] In front-end engineering, to monitor and collect front-end exceptions and errors, it is usually necessary to connect the front-end to a monitoring platform and report front-end exceptions and errors to the monitoring platform. For example, the monitoring platform could be the Sentry platform.
[0047] In the process of enabling front-end access to the monitoring platform, the configuration of projects in the monitoring platform still largely relies on manual operation.
[0048] Developers need to manually configure the toolchain, meaning they must manually complete a series of operations to achieve basic configuration. For example, they need to write code style guidelines line by line to ensure consistency and maintainability; and manually configure the project. In terms of configuration efficiency, because toolchain configuration relies on manual installation and requires writing configuration files for each item, when multiple projects exist, the coding operations must be repeated, making the entire process cumbersome and complex. This not only results in low configuration efficiency but also increases the risk of human error. Furthermore, because code style guidelines need to be written manually, inconsistent coding styles among different developers can lead to version differences, and the lack of a unified standard for project configuration makes it difficult to ensure configuration consistency.
[0049] While developers can use basic scaffolding tools to provide templates for project initialization, helping them quickly build the basic structure of a project, these templates offer relatively limited functionality and lack end-to-end integration capabilities. This means that developers still need to handle many integration issues themselves during the subsequent development process, making it impossible to automate the entire process from development to deployment.
[0050] Projects on the monitoring platform require manual connection. Developers need to log in to the third-party monitoring platform, manually create projects, and complete the corresponding configurations according to the project's specific needs. This process is not only complex but also inefficient.
[0051] In addition, each tenant needs to maintain its own codebase, which not only leads to redundant waste of resources, but also makes project management and monitoring more complicated in a multi-tenant environment, increasing management costs and difficulty, and providing insufficient support for multi-tenancy.
[0052] When developers need to switch environment variable types, they must manually modify the code to switch between development, testing, and production environments. This manual approach increases the coupling of environment configurations, making it highly susceptible to omissions or conflicts, and even affecting the stability and reliability of the system.
[0053] Therefore, the project package creation method provided in this application can automatically create monitoring project packages by having the user input parameters in the parameter setting interface. This enables automated access to the monitoring platform, eliminating the need for developers to manually configure each tenant individually. This improves configuration efficiency, reduces labor costs, and allows for automatic creation of monitoring project packages simply by inputting parameters in the parameter setting interface. No code modifications are required during this process, ensuring consistency in code standards and configurations, reducing human errors caused by manual configuration, and thus improving development efficiency and system stability.
[0054] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0055] It should be noted that the various embodiments of this application can be referenced or learned from each other. For example, the same or similar steps, method embodiments, system embodiments and device embodiments can be referenced from each other without limitation.
[0056] Figure 1 This is a schematic diagram of the architecture of an engineering package creation system provided in an embodiment of this application. Figure 1 As shown, the architecture includes: client 101 and server 102.
[0057] Client 101 can be at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, virtual reality terminal, augmented reality terminal, wireless terminal, and laptop computer. This application embodiment does not limit this.
[0058] In some embodiments, the client 101 can display a parameter setting interface through a visual interface. For example, the parameter setting interface displays the client's technology stack type and environment variable type, which the user can select. Alternatively, the user can input the technology stack type and environment variable type according to prompts in the parameter setting interface.
[0059] In some embodiments, client 101 may determine runtime environment information in response to user input on the parameter setting interface.
[0060] The runtime environment information includes the client's technology stack type and environment variable type.
[0061] In some embodiments, client 101 has communication capabilities. For example, client 101 obtains initialization parameters through communication with server 102.
[0062] The initialization parameters are used to indicate the association between the client and the monitoring platform in the environment variable type. The initialization parameters include the tenant identifier and the project identifier.
[0063] In some embodiments, client 101 has processing capabilities. For example, client 101 can automatically create a monitoring project package based on runtime environment information and initialization parameters.
[0064] The monitoring package is used to monitor erroneous operations that occur on clients that have the monitoring package installed, and to report relevant information about the erroneous operations to the monitoring platform.
[0065] Server 102 is an independent physical server, a server cluster composed of multiple physical servers, a distributed file system, or at least one of the following cloud servers providing basic cloud computing services: cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. Of course, the above is merely an exemplary description of server 102; server 102 can also be a relational database management system and / or a database based on distributed file storage, and this application embodiment does not limit this. For example, the relational database management system can be MySQL, Oracle Database, or Microsoft SQL Server; the database based on distributed file storage can be MongoDB, HBase, or Cassandra.
[0066] In some embodiments, server 102 has communication capabilities. For example, server 102 sends initialization parameters to client 101.
[0067] The server 102 can be one or more, and this embodiment of the application does not limit this. For ease of understanding, Figure 1 Only one is shown here. Of course, server 102 can also include other functional servers to provide a more comprehensive and diverse range of services.
[0068] Client 101 and server 102 are connected via a communication link. This communication link can be a wired communication link or a wireless communication link, and this embodiment of the application does not limit it.
[0069] Figure 2 This is a flowchart illustrating a method for creating a project package, as provided in an embodiment of this application. Figure 2 As shown, the method includes the following steps S201-S203.
[0070] S201. The client responds to the user's input operation in the parameter setting interface and determines the operating environment information.
[0071] The runtime environment information includes the client's technology stack type and environment variable type.
[0072] In one possible implementation, the technology stack types include React and Vue.
[0073] React and Vue are the two mainstream JavaScript libraries / frameworks used in front-end development.
[0074] The type of technology stack can be determined in the following ways.
[0075] In response to the user's input of the technology stack type on the parameter settings interface, the client's technology stack type is determined.
[0076] For example, the client may have a command-line interface (CLI) installed, or the client may have integrated the functionality of creating monitoring project packages through parameter settings into the CLI. When the client is running the CLI, a parameter settings interface is displayed. This interface offers two options: React and Vue. Users can select the appropriate option to determine the client's technology stack.
[0077] For example, the parameter settings interface may display a prompt for inputting the technology stack type. Based on this prompt, the user enters the technology stack type in the parameter settings interface. The client's technology stack type is then determined based on the user's input. The technology stack type entered in the parameter settings interface can be the name of the technology stack type or a pre-defined field corresponding to a pre-set technology stack type.
[0078] In this way, by having the user input the technology stack type in the parameter settings interface, the client's technology stack type can be clearly identified, making it easier to select the appropriate build tool based on the technology stack type, and then generate the corresponding monitoring project package.
[0079] In one possible implementation, the environment variable types include development environment, testing environment, and production environment.
[0080] The development environment refers to the local development environment used by developers, providing them with an environment for writing and debugging code. The testing environment refers to the internal testing environment after development is completed, used to verify and monitor the functionality and performance of the project package. The production environment refers to the external environment used by tenants, providing stable services to them.
[0081] The type of this environment variable can be determined in the following ways.
[0082] In response to the user's input of environment variable types on the parameter settings interface, determine the client's environment variable types.
[0083] For example, the client displays a parameter settings interface, which offers three options: development environment, testing environment, and production environment. Users can make their selections in the parameter settings interface, and the type of environment variables on the client is determined based on the user's choice.
[0084] For example, the parameter settings interface may display a prompt for inputting environment variable types. Based on this prompt, the user enters the environment variable type in the parameter settings interface. The client's environment variable type is determined based on the user's input. The environment variable type entered in the parameter settings interface can be the name of the environment variable type or a preset field corresponding to a pre-defined environment variable type. The environment variable type can be represented by ENV_MODE, with A representing the development environment, RC representing the test environment, and MASTER representing the production environment.
[0085] In this way, by having users input the environment variable type in the parameter settings interface, the client's environment variable type can be clearly identified. Developers do not need to manually modify the code to switch the environment variable type. This facilitates automatic switching between development, testing, and production environments based on different environment variable types, so as to support automatic switching of multiple environment variable types during the configuration process and reduce the risks that may be caused by manual operation.
[0086] S202. The client obtains initialization parameters from the server based on the runtime environment information.
[0087] The initialization parameters indicate the association between the client and the monitoring platform in the environment variable type. The monitoring platform can collect and record relevant information generated by client erroneous operations. For example, the monitoring platform could be the Sentry platform.
[0088] Initialization parameters include a tenant identifier and a project identifier, with each identifier uniquely corresponding to the other. The tenant identifier uniquely identifies the client within the environment variable type; the project identifier indicates the project in the monitoring platform corresponding to the tenant identifier.
[0089] When the server generates a tenant identifier, the tenant identifier can be named according to a preset rule, or the tenant identifier can be randomly generated. This application embodiment does not limit this.
[0090] For example, a tenant identifier can be a tenant's identity document (ID).
[0091] For example, the project identifier can be the data source name (DSN) of the project in the monitoring platform.
[0092] In one possible implementation, the obtained initialization parameters can be in the form of a list data collection. Tenant identifiers and project identifiers are stored as key-value pairs in this list data collection. This list data collection includes at least one set of tenant identifiers and project identifiers. Furthermore, the initialization parameters may also include information such as the Sentry service access endpoint. The Sentry service access endpoint identifies the application programming interface (API) endpoint used by the Sentry service to receive and process error operations or error logs.
[0093] For example, the list data collection could be [{id: "Project ID 1"; dsn: "sentry service access endpoint 1"; tenant_id: "Tenant ID 1"}; {id: "Project ID 2"; dsn: "sentry service access endpoint 2"; tenant_id: "Tenant ID 2"}; ...].
[0094] S203: The client automatically creates a monitoring project package based on the runtime environment information and initialization parameters.
[0095] The monitoring package is used to monitor erroneous operations that occur on clients that have the monitoring package installed, and to report relevant information about the erroneous operations to the monitoring platform.
[0096] In one possible implementation, different technology stack types correspond to different software development kits (SDKs). The client determines the corresponding SDK based on the technology stack type, and then inserts runtime environment information, tenant identifier, and project identifier into the initial code to create the monitoring project package.
[0097] The project package creation method provided in this application can automatically create monitoring project packages after the user inputs parameters in the parameter setting interface. This enables automated access to the monitoring platform, eliminating the need for developers to manually configure each tenant individually. This improves configuration efficiency, reduces labor costs, and ensures consistent code and configuration during the creation of monitoring project packages. It also reduces human error caused by manual configuration, thereby improving development efficiency and system stability.
[0098] The following is about the above. Figure 2The process of obtaining initialization parameters in S202 will be described below. As a possible embodiment of this application, the above-described S202 can also be implemented through steps 11 to 12.
[0099] Step 11: Send the first request message to the server.
[0100] The first request message is used to obtain the association between the client and the monitoring platform in the environment variable type. The first request message includes the environment variable type.
[0101] In one possible implementation, the environment variable type is located in the request header, request body, Uniform Resource Locator (URL) parameter, etc., in the first request message.
[0102] Step 12: Receive the first response message sent by the server.
[0103] The first response message includes initialization parameters.
[0104] In one possible implementation, after receiving the first request message, the server calls an interface to retrieve all initialization parameters for the corresponding environment variable type and sends them to the client as a list data set. Upon receiving this list data set, the client stores it for later use.
[0105] In this way, by sending requests and receiving responses, initialization parameters can be obtained automatically without developers having to log in to the corresponding platform to obtain them manually. The environment variable types contained in the request message can be used to avoid manually modifying the code to switch between different environment variable types. The initialization parameters can be obtained by using the environment variable types provided in the request message, which can reduce the coupling between code and configuration.
[0106] The following is about the above. Figure 2 The process of creating the monitoring project package in S203 is described below. As a possible embodiment of this application, the above-described S203 can also be implemented through steps 21 to 23.
[0107] Step 21: By using the build tool plugin, insert the runtime environment information and initialization parameters into the initial code to obtain the inserted code.
[0108] In one possible implementation, different technology stack types correspond to different SDKs. The client determines the corresponding SDK based on the technology stack type. In other words, determining the corresponding SDK is equivalent to determining the initial code needed to build the monitoring project package. Then, through a build tool plugin, runtime environment information and initialization parameters are inserted into the initial code, resulting in the inserted code.
[0109] For example, build tools could be Webpack, Rollup, Vite, etc. When adapting to different build tool plugins, predefined plugin interfaces can automatically adapt to the insertion points of different build tools, inserting runtime environment information and initialization parameters into the corresponding positions, ensuring compatibility with different project structures. For example, a predefined plugin interface could be the `injectEntryCode` interface. Similarly, the insertion points for different build tools could be Webpack's `entry`, Rollup's `input`, etc.
[0110] For example, the initial code could be the code included in a generic initialization function, i.e., the code included in the init function.
[0111] It should be noted that during the creation of the monitoring project package, the initial code can be determined after the client confirms the runtime environment information. That is, the initial code can be determined before obtaining the initialization parameters, i.e., after the client obtains the initialization parameters, by using a build tool plugin to insert the runtime environment information and initialization parameters into the already confirmed initial code; or, the initial code can be determined after obtaining the initialization parameters, i.e., after the client obtains the initialization parameters, the client determines the initial code, and the runtime environment information and initialization parameters are inserted into the initial code using a build tool plugin. This application embodiment does not limit this approach.
[0112] Step 22: Parse the inserted code into an abstract syntax tree.
[0113] One possible implementation involves using the Babel tool to parse the inserted code into an abstract syntax tree (AST). This approach can ignore the differences between different build tools and improve compatibility.
[0114] Step 23: After restoring the abstract syntax tree to standardized code, compile the standardized code to obtain the monitoring project package.
[0115] In one possible implementation, an abstract syntax tree is converted into standardized code using a code generator, enabling standardized code injection. This standardized code is then compiled to obtain the monitoring project package.
[0116] In this way, monitoring project packages can be automatically generated without developer intervention. They can adapt to different technology stacks, environment variable types, and build tools, improving compatibility and reducing the implementation cost of monitoring project packages. Furthermore, by inserting runtime environment information and initialization parameters into the initial code and ultimately generating standardized code, the process ensures code standardization and parameter configuration consistency, mitigating the risks associated with manual configuration discrepancies.
[0117] In addition, the initialization parameters may also include the first hash value of the project identifier, which is calculated using a hash function.
[0118] It should be noted that the first hash value of the project identifier can be obtained by the server using a hash function to calculate the hash of the project identifier. For example, the hash function can be SHA256, etc.
[0119] If the initialization parameters include a first hash value of the project identifier, the method may further include steps 31 to 32 before step S203 above.
[0120] Step 31: Calculate the second hash value of the project identifier using a hash function.
[0121] Figure 3 This application provides a flowchart for calculating a project identifier. Taking the project identifier as T123 and the hash function as SHA256 as an example, the process of calculating the project identifier can be as follows:
[0122] S301, The project identifier is obtained as T123.
[0123] S302, Calculate the project identifier T123 using SHA256.
[0124] S303, the second hash value of the project identifier is obtained as 8a3bc2d4.
[0125] Step 32: In response to the first hash value being the same as the second hash value, confirm that the initialization parameters are correct.
[0126] It should be noted that if the first hash value and the second hash value are the same, it means that the initialization parameters have not been tampered with during data transmission and the initialization parameters are correct; if the first hash value and the second hash value are different, it means that the initialization parameters have been tampered with during data transmission and the obtained initialization parameters are incorrect. In this case, the process of creating the project package needs to be terminated and a prompt warning should be given in the parameter setting interface.
[0127] In this way, by calculating the second hash value of the project identifier, if the first hash value is the same as the second hash value, it can be determined that the initialization parameters have not been tampered with during data transmission. That is, the project identifier obtained by the client is consistent with the project identifier sent by the server. This not only verifies the consistency and integrity of the data, but also improves the security of the project package creation system.
[0128] It should be noted that, to further ensure the security of data transmission, the initialization parameters may also include a signature of the first hash value of the project identifier. This signature can be obtained by the server encrypting the first hash value of the project identifier using its private key.
[0129] If the initialization parameters include a signature of the first hash value of the project identifier, the client verifies the signature of the first hash value of the project identifier using the public key. After verifying the signature, the first hash value of the project identifier is obtained. If the first hash value and the second hash value are the same, the initialization parameters are confirmed to be correct, indicating that the initialization parameters have not been tampered with during data transmission.
[0130] The signature verification process involves the client generating a local signature code using the public key, comparing the local signature code with the signature in the initialization parameters sent by the server, and if they match, the signature verification is successful.
[0131] The client's public key can be either sent to the client by the server when sending the first response message, or it can be pre-agreed and stored on the client.
[0132] In addition, the runtime environment information in the above-mentioned project package creation method may also include sampling rate and / or log collection strategy.
[0133] The sampling rate is used to indicate the proportion of erroneous operations recorded by the monitoring platform.
[0134] For example, the sampling rate could be 10%, 50%, etc. Or, the sampling rate could be full monitoring, sampling monitoring, etc. Full monitoring represents the proportion of erroneous operations recorded by the monitoring platform as 100%. Sampling monitoring represents the proportion of erroneous operations recorded by the monitoring platform as a fixed value, which is greater than 0 and less than 100%.
[0135] The log collection policy is used to instruct the monitoring platform to record error logs generated by erroneous operations with an error level of a preset error level.
[0136] For example, the preset error level can be fatal error, serious error, general error, minor error, etc.
[0137] In one possible implementation, different environment variable types can correspond to different sampling rates and / or log collection strategies. Once the client's environment variable types are determined, the corresponding sampling rate and / or log collection strategy can be determined.
[0138] As a concrete example, Figure 4 This diagram illustrates different sampling rates for different types of environmental variables, as provided in an embodiment of this application. Figure 4 As shown, the sampling rate is determined by the input operation of the environment variable type. Specifically, when the environment variable type is production environment, the corresponding sampling rate can be full monitoring; when the environment variable type is test environment, the corresponding sampling rate can be sampling monitoring; and when the environment variable type is development environment, the corresponding sampling rate can be sampling monitoring.
[0139] Thus, for the production environment, the users are primarily tenants. To ensure normal use and a good user experience for tenants, any erroneous operations performed by tenants in the production environment are promptly recorded to the monitoring platform through full monitoring. This allows developers or operations personnel to troubleshoot and fix problems based on the monitoring platform's records, improving the user experience. For the development and testing environments, the users are primarily internal company personnel. Typically, sampling monitoring is used to record erroneous operations during debugging to the monitoring platform, and problems are then fixed based on these records.
[0140] In another possible implementation, the sampling rate and / or log collection strategy can be determined by user input in the parameter settings interface.
[0141] For example, taking the runtime environment information, including the sampling rate and log collection strategy, as an example, the above method also includes steps 41 to 42.
[0142] Step 41: In response to the user's input of the sampling rate on the parameter setting interface, determine the client's sampling rate.
[0143] For example, the client displays a parameter settings interface, in which multiple sampling rate options can be set. Users can select from these options to determine the client's sampling rate.
[0144] For example, the parameter settings interface may display a prompt for sampling rate input. The user enters the sampling rate based on this prompt. The client's sampling rate is then determined based on the user-input sampling rate. The sampling rate entered in the parameter settings interface can be a specific numerical value or a preset field corresponding to different sampling rates.
[0145] In this way, by determining the sampling rate through input operations in the parameter setting interface, the amount of data to be reported can be determined according to the user's needs, avoiding repeated reporting of the same error, reducing communication overhead, saving resources, and preventing higher priority errors from being overwritten. Furthermore, the required sampling rate may differ for different types of environment variables, and by determining the sampling rate, different needs under different types of environment variables can be adapted.
[0146] Step 42: In response to the user's input on the log collection strategy in the parameter setting interface, determine the client's log collection strategy.
[0147] For example, the client displays a parameter settings interface, in which multiple log collection strategy options can be set. Users can select from these options to determine the client's log collection strategy.
[0148] For example, the parameter settings interface may display a prompt for entering a log collection strategy. Based on this prompt, the user enters their log collection strategy in the parameter settings interface. The client's log collection strategy is then determined according to the user's input.
[0149] In this way, by determining the log collection strategy through input operations in the parameter setting interface, error logs can be recorded in the monitoring platform according to user needs, reducing unnecessary log recording and log storage overhead, and making it easier for developers to quickly locate problems based on error logs with different preset error levels.
[0150] Furthermore, after S203, the method may also include steps 51 to 52.
[0151] Step 51: In response to the error generation command from the client, obtain the error log generated by the error generation command in the monitoring platform.
[0152] For example, an error generation instruction could simulate a failed HTTP request during normal tenant usage. In response to the HTTP request failure, the system retrieves the error log generated by this error generation instruction from the monitoring platform via the corresponding interface.
[0153] Step 52: If the error log is the same as the preset error log, confirm that the monitoring project package is normal.
[0154] For example, a preset error log can include preset error types, preset error levels, and preset error descriptions. By comparing the error type, error level, and error description in the error log, if the error type is a preset error type, the error level is a preset error level, and the error description is a preset error description, then the monitoring project package is determined to be normal.
[0155] It should be noted that if the error log is different from the preset error log, it indicates that the monitoring project package is abnormal. That is, the preset error log cannot be generated based on the monitoring project package, the monitoring project package fails to build, and needs to be debugged again.
[0156] Furthermore, error generation commands can be generated in multiple clients, simulating development, testing, and production environments respectively; it can also simulate multiple clients generating different error generation commands under the same environment variable type. By simulating a multi-tenant scenario, the system verifies whether the monitoring project package functions correctly under multi-tenancy and different environment variable types.
[0157] In this way, by generating error instructions, the monitoring project packages under different environment variable types can be verified to be normal and effective independently. This can be done without manual modification at the code level, and different environment variable types will not interfere with each other. Independent sandbox verification ensures the reliability of the monitoring project packages to be released.
[0158] Understandably, steps 51 and 52 above are the client's verification of the monitoring package after installation. To ensure the integrity of the monitoring package and prevent local tampering, after installation, the signature of the first hash value of the project identifier in the monitoring package can also be verified. After verifying the signature using the public key, the first hash value of the project identifier is obtained. A successful signature verification confirms the monitoring package is correct.
[0159] In addition, to further ensure the security of the monitoring package, a third hash value of the project identifier in the monitoring package can be obtained by hashing the project identifier using a hash function. If the first hash value and the third hash value are the same, the monitoring package is confirmed to be correct.
[0160] Figure 5 A flowchart illustrating another method for creating a project package as provided in this application embodiment. For example... Figure 5 As shown, this method can be implemented through S501 to S514.
[0161] S501: The client responds to the user's input on the parameter setting interface regarding the technology stack type and determines the client's technology stack type.
[0162] S502. The client responds to the user's input of environment variable types on the parameter setting interface and determines the client's environment variable types.
[0163] S503, The client sends the first request message to the server.
[0164] The first request message includes the environment variable type.
[0165] Accordingly, the server receives the first request message.
[0166] S504. The server determines the tenant identifier and project identifier based on the first request message.
[0167] The tenant identifier and project identifier can be in the form of a list data collection.
[0168] S505. The server calculates the first hash value of the project identifier using a hash function, and encrypts the first hash value of the project identifier using a private key to obtain the signature of the first hash value of the project identifier.
[0169] S506, The server sends the first response message to the client.
[0170] The first response message includes initialization parameters, which include the tenant identifier, the project identifier, the first hash value of the project identifier, and the signature of the first hash value of the project identifier.
[0171] Accordingly, the client receives the first response message.
[0172] S507. The client verifies the signature of the first hash value of the project identifier using the public key, and obtains the first hash value of the project identifier.
[0173] S508. The client calculates the second hash value of the project identifier using a hash function.
[0174] S509: The client responds that the first hash value and the second hash value are the same, confirming that the initialization parameters are correct.
[0175] S510: The client inserts runtime environment information, tenant identifier, and project identifier into the initial code through the build tool plugin, resulting in the inserted code.
[0176] By inserting runtime environment information and list data sets into the initial code, configuration isolation between tenants can be achieved in multi-tenant scenarios. After creating a monitoring project package, monitoring projects can be automatically allocated. Moreover, when there are multiple tenants, only the same codebase needs to be maintained, avoiding codebase redundancy.
[0177] S511, The client parses the inserted code into an abstract syntax tree.
[0178] S512. After the client restores the abstract syntax tree to standardized code, it compiles the standardized code to obtain the monitoring project package.
[0179] S513. After the monitoring project package is installed on the client, in response to the client's error generation command, the error log generated by the error generation command in the monitoring platform is obtained.
[0180] S514. The client's response in the error log is the same as the preset error log, confirming that the monitoring project package is normal.
[0181] Furthermore, after confirming that the monitoring package is functioning correctly, it can be packaged into the product package and released together with the product package. Tenants can then install the product package to provide the corresponding services. When a tenant installs the product package, that is, the tenant installs the monitoring package, the URL used by the tenant during the service provision process includes a tenant identifier. The tenant identifier is determined based on the tenant's URL. The tenant identifier uniquely identifies the project identifier. After a tenant generates an error, the corresponding project in the monitoring platform is determined based on the project identifier. An error log corresponding to the tenant's error generation operation is generated under that project, and this error log can be viewed through the monitoring platform.
[0182] The project package creation method provided in this application embodiment can achieve automated creation of the monitoring project package by user input operations on the parameter configuration interface, from obtaining initialization parameters to inserting runtime environment information and initialization parameters into the initial code, and then to the monitoring project package creation, without manual configuration. It can realize the adaptation of the monitoring project package to different environment variable types and adapt to multi-tenant scenarios.
[0183] In this embodiment, the project package creation system can be divided into functional modules according to the project package creation process shown in the above method embodiments. For example, Figure 6 This is a schematic diagram illustrating the module division of an engineering package creation system provided in an embodiment of this application. For example... Figure 6 As shown, the project package creation system can be divided into an input perception layer, a rule generation layer, and an execution injection layer.
[0184] The input perception layer is used to determine the operating environment information.
[0185] The input awareness layer includes an instruction parsing module. This module parses user input in the parameter setting interface to determine the technology stack type, environment variable type, sampling rate, and log collection strategy.
[0186] The rule generation layer is used to determine the SDK and obtain initialization parameters.
[0187] The rule generation layer includes a dynamic rule engine and a monitoring topology generator. The dynamic rule engine can determine the corresponding SDK based on a given technology stack type. The monitoring topology generator can obtain initialization parameters by sending a first request message to the server and receiving a first response message from the server.
[0188] The injection layer is used to create a monitoring project package.
[0189] The execution injection layer includes a configuration implicit write module. This module automatically creates a monitoring project package based on runtime environment information and initialization parameters.
[0190] This application embodiment can divide the engineering package creation device into functional modules or functional units according to the above method example. For example, each function can be divided into a separate functional module or functional unit, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or in software functional modules or functional units. The module or unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0191] Figure 7 This is a schematic diagram of a project package creation device 70 provided in an embodiment of this application. The project package creation device 70 includes: a determining unit 701, used to determine operating environment information in response to user input operations on a parameter setting interface, the operating environment information including the client's technology stack type and environment variable type; an obtaining unit 702, used to obtain initialization parameters from a server based on the operating environment information, the initialization parameters indicating the association between the client and the monitoring platform in the environment variable type, the initialization parameters including a tenant identifier and a project identifier, the tenant identifier uniquely corresponding to the project identifier, the tenant identifier uniquely identifying the client in the environment variable type, and the project identifier indicating the project in the monitoring platform corresponding to the tenant identifier; and a creation unit 703, used to automatically create a monitoring project package based on the operating environment information and the initialization parameters, the monitoring project package being used to monitor erroneous operations occurring on the client that has installed the monitoring project package, and to report relevant information of the erroneous operations to the monitoring platform.
[0192] In one possible implementation, the acquisition unit 702 is configured to: send a first request message to the server, the first request message being used to acquire the association between the client and the monitoring platform in the environment variable type, the first request message including the environment variable type; and receive a first response message sent by the server, the first response message including initialization parameters.
[0193] In one possible implementation, the creation unit 703 is used to: insert runtime environment information and initialization parameters into the initial code through a build tool plugin to obtain the inserted code; parse the inserted code into an abstract syntax tree; restore the abstract syntax tree to standardized code, and then compile the standardized code to obtain a monitoring project package.
[0194] In one possible implementation, the initialization parameters further include a first hash value of the item identifier, which is calculated by a hash function; the device further includes: a processing unit for calculating a second hash value of the item identifier using a hash function; and a comparison unit for confirming that the initialization parameters are correct in response to the first hash value being the same as the second hash value.
[0195] In one possible implementation, the technology stack type includes React and Vue types; the process of determining the technology stack type includes: in response to the user's input operation on the parameter setting interface regarding the technology stack type, determining the client's technology stack type.
[0196] In one possible implementation, the environment variable types include development environment, testing environment, and production environment; the process of determining the environment variable type includes: determining the client's environment variable type in response to the user's input operation on the parameter setting interface.
[0197] In one possible implementation, the runtime environment information further includes a sampling rate and / or a log collection strategy. The sampling rate indicates the proportion of erroneous operations recorded by the monitoring platform, and the log collection strategy indicates the monitoring platform to record error logs generated by erroneous operations with an error level of a preset error level. The device further includes: a second determining unit, used to determine the client's sampling rate in response to a user's input of the sampling rate on the parameter setting interface; and / or, a third determining unit, used to determine the client's log collection strategy in response to a user's input of the log collection strategy on the parameter setting interface.
[0198] In one possible implementation, the device further includes: a second acquisition unit, configured to acquire error logs generated by error generation instructions in the monitoring platform in response to error generation instructions from the client; and a second comparison unit, configured to confirm that the monitoring project package is normal in response to error logs being the same as preset error logs.
[0199] When implemented in hardware, this application also provides an electronic device for executing the project package creation method shown in the above method embodiments.
[0200] Specifically, Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, the electronic device includes at least one processor 801, a communication line 802, and at least one communication interface 804, and may also include a memory 803. The processor 801, memory 803, and communication interface 804 are connected via the communication line 802.
[0201] The processor 801 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).
[0202] Communication line 802 may include a path for transmitting information between the aforementioned components.
[0203] The communication interface 804 is used to communicate with other devices or communication networks. It can use any transceiver-like device, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.
[0204] The memory 803 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of including or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0205] In one possible design, the memory 803 can exist independently of the processor 801, meaning the memory 803 can be an external memory of the processor 801. In this case, the memory 803 can be connected to the processor 801 via a communication line 802 to store execution instructions or application code, and its execution is controlled by the processor 801 to implement the project package creation method provided in the following embodiments of this application. In another possible design, the memory 803 can also be integrated with the processor 801, meaning the memory 803 can be an internal memory of the processor 801. For example, the memory 803 can be a cache, used to temporarily store some data and instruction information.
[0206] As one possible implementation, processor 801 may include one or more CPUs, for example Figure 8 CPU0 and CPU1 in the example. As another possible implementation, the electronic device may include multiple processors, such as... Figure 8 The processors 801 and 807 are included.
[0207] As another possible implementation, the electronic device may also include output devices 805, such as various types of displays, speakers, etc.; and input devices 806, such as keyboards, mice, etc.
[0208] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0209] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the project package creation method described in the above method embodiments.
[0210] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the project package creation method in the method flow shown in the above method embodiments.
[0211] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires; portable computer disks; hard disks; random access memory (RAM); read-only memory (ROM); erasable programmable read-only memory (EPROM); registers; hard disks; optical fibers; compact disc read-only memory (CD-ROM); optical storage devices; magnetic storage devices; or any suitable combination thereof; or any other form of computer-readable storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0212] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard parts (ASSPs), systems-on-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0213] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0214] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user, such as a cathode ray tube (CRT) or liquid crystal display (LCD) monitor; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).
[0215] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0216] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0217] Since the engineering package creation apparatus, computer-readable storage medium, and computer program product in the embodiments of this application can be applied to the above method, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0218] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0219] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0220] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
[0221] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0222] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0223] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for creating a project package, characterized in that, The method includes: In response to user input on the parameter setting interface, the runtime environment information is determined, including the client's technology stack type and environment variable type. Based on the operating environment information, initialization parameters are obtained from the server. The initialization parameters are used to indicate the association between the client and the monitoring platform in the environment variable type. The initialization parameters include a tenant identifier and a project identifier. The tenant identifier and the project identifier are uniquely associated. The tenant identifier is used to uniquely identify the client in the environment variable type. The project identifier is used to indicate the project in the monitoring platform corresponding to the tenant identifier. Based on the runtime environment information and the initialization parameters, a monitoring project package is automatically created. The monitoring project package is used to monitor erroneous operations that occur on clients that have the monitoring project package installed, and to report the relevant information of the erroneous operations to the monitoring platform.
2. The method according to claim 1, characterized in that, The step of obtaining initialization parameters from the server based on the runtime environment information includes: Send a first request message to the server. The first request message is used to obtain the association relationship between the client and the monitoring platform in the environment variable type. The first request message includes the environment variable type. Receive a first response message sent by the server, the first response message including the initialization parameters.
3. The method according to claim 1, characterized in that, The automatic creation of a monitoring project package based on the operating environment information and the initialization parameters includes: By building a tool plugin, the runtime environment information and the initialization parameters are inserted into the initial code to obtain the inserted code; The inserted code is parsed into an abstract syntax tree; After restoring the abstract syntax tree to standardized code, the standardized code is compiled to obtain the monitoring project package.
4. The method according to claim 1, characterized in that, The initialization parameters also include a first hash value of the project identifier, which is calculated using a hash function; before automatically creating the monitoring project package based on the runtime environment information and the initialization parameters, the method further includes: The project identifier is calculated using the hash function to obtain a second hash value for the project identifier; In response to the first hash value being the same as the second hash value, the initialization parameters are confirmed to be correct.
5. The method according to claim 1, characterized in that, The technology stack types include React and Vue; the process of determining the technology stack type includes: In response to the user's input of the technology stack type on the parameter setting interface, the technology stack type of the client is determined.
6. The method according to claim 1, characterized in that, The environment variable types include development environment, testing environment, and production environment; the process for determining the environment variable types includes: In response to the user's input operation on the parameter setting interface regarding the environment variable type, the environment variable type of the client is determined.
7. The method according to claim 1, characterized in that, The operating environment information also includes a sampling rate and / or a log collection strategy. The sampling rate is used to indicate the proportion of the erroneous operation recorded by the monitoring platform, and the log collection strategy is used to indicate the monitoring platform to record error logs generated by the erroneous operation with an error level of a preset error level. The method further includes: In response to the user's input of the sampling rate on the parameter setting interface, the sampling rate of the client is determined; And / or, In response to the user's input operation on the parameter setting interface regarding the log collection strategy, the log collection strategy of the client is determined.
8. The method according to claim 1, characterized in that, After automatically creating the monitoring project package based on the runtime environment information and the initialization parameters, the method further includes: In response to the error generation command from the client, obtain the error log generated by the error generation command in the monitoring platform; If the error log is the same as the preset error log, it is confirmed that the monitoring project package is normal.
9. An electronic device, characterized in that, The electronic device includes: Processor and communication interface; The communication interface is coupled to the processor, which is used to run computer programs or instructions to implement the project package creation method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, perform the project package creation method as described in any one of claims 1-8.