Microservice monitoring method, device, system, computer equipment and storage medium

By obtaining the configuration information of microservices regularly and generating monitoring data, the problem of microservice monitoring in the existing technology relies on human resources management, and efficient automated monitoring is achieved, and monitoring efficiency and accuracy are improved.

CN112217864BActive Publication Date: 2025-02-18SHENZHEN WEIBAO INFORMATION SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010921991.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-04
Publication Date
2025-02-18
Estimated Expiration
2040-09-04

AI Technical Summary

Technical Problem

The existing microservice monitoring methods rely on manpower management, are time-consuming and have poor results, making it difficult to achieve efficient automated monitoring.

Method used

By obtaining the configuration information of microservices from the configuration management system regularly, combining static and dynamic information to generate monitoring data, and automatically alert according to the alarm rules.

Benefits of technology

It realizes automated monitoring of microservices, reduces manpower intervention, improves monitoring efficiency and accuracy, laying the foundation for subsequent data analysis and self-healing of alarms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112217864B_ABST
    Figure CN112217864B_ABST
Patent Text Reader

Abstract

The present application relates to a microservice monitoring method, device, system, computer equipment and storage medium. The method includes: obtaining static information of the microservice to be monitored from the configuration center, the static information including the identification of the microservice to be monitored; obtaining dynamic information of the microservice to be monitored from the registration center according to the identification of the microservice to be monitored; constructing the configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored; sending the configuration information of the microservice to be monitored to the monitoring system at a regular interval, and the monitoring system obtains the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored. The microservice to be monitored is customized through the static information configured by the configuration center, the dynamic information is obtained from the registration center according to the static information, and the monitoring data is obtained according to the configuration information generated by the dynamic information and the static information, so as to realize the automatic monitoring of the microservice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a microservice monitoring method, apparatus, system, computer equipment and storage medium. Background Art

[0002] The characteristics of microservices are that they are numerous and small, have multiple development languages, short life cycles, fast online and offline, high release frequency, and multiple deployment modes, including host deployment, single container deployment, and sidecar dual container deployment. Monitoring is actually the same as microservices accessing each other. General monitoring mainly relies on manpower to manage monitoring targets, which is time-consuming and ineffective. Summary of the invention

[0003] In order to solve the above technical problems, the present application provides a microservice monitoring method, apparatus, system, computer device and storage medium.

[0004] This application provides a microservice monitoring method, including:

[0005] Periodically obtain configuration information of the microservice to be monitored from the configuration management system, wherein the configuration information of the microservice to be monitored is generated according to static information of the microservice to be monitored and dynamic information of the microservice to be monitored;

[0006] Acquire monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored;

[0007] Determine whether to issue an alarm for the monitoring data of the microservice to be monitored according to the alarm rule.

[0008] The present application provides a microservice monitoring device, comprising:

[0009] A configuration information acquisition module is used to periodically acquire configuration information of the microservice to be monitored from the configuration management system, wherein the configuration information of the microservice to be monitored is generated according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0010] A monitoring data acquisition module, used to obtain monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored;

[0011] The alarm module is used to determine whether to issue an alarm for the monitoring data of the microservice to be monitored according to the alarm rules.

[0012] This application provides a microservice monitoring method, including:

[0013] Obtain static information of the microservice to be monitored from the configuration center, where the static information includes an identifier of the microservice to be monitored;

[0014] According to the identifier of the microservice to be monitored, dynamic information of the microservice to be monitored is obtained from the registration center;

[0015] Constructing configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0016] The configuration information of the microservice to be monitored is sent to the monitoring system at a regular interval, so that the monitoring system obtains the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0017] The present application provides a microservice monitoring device, comprising:

[0018] A static information acquisition module, used to acquire static information of the microservice to be monitored from the configuration center, wherein the static information includes an identifier of the microservice to be monitored;

[0019] A dynamic information acquisition module, used to acquire the dynamic information of the microservice to be monitored from a registration center according to the identifier of the microservice to be monitored;

[0020] A configuration information building module, used to build configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0021] The configuration information sending module is used to periodically send the configuration information of the microservice to be monitored to the monitoring system, so that the monitoring system obtains the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0022] The present application provides a microservice monitoring system, including: a configuration center, a registration center, a configuration management system and a monitoring system.

[0023] The configuration center is used to configure static information of the microservice to be monitored;

[0024] The registration center is used to register the dynamic information of the microservice to be monitored;

[0025] The configuration management system is used to obtain static information of the microservice to be monitored from the configuration center, wherein the static information includes the service identifier of the microservice to be monitored; obtain dynamic information of the microservice to be monitored from the registration center according to the service identifier of the microservice to be monitored, and construct configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0026] The monitoring system is used to periodically obtain configuration information of the microservice to be monitored from the configuration management system, obtain monitoring data of the microservice to be monitored based on the configuration information of the microservice to be monitored, and determine whether to issue an alarm for the monitoring data of the microservice to be monitored based on an alarm rule.

[0027] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned microservice monitoring method when executing the computer program.

[0028] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned microservice monitoring method when executed by a processor.

[0029] The above-mentioned microservice monitoring method, device, system, computer equipment and storage medium, the method realizes automatic monitoring of microservices by obtaining configuration information consisting of pre-configured static information and dynamically obtained access addresses, and the monitoring data can be marked through the configured static information, laying the foundation for subsequent data analysis and alarm self-healing. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0032] Figure 1 An application environment diagram of a microservice monitoring method in an embodiment;

[0033] Figure 2 A schematic diagram of a process of a microservice monitoring method in an embodiment;

[0034] Figure 3 A schematic diagram of a process of a microservice monitoring method in an embodiment;

[0035] Figure 4 A schematic diagram of a microservice monitoring system in one embodiment;

[0036] Figure 5 A schematic diagram of a microservice monitoring system in one embodiment;

[0037] Figure 6 It is a structural block diagram of a microservice monitoring device in one embodiment;

[0038] Figure 7 It is a structural block diagram of a microservice monitoring device in one embodiment;

[0039] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0041] Figure 1 FIG. 1 is an application environment diagram of a microservice monitoring method in an embodiment. Figure 1 , the microservice monitoring method is applied to a microservice monitoring system. The microservice monitoring system includes a monitoring system 110 and a configuration management system 120. The monitoring system 110 and the configuration management system 120 are connected via a network. The monitoring system 110 can be a terminal or a server. The configuration management system 120 can be a desktop terminal or a mobile terminal, and the mobile terminal can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The monitoring system 110 and the configuration management system 120 can be deployed on the same terminal.

[0042] like Figure 2 As shown, in one embodiment, a microservice monitoring method is provided. This embodiment mainly applies this method to the above Figure 1 The monitoring system 110 in FIG. Figure 2 , the microservice monitoring method specifically includes the following steps:

[0043] Step S201, periodically obtain configuration information of the microservice to be monitored from the configuration management system.

[0044] In this specific embodiment, the configuration information of the microservice to be monitored is generated according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored.

[0045] Among them, scheduled acquisition refers to data acquisition according to a certain time period. The time period of scheduled acquisition can be customized, such as 1 minute or 1.5 minutes. The monitoring system regularly obtains the configuration information of the microservice to be monitored from the configuration management system. When obtaining the configuration information of the microservice to be monitored, the configuration information can be obtained through the application interface, such as obtaining the configuration information of the microservice to be monitored through the http interface or the Grpc interface.

[0046] The monitoring system can be a custom monitoring system or an existing monitoring system. The existing monitoring systems include Prometheus, which is an open source time series database and monitoring system. Prometheus includes pushgateway components and exporter components. The pushgateway component is used to receive indicator data and expose it to prometheus for crawling. The exporter component is called an exposer, which is used to provide monitoring indicator data to prometheus for collection. It is generally named xx_exporter. Each exporter is a microservice to be monitored, such as an http server. For example, node_exporter exposes host indicators, mysql_exporter exposes mysql database indicators, and redis_exporter exposes redis database indicators. Prometheus also includes metrics indicators. Metrics indicators refer to measurements that can be described by numbers. They generally change over time and are suitable for storage in a time series database, such as speed, temperature, humidity, host CPU usage, service visits, error rate, etc.

[0047] Microservice is a service design concept based on business functions. Each service has business functions that run independently and is open to the outside world with application interfaces that are not restricted by language. The most common interface is the http interface. The application consists of one or more microservices. Microservices can be customized according to needs. For example, if the current business requires login, a login service can be defined. If the current business includes order placement and return operations, an order placement service and a return service can be defined.

[0048] The microservices to be monitored refer to the microservices that need to be monitored. The microservices that need to be monitored are configured in the configuration center. Configuration information refers to the configuration information used to obtain monitoring data. The configuration information can be customized according to needs, such as the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment, and the development language of the microservice. The static information of the microservice refers to the information configured in the configuration center. The configuration center is used to maintain the relevant information of resources, including the relevant information of the microservice, such as the service name, development language, deployment information, importance level, developer, main function, etc. The data of the configuration center is stored in the configuration management database (CMDB). The dynamic information of the microservice includes the service instance list of the microservice and the address information of the instance. The dynamic information of the microservice changes with the release and expansion of the service. The storage method of the configuration information can be file storage or registration in a distributed storage warehouse. For example, the configuration information is registered in consul, where consul is a distributed service discovery and kv (key-value) storage warehouse. The registration center is used to implement service discovery registration. Service discovery registration means that the service listens to the TCP port and needs to register. The TCP information is registered in a warehouse, that is, service registration, so that other services can find the TCP address from the warehouse through the service name, and services can communicate with each other through the service name, that is, service discovery. The service instance list and instance address information obtained by the service discovery registration are stored in etcd (a distributed service discovery kv storage warehouse). etcd is easy to deploy, install and use, and it also provides reliable data persistence.

[0049] In one embodiment, targets define the access address of the service registered to etcd, which represents the crawling address. When the service is re-released or the capacity is expanded and an instance is added, the targets will automatically change in linkage. Labels are static data that represents the indicators exposed by this monitoring target and adds additional labels.

[0050] In a specific embodiment, the format of the configuration information is yaml format, and the specific configuration information is as follows:

[0051]

[0052] Among them, 10.82.5.134 in Targets is the access address, 41190 is the port, the application identifier app_id is 10741, the application name app_name is scrm-data-statistic-session-event, the environment env is prd, the registered name etcd_name is statisticsession-event, the group group is OS, the development language language is Java, and the object object is app.

[0053] Step S202: Acquire monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0054] Specifically, the access address of the service is obtained from the microservice to be monitored, and an indicator data acquisition request is sent to the access address of the microservice to be monitored to obtain the corresponding monitoring data. The monitoring data refers to the data corresponding to various indicators of the microservice to be monitored. The indicators include native indicators and custom indicators exposed by the application. The native indicators of the application refer to the indicators set when designing the application. Custom indicators are indicators defined by custom tags configured by the configuration center. The indicators defined in the configuration center include indicators obtained by dividing and counting native indicators according to custom tags. For example, the original indicators are divided according to regions or system types to obtain indicators of different regions or different system types. For example, when the microservice is a login service, the native indicators include login success rate. After dividing the login success rate by region, the login success rate of each region is obtained. After dividing the login success rate by system type, the login success rate of different types of systems is obtained. If the native indicator is the login success rate of each region, such as the native indicator includes the login success rate of the South China region, the East China region and other regions, and the region is counted, such as the national login success rate, then the success rate of each region needs to be counted.

[0055] In one embodiment, after the monitoring data is acquired, the monitoring data is further processed, such as performing statistics and analysis on the indicator data in a preset manner, and specifically, statistics can be performed according to region, network environment, system environment, etc. For example, when performing statistics according to region, the login success rate and order rate of each region can be counted, and when performing statistics according to system environment, the corresponding login success rate can be counted according to system environment such as iOS / Android.

[0056] In one embodiment, the static information includes a service identifier, and the configuration information of the microservice to be monitored in the configuration management system is traversed periodically. The dynamic information of the microservice to be monitored is obtained from the registration center according to the service identifier contained in the static information in the configuration information; and the monitoring data of the microservice to be monitored is obtained according to the dynamic information.

[0057] In one embodiment, the static information also includes a custom tag of the microservice to be monitored. After obtaining the monitoring data of the microservice to be monitored according to the dynamic information, it also includes: marking the monitoring data according to the custom tag of the microservice to be monitored to obtain the monitoring data carrying the custom tag.

[0058] Specifically, custom tags are tags set by users according to business needs. Tags include but are not limited to network, environment, application identifiers, etc. that can describe the identifiers of the microservice to be monitored. The monitoring data of the microservice is obtained based on dynamic information, and the monitoring data is marked according to the custom tags so that the monitoring data carries custom tags. For example, the development language, operating environment, and application to which the microservice belongs are defined. The data is filtered again through custom tags to accurately locate non-hierarchical data. For example, by dividing microservices through added custom tags, the data can be analyzed in more detail. For example, by dividing the data according to different types / different regions, data of different types / different regions can be analyzed. Statistics of data through custom indicators can cover data of different types / different regions, thereby performing a more comprehensive analysis of the data.

[0059] In a specific embodiment, for example, the native monitoring indicators developed are:

[0060] http_requests_total{method="POST",path=" / ",status="200"}100

[0061] The above data means that the current access path is / and the method is POST. The number of http requests with a return code of 200 is 100.

[0062] After the monitoring system collects and stores it in the time series database, it becomes:

[0063] http_requests_total{app_name="alert-center",app_id="1",language="golang",group="OS",env="prd",method="POST",path=" / ",status="200"}100

[0064] The above data represents the application name alert-center, application ID 1, development language golang, group OS, environment prd, current access path / method POST, return code 200, and the number of http requests is 100. Custom tags such as application name alert-center, application ID 1, development language golang, group OS, and environment prd are added. The monitoring data is marked according to the custom tags, so that the monitoring system not only automates monitoring collection, but also associates monitoring data with static information. Custom tags can lay the foundation for subsequent data analysis, such as analyzing the monitoring data of microservices with application name alert-center or development language golang. By setting the application name or development language of the analysis data, the monitoring data corresponding to the set application name or development language can be effectively extracted, thereby realizing the analysis of the monitoring data corresponding to the application name or development language.

[0065] Step S203: Determine whether to issue an alarm for the monitoring data of the microservice to be monitored according to the alarm rule.

[0066] Specifically, the alarm rule is a pre-set rule for alarm. When the monitoring data meets the alarm condition in the alarm rule, the alarm is executed, otherwise the alarm is not executed. The alarm rule can be set according to business needs. Different applications have different requirements for the same microservice. Different microservices in the same application have different alarms. The alarm rules are set to distinguish the alarms of each business. For example, different alarm rules are set for the same microservice in different time periods. The reason why different alarm rules need to be set for the same microservice in different time periods is that the same microservice has different impacts on the business in different time periods. For example, different alarm rules can be set for business peak time periods and non-peak time periods. And the alarms of the same microservice can contain multiple alarm levels, and different alarm levels indicate different alarm severities.

[0067] In one embodiment, if the monitoring data of the microservice to be monitored currently meets the alarm rule, alarm information for alerting the microservice to be monitored currently is generated and sent.

[0068] Specifically, the alarm information is information used to prompt users or monitoring personnel. The alarm information can be displayed in the form of pictures and texts, or it can be marked with the displayed monitoring data. Different marks represent different alarms. Displaying in the form of pictures and texts means directly sending corresponding pictures and texts to inform monitoring personnel of the existing problems. The alarm information can include the name of the microservice where the alarm occurs, the cause of the alarm, etc., or it can only prompt the name of the microservice that alarms. When the alarm information marks the monitoring data with different identifiers, it can be marked with different colors or special symbols.

[0069] The above-mentioned microservice monitoring method customizes the microservice to be monitored through the static information configured by the configuration center, obtains dynamic information from the registration center according to the static information, obtains monitoring data according to the configuration information generated by the dynamic information and the static information, and realizes automatic monitoring of the microservice.

[0070] In one embodiment, the above-mentioned microservice monitoring method also includes: obtaining static information of the microservice to be monitored from the configuration center through the configuration management system, the static information including the service identifier of the microservice to be monitored; obtaining dynamic information of the microservice to be monitored from the registration center through the configuration management system according to the service identifier of the microservice to be monitored; and constructing configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored through the configuration management system.

[0071] Specifically, the service identifier of a microservice is used to uniquely identify the microservice, and each microservice to be monitored has a unique service identifier. Static information can be customized according to needs. The service identifier and custom label of the microservice to be monitored are obtained from the configuration center through the configuration management system. The service identifier of the microservice to be monitored is the same as the registration name of the microservice in the registration center. The dynamic information of the microservice to be monitored, that is, the microservice list and the access address corresponding to each microservice, is obtained from the registration center through the service identifier of the microservice to be monitored. Constructing the configuration information of the microservice to be monitored refers to assembling the static information and dynamic information of each microservice to be monitored. Fill in the static information and dynamic information according to the preset format of the configuration information. Save the configuration information of the microservice to be monitored in the form of a file, and then obtain the configuration file of each microservice to be monitored. Or register the configuration information in the kv database.

[0072] In one embodiment, the configuration information of the microservice to be monitored is saved in a file form through a configuration management system to obtain a configuration file of the microservice to be monitored; or the configuration information of the microservice to be monitored is registered through a configuration management system.

[0073] Specifically, after obtaining static information and dynamic information through the configuration management system, the configuration information of the microservice to be monitored is constructed, and the configuration information of the microservice to be monitored is stored in the form of a file, or the configuration information is registered through the configuration management system, that is, the configuration information is stored in the database in a key-value storage manner. The configuration information is updated as the static information and dynamic information obtained are updated.

[0074] In a specific embodiment, if a service named alert-center has been configured in cmdb, the static information of the service can be obtained when traversing the cmdb list. After the relevant indicators of the service are developed and the service is released. The registration center can discover the service through the service discovery mechanism and register the service, where the registration address of the service is 10.0.0.2:8080, and the location of the registration address is: / services / alert-center-http. After obtaining the service name alert-center from cmdb, go to etcd to obtain the registration address of the service name alert-center, that is, obtain the registration address 10.0.0.2:8080 of the service in / services / alert-center-http of etcd. After obtaining the address, you can obtain the indicator data of the service, that is, monitoring data, by accessing http: / / 10.0.0.2:8080 / metrics.

[0075] In a specific embodiment, the assembled configuration information is provided for external download in the form of an http interface, and the configuration is downloaded regularly through a script fragment. The time interval can be customized. The interval time cannot be too short, because if it is too short, etcd will be frequently queried, affecting the performance of the production environment. It cannot be too long, otherwise it will cause the microservice release IP to change, and the monitoring configuration will not be updated, resulting in a breakpoint in the data collection. For example, it can be set to 1 minute or 1.5 minutes.

[0076] Download the assembled configuration information script fragment as follows:

[0077]

[0078]

[0079] The above script fragment is executed regularly (the time interval can be set according to needs). ${SERVER} is the access address of the configuration management service in the monitoring collection architecture diagram. Use the curl command to download the configuration file to the targets / XXX-framework directory.

[0080] In one embodiment, the microservice monitoring method further includes: monitoring a configuration file of the microservice to be monitored; and when the configuration file of the microservice to be monitored changes, updating the microservice to be monitored according to the changed configuration file of the microservice to be monitored.

[0081] Among them, monitoring the change of the configuration file means monitoring the change of the directory of the configuration file, or monitoring the change of the content in the configuration file. When the directory of the configuration file or the content in the configuration file is monitored to change, the monitored microservice is updated according to the directory of the changed configuration file. That is, the change of the directory file includes reduction, addition, etc., and then the monitoring data obtained subsequently is updated.

[0082] In a specific embodiment, Prometheus (monitoring system) automatically adds, deletes, and updates monitoring targets by monitoring changes in this directory file. The configuration of Prometheus monitoring the targets / XXX-framework directory is:

[0083]

[0084]

[0085] In one embodiment, the above-mentioned microservice monitoring method further includes: monitoring dynamic information of the registration center; when the dynamic information of the registration center changes, updating the configuration information of the microservice to be monitored in the configuration management system according to the changed dynamic information of the registration center.

[0086] Specifically, because the information of the registration center will change with the deployment and expansion of microservices, it is necessary to monitor the changes in the information of the registration center, discover the changes in the registration center in time, build configuration information based on the dynamic information that has changed in the registration center and the corresponding static information, and update the configuration information of the microservice. Timely update the configuration information, when the monitoring system obtains the configuration information, it can obtain the updated configuration information in time, so as to effectively monitor the microservice, so as to effectively monitor the corresponding microservice after redeployment or expansion.

[0087] In one embodiment, Figure 3 As shown, a microservice monitoring method is provided. This embodiment mainly applies this method to the above Figure 1 The configuration management system 110 in FIG. Figure 3 , the microservice monitoring method specifically includes the following steps.

[0088] Step S301, obtaining static information of the microservice to be monitored from the configuration center.

[0089] In this specific embodiment, the static information includes the identifier of the microservice to be monitored.

[0090] Step S302: acquiring dynamic information of the microservice to be monitored from a registration center according to the identifier of the microservice to be monitored.

[0091] Step S303: construct configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored.

[0092] Step S304: regularly send the configuration information of the microservice to be monitored to the monitoring system, so that the monitoring system obtains the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0093] The above-mentioned microservice monitoring method customizes the microservice to be monitored through the static information configured by the configuration center, obtains the dynamic information of the microservice from the registration center according to the static information, generates configuration information based on the dynamic information and static information of the microservice, obtains the monitoring data of the microservice through the configuration information, and realizes automatic monitoring of the microservice.

[0094] In one embodiment, Figure 4 As shown, a microservice monitoring system is provided, including a configuration center 401, a registration center 402, a configuration management system 403 and a monitoring system 404.

[0095] The configuration center 401 is used to configure the static information of the microservice to be monitored.

[0096] The registration center 402 is used to register the dynamic information of the microservice to be monitored.

[0097] The configuration management system 403 is used to obtain static information of the microservice to be monitored from the configuration center 401, where the static information includes the service identifier of the microservice to be monitored; obtain dynamic information of the microservice to be monitored from the registration center 402 according to the service identifier of the microservice to be monitored, and construct configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored.

[0098] The monitoring system 404 is used to obtain the configuration information of the microservice to be monitored from the configuration management system 403 at regular intervals, obtain the monitoring data of the microservice to be monitored based on the configuration information of the microservice to be monitored, and determine whether to issue an alarm for the monitoring data of the microservice to be monitored based on the alarm rules.

[0099] In a specific embodiment, Figure 5 As shown in the figure, the microservice monitoring system includes etcd, cmdb, target configuration management system, prometheus and alarm configuration management.

[0100] etcd is used to register dynamic information of microservices. Microservices are registered through service discovery. The access address registered to etcd changes as services are released and expanded.

[0101] cmdb is used to maintain relevant information (static information) of resources, including relevant information of microservices, such as service name, development language, deployment information, importance level, developer, main functions, etc.

[0102] The target configuration management system is used to obtain the static information of microservices from cmdb, and obtain dynamic information from etcd according to the service identifier in the static information, assemble the static and dynamic information of microservices, and convert the assembled information into a crawling configuration format that prometheus can recognize. After integrating the data of etcd and cmdb, it can be issued in the form of a file, or the integrated data can be registered in consul, and the events of etcd can be listened to to update the data of consul. prometheus supports the consul service discovery function, and discovers the monitoring target by reading consul, reducing the number of configuration files.

[0103] Prometheus is used to download configurations using scheduled tasks http, and collect corresponding indicator data from corresponding microservices according to the downloaded configurations to obtain monitoring data of microservices. It uses scheduled tasks to obtain alarm rules from alarm configuration management, and determines whether to trigger an alarm based on the alarm rules and monitoring data. When an alarm is triggered, it generates corresponding alarm information. It monitors Dec target, Sit target, Uat target, Prd target, etc.

[0104] Alarm configuration management is used to configure alarm rules and regularly send alarm information to the monitoring system. Users can configure alarm rules according to their needs.

[0105] The above-mentioned monitoring method for developing microservices automates the monitoring of microservices. Development and operation and maintenance do not need to care about the service deployment method and monitoring configuration issues. Monitoring is added when the service is online and deleted when the service is offline, which saves manpower for maintaining monitoring targets. Through indicator tracking, the access address is registered in etcd and embedded in the development framework. After the service is online and deployed successfully, it is automatically added to the monitoring, and some cmdb information is added to each collected metadata, such as app_id, language, group. In this way, the monitoring data and cmdb data can be associated, laying the foundation for subsequent data analysis and alarm self-healing. After the alarm is generated, it can be associated with the basic information maintained in cmdb, development and testing personnel information, CI&CD information, container information, network information, and the alarm information content can be written very well and sent to the development, and even the solution button can be sent to the development for operation.

[0106] It should be understood that, although the various steps in the above-mentioned flow chart 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 is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-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 sub-steps or stages of other steps.

[0107] In one embodiment, Figure 6 As shown, a microservice monitoring device 200 is provided, comprising:

[0108] The configuration information acquisition module 201 is used to periodically acquire the configuration information of the microservice to be monitored from the configuration management system, where the configuration information of the microservice to be monitored is generated based on the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0109] The monitoring data acquisition module 202 is used to obtain monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored;

[0110] The alarm module 203 is used to determine whether to issue an alarm for the monitoring data of the monitored microservice according to the alarm rule.

[0111] In one embodiment, the microservice monitoring device 200 further includes:

[0112] A static information acquisition module is used to obtain static information of the microservice to be monitored from the configuration center through the configuration management system. The static information includes the service identifier of the microservice to be monitored;

[0113] The dynamic information acquisition module is used to obtain the dynamic information of the microservice to be monitored from the registration center through the configuration management system according to the service identifier of the microservice to be monitored;

[0114] The configuration information generation module is used to construct the configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored through the configuration management system.

[0115] In one embodiment, the microservice monitoring device 200 further includes:

[0116] A data storage module is used to save the configuration information of the microservice to be monitored in the form of a file through the configuration management system to obtain a configuration file of the microservice to be monitored; or

[0117] Register the configuration information of the microservice to be monitored through the configuration management system.

[0118] In one embodiment, when the configuration information is a configuration file, the microservice monitoring device 200 further includes:

[0119] The monitoring module is used to monitor the configuration files of the microservices to be monitored;

[0120] The monitored service update module is used to update the monitored microservice according to the changed configuration file of the monitored microservice when the configuration file of the monitored microservice changes.

[0121] In one embodiment, the microservice monitoring device 200 further includes:

[0122] The monitoring module is used to monitor the dynamic information of the registration center;

[0123] The configuration information update module is used to update the configuration information of the microservice to be monitored in the configuration management system according to the changed dynamic information of the registration center when the dynamic information of the registration center changes.

[0124] In one embodiment, the microservice monitoring device 200 further includes:

[0125] The configuration information acquisition module 201 is used to periodically traverse the configuration information of the microservice to be monitored in the configuration management system, and obtain the dynamic information of the microservice to be monitored from the registration center according to the service identifier contained in the static information of the configuration information.

[0126] The monitoring data collection module 202 is used to obtain the monitoring data of the microservice to be monitored based on the dynamic information.

[0127] In one embodiment, the static information also includes a custom tag of the microservice to be monitored. The monitoring data collection module 202 is further used to mark the monitoring data according to the custom tag of the microservice to be monitored to obtain the monitoring data carrying the custom tag.

[0128] In one embodiment, the configuration information acquisition module 201 is specifically used to periodically acquire the configuration information of the microservice to be monitored from the configuration management system through an http interface.

[0129] In one embodiment, the alarm module 203 is specifically used to generate alarm information for alerting the microservice to be monitored currently, and send the alarm information if the monitoring data of the microservice to be monitored currently meets the alarm rule.

[0130] In one embodiment, Figure 7 As shown, a microservice monitoring device 300 is provided, including:

[0131] The static information acquisition module 301 is used to acquire the static information of the microservice to be monitored from the configuration center, where the static information includes the identifier of the microservice to be monitored;

[0132] The dynamic information acquisition module 302 is used to acquire the dynamic information of the microservice to be monitored from the registration center according to the identifier of the microservice to be monitored;

[0133] The configuration information building module 303 is used to build the configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored;

[0134] The configuration information sending module 304 is used to send the configuration information of the microservice to be monitored to the monitoring system at a regular interval, so that the monitoring system can obtain the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0135] Figure 8 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The monitoring system 110 (or configuration management system 120) in FIG. Figure 8 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a microservice monitoring method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a microservice monitoring method. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0136] Those skilled in the art will understand that Figure 8 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.

[0137] In one embodiment, the microservice monitoring device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 8 The computer device shown in the figure is run on the computer device. The memory of the computer device can store various program modules that constitute the microservice monitoring device, such as: Figure 6The configuration information acquisition module 20A, the monitoring data collection module 202 and the alarm module 203 are shown. Figure 7 The static information acquisition module 301, dynamic information acquisition module 302, configuration information construction module 303 and configuration information delivery module 304 are shown. The computer program composed of each program module enables the processor to execute the steps of the microservice monitoring method of each embodiment of the present application described in this specification.

[0138] For example, Figure 8 The computer device shown can be Figure 6 The configuration information acquisition module 201 in the microservice monitoring device 200 shown in the figure executes to obtain the configuration information of the microservice to be monitored from the configuration management system at a fixed time, and the configuration information of the microservice to be monitored is generated according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored. The computer device can obtain the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored through the monitoring data acquisition module 202. The computer device can determine whether to alarm the monitoring data of the microservice to be monitored according to the alarm rules through the alarm module 203.

[0139] For example, Figure 8 The computer device shown can be Figure 7 The static information acquisition module 301 in the microservice monitoring device 300 shown in the figure acquires static information of the microservice to be monitored from the configuration center, and the static information includes the identification of the microservice to be monitored. The computer device can acquire dynamic information of the microservice to be monitored from the registration center according to the identification of the microservice to be monitored through the dynamic information acquisition module 302. The computer device can construct the configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored through the configuration information construction module 303. The computer device can execute the timing of sending the configuration information of the microservice to be monitored to the monitoring system through the configuration information sending module 304, so that the monitoring system can obtain the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored.

[0140] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps in any embodiment of the above-mentioned microservice monitoring method are implemented.

[0141] 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 any embodiment of the above-mentioned microservice monitoring method are implemented.

[0142] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any embodiment of the above-mentioned microservice monitoring method.

[0143] 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 program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0144] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0145] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A microservice monitoring method, characterized in that: Applied to a monitoring system, the method comprises: Obtaining configuration information of the microservice to be monitored from the configuration management system at regular intervals. The configuration information of the microservice to be monitored is generated by the configuration management system according to the static information of the microservice to be monitored obtained from the configuration center and the dynamic information of the microservice to be monitored obtained from the registration center. The configuration information includes the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment and the development language; Acquire monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored; Determine whether to issue an alarm for the monitoring data of the microservice to be monitored according to the alarm rule; Through the configuration management system, the configuration information of the microservice to be monitored is registered in the distributed storage warehouse in the form of key value; Monitor the dynamic information of the registration center, where the registration center is used to implement service discovery registration. Service discovery registration means that the service monitors the TCP port and registers the TCP information in the distributed storage warehouse, so that other services can find the TCP address from the distributed storage warehouse through the service name. Services communicate with each other through the service name. The dynamic information of the registration center refers to the information that changes with the deployment and expansion of microservices; When the dynamic information of the registration center changes, the configuration information of the microservice to be monitored in the configuration management system is updated according to the changed dynamic information of the registration center.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining static information of the microservice to be monitored from a configuration center through the configuration management system, wherein the static information includes a service identifier of the microservice to be monitored; Obtaining dynamic information of the microservice to be monitored from a registration center through the configuration management system according to the service identifier of the microservice to be monitored; Through the configuration management system, configuration information of the microservice to be monitored is constructed according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored.

3. The method according to claim 2, characterized in that The method further comprises: The configuration information of the microservice to be monitored is saved in a file form through the configuration management system to obtain a configuration file of the microservice to be monitored.

4. The method according to claim 3, characterized in that When the configuration information is a configuration file, the method further includes: Monitor the configuration file of the microservice to be monitored; When the configuration file of the microservice to be monitored changes, the microservice to be monitored is updated according to the changed configuration file of the microservice to be monitored.

5. The method according to claim 1, characterized in that: The static information includes a service identifier, The periodically obtaining the configuration information of the microservice to be monitored from the configuration management system includes: periodically traversing the configuration information of the microservice to be monitored in the configuration management system, and obtaining the dynamic information of the microservice to be monitored from the registration center according to the service identifier contained in the static information of the configuration information; The acquiring, according to the configuration information of the microservice to be monitored, the monitoring data of the microservice to be monitored includes: acquiring, according to the dynamic information, the monitoring data of the microservice to be monitored.

6. The method according to claim 5, characterized in that The static information also includes a custom label of the microservice to be monitored. After acquiring the monitoring data of the microservice to be monitored according to the dynamic information, the method further includes: The monitoring data is marked according to the custom label of the microservice to be monitored to obtain the monitoring data carrying the custom label.

7. The method according to claim 1, characterized in that The periodically acquiring the configuration information of the microservice to be monitored from the configuration management system includes: The configuration information of the microservice to be monitored is obtained from the configuration management system at regular intervals through the application program interface.

8. The method according to claim 1, characterized in that: The method further comprises: If the monitoring data of the microservice to be monitored currently meets the alarm rule, alarm information for alerting the microservice to be monitored currently is generated and sent.

9. A microservice monitoring method, characterized in that: Applied to a configuration management system, the method comprises: Obtain static information of the microservice to be monitored from the configuration center, where the static information includes an identifier of the microservice to be monitored; According to the identifier of the microservice to be monitored, dynamic information of the microservice to be monitored is obtained from the registration center; According to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored, the configuration information of the microservice to be monitored is constructed, wherein the configuration information includes the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment and the development language; The configuration information of the microservice to be monitored is sent to the monitoring system at a regular interval so that the monitoring system can obtain the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored. The monitoring system is also used to register the configuration information of the microservice to be monitored in the distributed storage warehouse in the form of key value through the configuration management system; the dynamic information of the registration center is monitored, wherein the registration center is used to implement service discovery registration, and the service discovery registration means that the service listens to the TCP port and registers the TCP information in the distributed storage warehouse, so that other services can find the TCP address from the distributed storage warehouse through the service name, and the services communicate with each other through the service name. The dynamic information of the registration center refers to the information that changes with the deployment and expansion of the microservice; when the dynamic information of the registration center changes, the configuration information of the microservice to be monitored in the configuration management system is updated according to the changed dynamic information of the registration center.

10. A microservice monitoring device, characterized in that: The device comprises: A configuration information acquisition module is used to periodically acquire configuration information of the microservice to be monitored from the configuration management system. The configuration information of the microservice to be monitored is generated by the configuration management system based on the static information of the microservice to be monitored acquired from the configuration center and the dynamic information of the microservice to be monitored acquired from the registration center. The configuration information includes the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment and the development language; A monitoring data acquisition module, used to obtain monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored; An alarm module is used to determine whether to issue an alarm for the monitoring data of the microservice to be monitored according to the alarm rules; The device is also used to register the configuration information of the microservice to be monitored in the distributed storage warehouse in the form of key value through the configuration management system; Monitor the dynamic information of the registration center, where the registration center is used to implement service discovery registration. Service discovery registration means that the service monitors the TCP port and registers the TCP information in the distributed storage warehouse, so that other services can find the TCP address from the distributed storage warehouse through the service name. Services communicate with each other through the service name. The dynamic information of the registration center refers to the information that changes with the deployment and expansion of microservices; When the dynamic information of the registration center changes, the configuration information of the microservice to be monitored in the configuration management system is updated according to the changed dynamic information of the registration center.

11. A microservice monitoring device, characterized in that: Applied to a configuration management system, the device comprises: A static information acquisition module, used to acquire static information of the microservice to be monitored from the configuration center, wherein the static information includes an identifier of the microservice to be monitored; A dynamic information acquisition module, used to acquire the dynamic information of the microservice to be monitored from a registration center according to the identifier of the microservice to be monitored; A configuration information building module, used to build the configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored, wherein the configuration information includes the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment and the development language; A configuration information sending module is used to periodically send the configuration information of the microservice to be monitored to the monitoring system, so that the monitoring system can obtain the monitoring data of the microservice to be monitored according to the configuration information of the microservice to be monitored. The monitoring system is also used to register the configuration information of the microservice to be monitored in the distributed storage warehouse in the form of key value through the configuration management system; monitor the dynamic information of the registration center, wherein the registration center is used to implement service discovery registration, service discovery registration means that the service listens to the TCP port and registers the TCP information in the distributed storage warehouse, so that other services can find the TCP address from the distributed storage warehouse through the service name, and the services communicate with each other through the service name. The dynamic information of the registration center refers to the information that changes with the deployment and expansion of the microservice; when the dynamic information of the registration center changes, the configuration information of the microservice to be monitored in the configuration management system is updated according to the changed dynamic information of the registration center.

12. A microservice monitoring system, characterized in that: The system includes: a configuration center, a registration center, a configuration management system and a monitoring system. The configuration center is used to configure static information of the microservice to be monitored; The registration center is used to register the dynamic information of the microservice to be monitored; The configuration management system is used to obtain static information of the microservice to be monitored from the configuration center, wherein the static information includes the service identifier of the microservice to be monitored; obtain dynamic information of the microservice to be monitored from the registration center according to the service identifier of the microservice to be monitored, and construct configuration information of the microservice to be monitored according to the static information of the microservice to be monitored and the dynamic information of the microservice to be monitored, wherein the configuration information includes the name of the microservice, the access address of the microservice, the custom label of the microservice, the operating environment and the development language; The monitoring system is used to periodically obtain the configuration information of the microservice to be monitored from the configuration management system, obtain the monitoring data of the microservice to be monitored based on the configuration information of the microservice to be monitored, and determine whether to issue an alarm for the monitoring data of the microservice to be monitored based on the alarm rules; register the configuration information of the microservice to be monitored in the distributed storage warehouse in the form of key value through the configuration management system; monitor the dynamic information of the registration center, wherein the registration center is used to implement service discovery registration, service discovery registration means that the service monitors the TCP port and registers the TCP information in the distributed storage warehouse, so that other services can find the TCP address from the distributed storage warehouse through the service name, and the services communicate with each other through the service name, and the dynamic information of the registration center refers to the information that changes with the deployment and expansion of the microservice; when the dynamic information of the registration center changes, the configuration information of the microservice to be monitored in the configuration management system is updated according to the changed dynamic information of the registration center.

13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

14. 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 9 are implemented.

Citation Information

Patent Citations

  • Flexible micro-service monitoring framework architecture

    CN108833137A

  • Service monitoring method and system based on micro-service architecture

    CN109474685A