Database monitoring method and device, computer equipment and storage medium
By creating tracking identification information and obtaining log data in database monitoring, the abnormal situation monitoring of the database is realized, and the problem of insufficient universality and controllability of the database monitoring platform in the existing technology is solved, and the accuracy and adaptation of monitoring results are improved. Compatibility.
Patent Information
- Application Number
- CN202411117540.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-01-07
AI Technical Summary
The existing database monitoring platform relies on the support and specific configuration of the database, which leads to poor universality and controllability, making it difficult to flexibly adapt to different database environments.
By creating tracking identification information associated with data requests, the execution statements executed in the target database are determined, and the log data generated by the execution statements are obtained, exception monitoring is performed based on the log data, and graphical processing and log output framework layer are used to independently process the business process layer, implement monitoring of multiple databases.
An information link from user requests to service execution to database execution is established, which improves the accuracy and flexibility of monitoring results, adapts to different database environments, and improves the universality and controllability of monitoring systems.
Smart Images

Figure CN119271483A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a database monitoring method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] A database is an organized, structured collection of data, a system for storing and managing related data. The database system is a key component of a computer system for managing and storing data. By storing data in a structured manner, data access, management, and use are more efficient and convenient. A database usually consists of one or more data tables, each of which contains multiple data records, and each record consists of multiple fields. Databases use different data models (such as relational models, document models, and graphical models) to organize data. Common database systems include relational databases (such as MySQL, Oracle, and SQL Server), NoSQL databases (such as MongoDB and Redis), and so on. Database operations refer to the management and maintenance of database systems, which aims to ensure the security, stability, and efficient operation of database systems.
[0003] In related technologies, database operation and maintenance mainly include backup and recovery, performance optimization, security management, capacity planning, version upgrade and patch management, troubleshooting, monitoring and alarm, etc. Among them, monitoring and alarm usually rely on the database monitoring system, regularly monitor the database operation status and performance indicators, set reasonable alarm rules, and respond to abnormal situations in a timely manner.
[0004] However, the current database monitoring methods have the following technical problems:
[0005] The current database monitoring platform relies on the support and specific configuration of the database, resulting in poor versatility and controllability of the monitoring platform. Summary of the invention
[0006] Based on this, it is necessary to provide a database monitoring method, device, computer equipment, computer-readable storage medium and computer program product that can improve the versatility and controllability of database monitoring and improve monitoring efficiency in response to the above technical problems.
[0007] In a first aspect, the present application provides a database monitoring method. The method comprises:
[0008] In response to a data request for a target business, creating tracking identification information associated with the data request;
[0009] Determine, based on the tracking identification information, a target execution statement executed in the target database for the data request;
[0010] Acquire log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement;
[0011] The target database is monitored for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
[0012] In one embodiment, the monitoring of the target database for abnormal conditions based on the log data, before determining the abnormal conditions according to a preset monitoring logic, further includes:
[0013] Performing graphical processing on the log data to obtain a log chart;
[0014] The abnormal situation is monitored based on the log chart.
[0015] In one embodiment, the graphically processing the log data to obtain a log chart includes:
[0016] Confirming a target field to be monitored in the log data, and creating an index between the target field and the tracking identification information;
[0017] The target field is filled into an initial graph matching the target field to obtain the log graph.
[0018] In one embodiment, the acquiring of log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement, includes:
[0019] The log data output by the target database is obtained based on a preset log output framework layer, and the log output framework layer is independent of the business processing layer of the target business.
[0020] In one embodiment, the method further comprises:
[0021] determining the target execution statement associated with the data request in a plurality of databases based on the tracking identification information;
[0022] The log data output by the plurality of databases is obtained based on the log output framework layer.
[0023] In one embodiment, obtaining log data generated during the execution of the target execution statement includes:
[0024] Obtaining the business method and stack information during the execution of the target execution statement;
[0025] The log data is acquired based on the business method and the stack information, wherein the log data includes a slow query log, a transaction log, and a deadlock log.
[0026] In a second aspect, the present application also provides a database monitoring device. The device comprises:
[0027] A request response module, configured to create tracking identification information associated with a data request for a target business in response to the data request;
[0028] A statement locating module, configured to determine a target execution statement executed in the target database for the data request based on the tracking identification information;
[0029] A log data module, used to obtain log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement;
[0030] The abnormality monitoring module is used to monitor the target database for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
[0031] In one embodiment, before the abnormal monitoring module, it also includes:
[0032] A graphical module, used for performing graphical processing on the log data to obtain a log chart;
[0033] A chart monitoring module is used to monitor the abnormal situation based on the log chart.
[0034] In one embodiment, the graphical module includes:
[0035] An indexing module, used to identify a target field to be monitored in the log data and create an index between the target field and the tracking identification information;
[0036] A chart filling module is used to fill the target field into an initial chart matching the target field to obtain the log chart.
[0037] In one embodiment, the log data module includes:
[0038] The output framework layer module is used to obtain the log data output by the target database based on a preset log output framework layer, and the log output framework layer is independent of the business processing layer of the target business.
[0039] In one embodiment, the device further comprises:
[0040] a multi-database module, configured to determine the target execution statement associated with the data request in a plurality of databases based on the tracking identification information;
[0041] A data acquisition module is used to acquire the log data output by the multiple databases based on the log output framework layer.
[0042] In one embodiment, the log data module includes:
[0043] A business information module, used to obtain business methods and stack information during the execution of the target execution statement;
[0044] A log generation module is used to obtain the log data based on the business method and the stack information, and the log data includes a slow query log, a transaction log and a deadlock log.
[0045] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in the database monitoring method described in any one of the embodiments in the first aspect are implemented.
[0046] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in a database monitoring method as described in any one of the embodiments in the first aspect are implemented.
[0047] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the database monitoring method described in any one of the embodiments in the first aspect are implemented.
[0048] The above-mentioned database monitoring method, device, computer equipment, storage medium and computer program product can achieve the beneficial effects of the technical problems in the corresponding background technology by deducing the technical features in the claims:
[0049] The present application provides a database monitoring method, including: in response to a data request for a target business, creating tracking identification information associated with the data request; determining a target execution statement executed for the data request in the target database based on the tracking identification information; obtaining log data generated during the execution of the target execution statement, the log data being used to record parameter information when the target database executes the target execution statement; monitoring the target database for abnormal conditions based on the log data, and the abnormal conditions being determined according to a preset monitoring logic. In implementation, by associating the tracking identification information with the data request of the target business, the execution statement associated with it in the database can be marked during the processing of the request, and then the parameter information generated during the execution of the execution statement can be recorded to form log data, and finally the operation status of the database can be monitored based on the log data. In this way, an information link from user request to business execution to database execution can be established, which helps to intuitively and accurately find database changes related to the request, conduct targeted monitoring, help improve the accuracy of the monitoring results, and can flexibly adapt to different databases, thereby improving the flexibility of the monitoring system. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 An application environment diagram of a database monitoring method in an embodiment;
[0051] Figure 2 A first flow chart of a database monitoring method in one embodiment;
[0052] Figure 3 A second flow chart of a database monitoring method in another embodiment;
[0053] Figure 4 A third flow chart of a database monitoring method in another embodiment;
[0054] Figure 5 A fourth flow chart of a database monitoring method in another embodiment;
[0055] Figure 6 A fifth flow chart of a database monitoring method in another embodiment;
[0056] Figure 7 A sixth flow chart of a database monitoring method in another embodiment;
[0057] Figure 8 is a structural block diagram of a database monitoring device in one embodiment;
[0058] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] The database monitoring method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0061] In one embodiment, Figure 2 As shown, a database monitoring method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0062] Step 202: In response to a data request for a target service, create tracking identification information associated with the data request.
[0063] Among them, business can refer to the content related to specific business needs, functions and processes in the system. Data request can refer to the request initiated when specific data is needed to implement the process needs of the target business. Tracking identification information can refer to a unique identifier used to track the transmission of requests between different services in a distributed system. Since a request in the system needs to pass through different service nodes to be completed, tracking identification information can be used to track and monitor requests across services. The tracking identifier can be a Trace ID.
[0064] Exemplarily, the terminal can create tracking identification information associated with the data request in response to the data request for the target business. Specifically, when a request is initiated, the first service generates a unique TraceID and passes it to the downstream service. Each service will carry the TraceID in the request header or context and pass it to the next service during the processing of the request, thereby forming a trace of the entire request link. In this way, the terminal can help developers and operation and maintenance personnel track the path of the request in the system and analyze the request processing process and performance bottlenecks.
[0065] Specifically, TraceID usually contains a globally unique identifier that identifies the uniqueness of a request, as well as optional parent SpanID (span) and Sampled (sampling identifier) and other information. When a large request link is broken down into multiple small spans, each span will carry the same TraceID to associate them together. By analyzing TraceID, developers can understand the direction of requests in the system, the processing time of each service, the service with problems, and other information to help quickly locate and solve problems. TraceID is also a key parameter commonly used in monitoring systems and performance analysis tools.
[0066] Step 204: Determine a target execution statement executed in the target database for the data request based on the tracking identification information.
[0067] The execution statement may be a program statement used to operate data in the database, such as SQL (Structured Query Language), etc. The execution statement can be used to manage the standardized language of the relational database system, thereby realizing operations such as querying, inserting, updating and deleting the database.
[0068] Exemplarily, the terminal may determine a target execution statement in the target database to be executed for the data request based on the tracking identification information.
[0069] Step 206: Obtain log data generated during the execution of the target execution statement.
[0070] The log data may refer to parameter information used to record when the target database executes the target execution statement. Specifically, the log data may record events, activities or information that occur when the target execution statement in the database is running. The log data may be stored in the form of a text file, a data record, a log server, etc.
[0071] Exemplarily, the terminal may obtain log data generated during the execution of the target execution statement.
[0072] Step 208: The target database is monitored for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
[0073] Among them, abnormal conditions may refer to abnormal conditions in database operations and processing, which may lead to damage to the integrity of data in the database, operation failures, and system crashes. Specific abnormal conditions may include unique constraint violations, null value constraint violations, exceeding constraint ranges, deadlocks, connection timeouts, insufficient space, and file corruption. Monitoring logic may refer to the discrimination rules used to discriminate abnormal conditions in the database, and the monitoring logic may be pre-set according to database performance parameters and abnormal conditions.
[0074] Exemplarily, the terminal may monitor the target database for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
[0075] In the above database monitoring method, reasonable deduction is performed in combination with the technical features in the embodiment to achieve the following beneficial effects of solving the technical problems raised in the background technology:
[0076] The present application provides a database monitoring method, including: in response to a data request for a target business, creating tracking identification information associated with the data request; determining a target execution statement executed for the data request in the target database based on the tracking identification information; obtaining log data generated during the execution of the target execution statement, the log data being used to record parameter information when the target database executes the target execution statement; monitoring the target database for abnormal conditions based on the log data, and the abnormal conditions being determined according to a preset monitoring logic. In implementation, by associating the tracking identification information with the data request of the target business, the execution statement associated with it in the database can be marked during the processing of the request, and then the parameter information generated during the execution of the execution statement can be recorded to form log data, and finally the operation status of the database can be monitored based on the log data. In this way, an information link from user request to business execution to database execution can be established, which helps to intuitively and accurately find database changes related to the request, conduct targeted monitoring, help improve the accuracy of the monitoring results, and can flexibly adapt to different databases, thereby improving the flexibility of the monitoring system.
[0077] In one embodiment, the Figure 3 As shown, before step 208, the following steps are also included:
[0078] Step 302: Graphically process the log data to obtain a log chart.
[0079] Graphical processing refers to the process of displaying and visualizing data in the form of charts and graphs. Data visualization can help us understand data more intuitively, discover the relationships, trends and patterns between data, and improve the efficiency of data analysis and decision-making. Specifically, graphics can include processing data into line graphs, bar graphs, pie charts, scatter plots, heat maps, etc.
[0080] Exemplarily, the terminal may perform graphical processing on the log data to obtain a log chart.
[0081] Step 304: Monitor the abnormal situation based on the log chart.
[0082] Exemplarily, the terminal may monitor abnormal situations based on the graphical log chart.
[0083] In this embodiment, after the log data is acquired, the log data is processed graphically to obtain a log chart, so that the database status can be monitored visually, which improves the intuitiveness of viewing the log data.
[0084] In one embodiment, the Figure 4 As shown, step 302 includes:
[0085] Step 402: confirming a target field to be monitored in the log data, and creating an index between the target field and the tracking identification information.
[0086] The target field may refer to a parameter field in the log data that is associated with the abnormal situation of the monitored database. The index may refer to a data structure used to locate data that meets the conditions.
[0087] Exemplarily, the terminal may determine a target field to be monitored in the log data, and create an index between the target field and the tracking identification information.
[0088] Step 404: Fill the target field into an initial chart that matches the target field to obtain the log chart.
[0089] Exemplarily, the terminal may associate and assign values to the log data and the log chart according to the index, thereby obtaining the log chart.
[0090] In this embodiment, in the graphical processing of obtaining the log chart, the valid fields in the log data are identified and extracted, which helps to improve the proportion of valid data in the log data. On the other hand, an index between the target field and the tracking identification information is established, which helps to flexibly query specific fields, thereby improving the flexibility of database status monitoring.
[0091] In one embodiment, the Figure 5As shown, step 206 includes:
[0092] Step 502: Acquire the log data output by the target database based on a preset log output framework layer.
[0093] The log output framework layer can refer to the framework or library used to record and manage log information in software development. These frameworks provide a mechanism that enables developers to easily record various events and status information during system runtime for debugging, monitoring, and troubleshooting. The log output framework layer is independent of the business processing layer of the target business.
[0094] Exemplarily, the terminal may obtain the log data output by the target database based on a preset log output framework layer.
[0095] In this embodiment, the log data output by the target database is obtained through the log output framework layer, so that the output of log data and the monitoring of the database are independent of the business side, which helps to improve the versatility of database monitoring and adapt the database monitoring method to different languages and systems.
[0096] In one embodiment, the Figure 6 As shown, the method also includes:
[0097] Step 602: Determine the target execution statement associated with the data request in multiple databases based on the tracking identification information.
[0098] Exemplarily, the terminal may determine the target execution statement associated with the data request in multiple databases based on the tracking identification information.
[0099] Step 604: Acquire the log data output by the plurality of databases based on the log output framework layer.
[0100] Exemplarily, the terminal may obtain the log data output by the plurality of databases based on the log output framework layer.
[0101] In this embodiment, multiple databases can be associated and monitored simultaneously through the log output framework layer, thereby helping to further improve the flexibility and compatibility of log data monitoring.
[0102] In one embodiment, the Figure 7 As shown, step 206 includes:
[0103] Step 702: Obtain the business method and stack information during the execution of the target execution statement.
[0104] Among them, stack can refer to a data structure used to store and manage the call information of the program runtime method. When the program is executed, each method call will generate a stack frame, which contains information such as method parameters, local variables and execution instructions. These stack frames are arranged in the order of method calls to form a call chain, that is, a stack. When an exception occurs during program execution or a method call is required, the stack will continuously push and pop stack frames to maintain the order and execution status of method calls. When an exception occurs in the program, the system will generate a stack trace to record the information of the current method call chain, including the called method name, class name, line number, etc., so that developers can locate and troubleshoot problems. Stack information is usually presented in text form, including the hierarchy and order of method calls, and is one of the very important reference information for developers when debugging and analyzing program problems.
[0105] Exemplarily, the terminal may obtain the business method and stack information during the execution of the target execution statement.
[0106] Step 704: Acquire the log data based on the business method and the stack information, where the log data includes a slow query log, a transaction log, and a deadlock log.
[0107] Exemplarily, the terminal may obtain the log data based on the business method and the stack information, where the log data includes a slow query log, a transaction log, and a deadlock log.
[0108] In this embodiment, the log data includes a variety of different types, which helps to monitor and analyze different abnormal situations and improve the flexibility of the monitoring process of the database.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a database monitoring device for implementing the above-mentioned database monitoring method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more database monitoring device embodiments provided below can refer to the above-mentioned limitations on a database monitoring method, and will not be repeated here.
[0111] In one embodiment, Figure 8 As shown, a database monitoring device is provided, including: a request response module, a statement positioning module, a log data module and an abnormality monitoring module, wherein:
[0112] A request response module, configured to create tracking identification information associated with a data request for a target business in response to the data request;
[0113] A statement locating module, configured to determine a target execution statement executed in the target database for the data request based on the tracking identification information;
[0114] A log data module, used to obtain log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement;
[0115] The abnormality monitoring module is used to monitor the target database for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
[0116] In one embodiment, before the abnormal monitoring module, it also includes:
[0117] A graphical module, used for performing graphical processing on the log data to obtain a log chart;
[0118] A chart monitoring module is used to monitor the abnormal situation based on the log chart.
[0119] In one embodiment, the graphical module includes:
[0120] An indexing module, used to identify a target field to be monitored in the log data and create an index between the target field and the tracking identification information;
[0121] A chart filling module is used to fill the target field into an initial chart matching the target field to obtain the log chart.
[0122] In one embodiment, the log data module includes:
[0123] The output framework layer module is used to obtain the log data output by the target database based on a preset log output framework layer, and the log output framework layer is independent of the business processing layer of the target business.
[0124] In one embodiment, the device further comprises:
[0125] a multi-database module, configured to determine the target execution statement associated with the data request in a plurality of databases based on the tracking identification information;
[0126] A data acquisition module is used to acquire the log data output by the multiple databases based on the log output framework layer.
[0127] In one embodiment, the log data module includes:
[0128] A business information module, used to obtain business methods and stack information during the execution of the target execution statement;
[0129] A log generation module is used to obtain the log data based on the business method and the stack information, and the log data includes a slow query log, a transaction log and a deadlock log.
[0130] Each module in the above-mentioned database monitoring device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0131] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a database monitoring method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0132] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0133] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0135] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0138] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A database monitoring method, characterized in that: The method comprises: In response to a data request for a target business, creating tracking identification information associated with the data request; Determine, based on the tracking identification information, a target execution statement to be executed in a target database for the data request; Acquire log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement; The target database is monitored for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
2. The method according to claim 1, characterized in that: The monitoring of the target database for abnormal conditions based on the log data, before determining the abnormal conditions according to a preset monitoring logic, further includes: Performing graphical processing on the log data to obtain a log chart; The abnormal situation is monitored based on the log chart.
3. The method according to claim 2, characterized in that The graphical processing of the log data to obtain a log chart includes: Confirming a target field to be monitored in the log data, and creating an index between the target field and the tracking identification information; The target field is filled into an initial graph matching the target field to obtain the log graph.
4. The method according to claim 1, characterized in that The acquiring of log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement, includes: The log data output by the target database is obtained based on a preset log output framework layer, and the log output framework layer is independent of the business processing layer of the target business.
5. The method according to claim 4, characterized in that The method further comprises: determining the target execution statement associated with the data request in a plurality of databases based on the tracking identification information; The log data output by the plurality of databases is obtained based on the log output framework layer.
6. The method according to claim 1, characterized in that The obtaining of log data generated during the execution of the target execution statement includes: Obtaining the business method and stack information during the execution of the target execution statement; The log data is acquired based on the business method and the stack information, wherein the log data includes a slow query log, a transaction log, and a deadlock log.
7. A database monitoring device, characterized in that: The device comprises: A request response module, configured to create tracking identification information associated with a data request for a target business in response to the data request; A statement locating module, configured to determine a target execution statement executed in a target database for the data request based on the tracking identification information; A log data module, used to obtain log data generated during the execution of the target execution statement, wherein the log data is used to record parameter information when the target database executes the target execution statement; The abnormality monitoring module is used to monitor the target database for abnormal conditions based on the log data, and the abnormal conditions are determined according to a preset monitoring logic.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.