CN117194269A - Detection method, detection device, electronic equipment and computer medium - Google Patents

Detection method, detection device, electronic equipment and computer medium Download PDF

Info

Publication number
CN117194269A
CN117194269A CN202311248333.1A CN202311248333A CN117194269A CN 117194269 A CN117194269 A CN 117194269A CN 202311248333 A CN202311248333 A CN 202311248333A CN 117194269 A CN117194269 A CN 117194269A
Authority
CN
China
Prior art keywords
dependent item
detection
target
item
dependent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311248333.1A
Other languages
Chinese (zh)
Inventor
赵轩超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Futuo Network Technology Shenzhen Co ltd
Original Assignee
Futuo Network Technology Shenzhen Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Futuo Network Technology Shenzhen Co ltd filed Critical Futuo Network Technology Shenzhen Co ltd
Priority to CN202311248333.1A priority Critical patent/CN117194269A/en
Publication of CN117194269A publication Critical patent/CN117194269A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The disclosure discloses a detection method, a detection device, electronic equipment and a computer medium, wherein the detection method comprises the following steps: responding to the starting operation of the current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends; detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item; and when the target detection result indicates that the dependent item has an operation fault, displaying alarm information, wherein the alarm information is used for indicating that the dependent item has the operation fault. The technical scheme provided by the embodiments of the present disclosure can play a role in improving the detection efficiency for the service on which the micro service depends and the operation condition of the third party middleware.

Description

Detection method, detection device, electronic equipment and computer medium
Technical Field
The disclosure belongs to the technical field of service architecture, and in particular relates to a detection method, a detection device, electronic equipment and a computer medium.
Background
In the age of micro services, individual services have relied on other third party middleware in addition to other micro services (e.g., transaction services rely on corporate/tax/wind control, etc. services). In the related art, related components are generally used to monitor other services on which the current service depends to obtain health conditions of the other services, however, the components cannot directly detect the operation conditions of the third party middleware or the external services, so that the detection efficiency of the operation conditions of the third party middleware on which the micro service depends is low.
Disclosure of Invention
The embodiment of the disclosure provides an implementation scheme different from the related art, so as to solve the technical problem of low detection efficiency of the related art on the running condition of the third party middleware on which the micro service depends.
In a first aspect, the present disclosure provides a detection method, comprising:
responding to the starting operation of the current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends;
Detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item;
and when the target detection result indicates that the dependent item has an operation fault, displaying alarm information, wherein the alarm information is used for indicating that the dependent item has the operation fault.
In a second aspect, the present disclosure provides a detection apparatus comprising:
the system comprises an acquisition unit, a detection unit and a control unit, wherein the acquisition unit is used for responding to the starting operation of a current service, reading a preset configuration file corresponding to the current service, so as to acquire detection configuration information corresponding to the current service, wherein the detection configuration information comprises corresponding detection period information of a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends;
the detection unit is used for detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item;
and the display unit is used for displaying alarm information when the target detection result indicates that the dependent item has an operation fault, and the alarm information is used for indicating that the dependent item has the operation fault.
In a third aspect, the present disclosure provides an electronic device comprising:
A processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform any one of the methods of the first aspect, each possible implementation of the first aspect, via execution of the executable instructions.
In a fourth aspect, embodiments of the present disclosure provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements any of the methods of the first aspect, each possible implementation of the first aspect.
The method comprises the steps of responding to the starting operation of a current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends; detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item; when the target detection result indicates that the dependent item has an operation fault, alarm information is displayed, wherein the alarm information is used for indicating a scheme of the dependent item having the operation fault, and the detection configuration information obtained by reading a preset configuration file can be utilized to directly carry out health detection on external services and third-party middleware on which the current service depends, without carrying out a complex detection process, so that the detection efficiency of the operation conditions of the services and the third-party middleware on which the micro-service depends is improved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the related art, a brief description will be given below of the drawings required for the embodiments or the related technical descriptions, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings may be obtained according to the drawings without any inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 is a flow chart of a detection method according to an exemplary embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a current service dependent external service or middleware provided by an exemplary embodiment of the present disclosure;
FIG. 3 is a schematic diagram of detecting configuration information according to an exemplary embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a target detection mode corresponding to each dependency item according to an exemplary embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a detection device according to an exemplary embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings, are described in detail below. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present disclosure and are not to be construed as limiting the present disclosure.
The terms first and second and the like in the description, the claims and the drawings of embodiments of the disclosure are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the disclosure described herein may be capable of implementation in sequences other than those illustrated or described herein, for example. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms in the embodiments of the present disclosure are explained below to facilitate understanding by those skilled in the art.
Micro-services: a variant of a software development technology-service oriented architecture style advocates the division of a single application into a small set of services that coordinate and interwork with each other to provide a final value to the user.
MySQL (full name My Structured Query Language) is a relational database management system.
Redis (Remote Dictionary Server), the remote dictionary service, is an open source database and provides a multi-lingual application programming interface.
RabbitMQ (Message Queue) is open source Message broker software (also known as Message oriented middleware) that implements the advanced Message queuing protocol.
The elastsearch is a distributed search and analysis engine.
In the age of micro services, single services have relied on other third party middleware (such as mysql/redis/rmq/es) in addition to other micro services (e.g., transaction services rely on corporate/tax/wind control, etc. services). In the related art, related components are generally used to monitor other services on which the current service depends to obtain health conditions of the other services, however, the components cannot directly detect the operation conditions of the third party middleware or the external services, so that the detection efficiency of the operation conditions of the third party middleware on which the micro service depends is low. For this reason, the disclosure provides a detection method, a device, an electronic apparatus, and a computer medium, which are used for solving the technical problem in the related art that the detection efficiency for the running condition of the third party middleware on which the micro service depends is low.
Fig. 1 is a flowchart of a detection method according to an exemplary embodiment of the present disclosure, where the method may be applied to a server device, and the method includes at least the following steps S11 to S13:
s11, responding to the starting operation of the current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends;
in some embodiments, the server device may include, but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
In some embodiments, multiple services may be included in a micro-service architecture. A service refers to an independent functional module or business component that may contain one or more independently deployed micro-services that are responsible for handling specific business logic or providing specific functions. For example, the plurality of services may include: ESOP services (Employee Stock Ownership Plans, corporate employee stock plan for corporate to staff), transaction services (responsible for handling operations such as creation, payment, cancellation, etc. of orders), tax services (responsible for tax calculation, tax inquiry, etc.), management monitoring services (responsible for monitoring, managing and maintaining the running status and status of the whole system), mail services (responsible for sending e-mails, e.g. account confirmation mails, order confirmation mails, etc.), user services (responsible for managing operations such as registration, login, rights management, etc. of users), payment services (responsible for interacting with third party payment systems, handling payment requests and payment status updates), etc. The current service may be any one of the plurality of services.
In some embodiments, the preset configuration file may be preconfigured by a user, and the user may be a related manager, where the preset configuration file corresponding to the current service includes detection configuration information corresponding to the current service.
FIG. 2 is a schematic diagram of a service or middleware external to the current service dependency, which may be other services (e.g., transaction service, tax service, and management monitoring service in FIG. 2), as shown in FIG. 2, according to an exemplary embodiment of the present disclosure, i.e., a third party middleware, e.g., mySQL, redis, rabbitMQ, elasticsearch, etc.
Fig. 3 is a schematic diagram of detection configuration information according to an exemplary embodiment of the present disclosure, and as shown in fig. 3, detection period information included in the detection configuration information may be global configuration information, that is, detection periods for all dependent items on which a current service depends.
In some embodiments, the detection period information includes a detection threshold and a plurality of periods. The detection threshold may represent a maximum number of allowed continuous detection failures, and when the number of continuous detection failures exceeds the detection threshold, the period may be switched to perform detection again.
Alternatively, one array may be used to represent the period, for example, when a plurality of periods are included in the detection period information, the plurality of periods may be represented as [ t ] 1 ,t 2 ,t 3 ,...,t n ]. Wherein n is a positive integer, t n Represents any period, t n In seconds(s).
In some embodiments, the detection period information may also include only one period, e.g., the detection period information may be denoted as [10], i.e., the dependency is detected every 10 seconds.
In some embodiments, the detection configuration information may further include class information to be detected (as shown in fig. 3), where the class information to be detected includes a name of a dependency to be detected, a period of the dependency to be detected, and blacklist information, and the period of the dependency to be detected may be local configuration information, that is, a detection period of the dependency for a portion on which the current service depends.
In some embodiments, the detection configuration information may further include blacklist information, where the blacklist information may include one or more dependent items of the current service, and detection may not be required for the dependent items of the current service included in the blacklist information.
In some embodiments, the detection configuration information may further include switch configuration information, where the switch configuration information is global configuration information, that is, the switch configuration information is configuration information of whether all dependency items are turned on for dependency item detection.
The server device reads a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service so as to automatically start the detection of the dependent items, specifically, the server device can read detection configuration information such as switch configuration information, detection period information and the like in the preset configuration file, and when the switch configuration information is identified as starting the detection of the dependent items, health detection is carried out on each dependent item according to the detection period information corresponding to each dependent item.
Further, considering that the dependency items used for implementing different services are different, before reading the preset configuration file corresponding to the current service, the method may further include: acquiring calling link information of services or middleware in a micro-service architecture in the current service running process, wherein the calling link can be used for representing the execution sequence of different micro-services or external dependency items in the micro-service architecture when realizing the service function corresponding to the current service; further, based on the interface parameters of each called service or middleware in the call link information, the external service or middleware is determined, and the dependency is obtained. Specifically, after the current interface parameter is obtained, the interface parameter may be decomposed based on a hierarchical structure between the interface parameter (such as a domain name and/or an interface path) and a reference interface parameter in the micro-service architecture, so as to obtain a plurality of first hierarchical parameters corresponding to the interface parameter and a plurality of second hierarchical parameters corresponding to the reference interface parameter, for example, taking the current interface parameter is "API/v3.2/example", where the first hierarchical parameters may include URI prefix parameters "API/v3.2/" and resource path parameters "example", etc.; and then, based on the structural similarity, calculating the similarity between the first level parameters and the second level parameters of the same level in a plurality of first level parameters corresponding to the interface parameters and a plurality of second level parameters corresponding to the reference interface parameters, and further determining the matching degree of the interface parameters and the reference interface parameters in the micro-service architecture according to the similarity of each level through the following formula.
C= 1 SIM 1 + 2 SIM 2 +…+ n SIM n
Wherein, C is used for indicating the matching degree; alpha i (i=1,2 …, n) for indicating the weight of the ith hierarchy, alpha i With i increasing, decreasing exponentially, all alpha i The sum of the addition of the values of (2) is equal to 1; SIM (subscriber identity Module) i For indicating the similarity of the ith hierarchy; n is equal to the number of layers of the current interface parameter. If the matching degree between the current interface parameter and the reference interface parameter in the micro-service architecture is smaller than a preset threshold, determining that the dependent item or the micro-service corresponding to the current interface parameter is an external dependent item, and if the matching degree between the current interface parameter and the reference interface parameter in the micro-service architecture is larger than or equal to the preset threshold, determining that the dependent item or the micro-service corresponding to the current interface parameter is not an external dependent item.
S12, detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item;
in some embodiments, the target detection result may be a target detection result for indicating that the dependent item is not faulty, or a target detection result for indicating that the dependent item is faulty.
In some embodiments, the dependency failing may include the following: connection errors (inability to establish a valid connection with a dependency, such as inability to connect to MySQL database, redis server, robbermq message queues, etc.), in response to a timeout (inability to get a response within a preset duration when a request is sent or an operation is performed to a dependency), return an error code or exception result (the dependency may return an error code, an exception object or error information indicating that the operation was not successfully performed or an exception occurred) data loss or corruption (e.g., table or field data loss in MySQL database, redis key value data corruption, robbermq message loss or elastiscearch index data corruption), downtime or crashes (e.g., mySQL database service halt, redis service crash, rabbermq node unavailability or elastearch node downtime), etc.
Specifically, based on the detection period information, the dependent item is detected to obtain a target detection result corresponding to the dependent item, specifically, a certain request information is sent to the dependent item according to the detection period information, and the target detection result corresponding to the dependent item is determined according to the response information of the dependent item to the request information.
In some optional embodiments provided in the present disclosure, in S12, detecting the dependency term based on the detection period information to obtain a target detection result corresponding to the dependency term, including S121-S123:
s121, sequencing a plurality of periods included in the detection period information corresponding to the dependent item from small to large;
s122, taking a period arranged at the first bit in the plurality of periods as a target period;
and S123, detecting the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
The minimum period in a plurality of periods is used for detecting the dependent item, real-time data or feedback information can be obtained, the dependent item can be found out in time when faults occur, corresponding measures can be taken rapidly, and the running stability of the dependent item is improved.
In some optional embodiments provided by the present disclosure, the method further comprises S124-S125:
s124, if the target detection result indicates that the dependent item has faults, determining the detection times of the fault of the dependent item which is continuously detected currently;
and S125, returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item when the detection times are smaller than the detection threshold. In some optional embodiments provided by the present disclosure, the method further comprises S126-S127:
s126, under the condition that the detection times are equal to the detection threshold value, resetting the detection times of the current continuous detection of the occurrence of faults of the dependent item;
and S127, taking the period arranged next to the target period in the plurality of periods as a new target period, and returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
In some embodiments, the detection period information may be an array, where each element in the array represents one period. For example, the detection period information may be [2,20,3600], i.e., using array [2,20,3600] to represent multiple periods; the detection threshold may be 5, and the minimum period 2(s) in the multiple periods is first used as a target period, the dependency is detected, if the dependency is failed to be detected, the number of times of continuously detecting that the dependency is failed is obtained, and one is added on the basis of the number of times of continuously detecting that the dependency is failed, so as to obtain the current number of times of continuously detecting that the dependency is failed. If the number of times of detecting that the dependent item is continuously detected to be faulty does not exceed 5, detecting the dependent item continuously with 2(s) as a target period. When the number of times of detecting the fault of the dependent item is equal to the detection threshold 5, the number of times of detecting the fault of the dependent item is cleared, a period 20 (S) arranged next to the period 2 (S) is taken as a new target period among the plurality of periods represented by the array [2,20,3600], the dependent item is detected based on the target period 20 (S), that is, the S123 is returned, the dependent item is detected based on the target period, and a target detection result corresponding to the dependent item is obtained.
In some embodiments, if the target detection result indicates that the dependency has not failed, returning to S122 to take the first cycle of the multiple cycles as a target cycle; and detecting the dependent item based on the target period.
According to the scheme, the detection period is automatically adjusted according to the target detection result of the dependent item, so that the condition that the running condition of the dependent item is frequently detected when the dependent item fails can be avoided, and consumption of system resources (such as network bandwidth and computing resources) is reduced; in addition, when the fault of the dependent item is continuously detected, more recovery time can be given to the dependent item by gradually increasing the detection period, so that the fault tolerance of the dependent item is improved, and the dependent item has more opportunities to recover from an error state and change to a normal state again; once the dependency item is restored to normal, the running condition of the dependency item can be frequently detected immediately, so that the stability of the dependency item is ensured, and the detection efficiency is effectively improved.
In some optional embodiments provided in the present disclosure, when the dependent item is an external middleware on which the current service depends, in S123, the dependent item is detected based on the target period, to obtain a target detection result corresponding to the dependent item, including S1201-S1203:
S1201, acquiring a target type of the dependent item, wherein the target type is any one of the following types: database type, message queue type, and search engine type;
s1202, determining a target detection mode corresponding to the dependent item based on the target type;
FIG. 4 is a schematic diagram of a target detection manner corresponding to each dependency item provided in an exemplary embodiment of the present disclosure, such as FIG. 4, mySQL, redis, elasticSearch, and RabbitMQ may be middleware that depends on a current service, where MySQL, redis belong to a dependency item of a database type, and elastic search belongs to a dependency item of a search engine type; rabbitMQ belongs to a dependency of message queue type.
In some embodiments, when the target type is a database type, the target detection manner corresponding to the dependency term is: and a first detection mode for detecting the corresponding dependent item by using a preset command.
In some embodiments, when the target type is a search engine type, the target detection manner corresponding to the dependency term is: and a second detection mode for detecting the corresponding dependent item based on the state identification of the dependent item.
In some embodiments, when the target type is a message queue type, the target detection manner corresponding to the dependency term is: and judging whether the dependent item comprises a preset queue or not so as to detect the dependent item in a third detection mode.
And S1203, detecting the dependent item based on the target period and the target detection mode to obtain a target detection result corresponding to the dependent item.
In some embodiments, a health detection component may be installed in the current service, specifically in a third party package, and the dependency is detected by the health detection component (e.g., fig. 4), which may be a tool or module for detecting and evaluating the status and health of a system, service, or application.
In some optional embodiments provided in the present disclosure, when the target detection manner is a first detection manner of detecting a corresponding dependency term by using a preset command, in S1203, detecting the dependency term based on the target period and the target detection manner, to obtain a target detection result corresponding to the dependency term, including:
transmitting the preset command based on the target period;
if the response information corresponding to the preset command is received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item does not have faults;
if the response information corresponding to the preset command is not received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item fails.
Specifically, the request information sent to the dependent item may be a preset command; the health detection component can send a preset command to the dependent item with the type of the database type according to the target period, and real-time detect response information returned from the dependent item to the health detection component, if the response information is received within a preset time period, the dependent item can be determined to have no fault, and if the response information is not received within the preset time period, the dependent item can be determined to have fault. In some embodiments, the preset command may be a ping command (as shown in fig. 4).
In some optional embodiments provided in the present disclosure, when the target detection manner is a second detection manner of detecting a corresponding dependency item based on the state identifier of the dependency item, in S1203, detecting the dependency item based on the target period and the target detection manner to obtain a target detection result corresponding to the dependency item, including:
acquiring a state identifier of the dependent item based on the target period;
when the state identifier is a preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item does not have faults;
And when the state identifier is not the preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item has faults.
Specifically, the request information sent to the dependent item may be request information requesting the dependent item to return a status identifier; the dependent item can respond to the request information and send a message carrying a state identifier to the health detection component, the health detection component can match the state identifier of the message with a pre-stored preset identifier after receiving the state identifier, if the state identifier which is currently sent by the dependent item is matched with the preset identifier, the dependent item can be determined to have no fault, and if the state identifier which is currently sent by the dependent item is matched with the preset identifier, the dependent item can be determined to have a fault.
In some embodiments, the status identification of the dependency may be obtained through the WaitForGreenStatus command in fig. 4, which is a command to wait for the status of the elastic search cluster to change to "green". The preset state identifier may be "green", and when the cluster state is "green", it indicates that the cluster is healthy and all the copy slices have been allocated and activated, that is, it indicates that the dependency item has not failed.
In some optional embodiments provided in the present disclosure, when the target detection manner is a third detection manner for detecting the dependent item by determining whether the dependent item includes a preset queue, in S1203, detecting the dependent item based on the target period and the target detection manner, to obtain a target detection result corresponding to the dependent item, including:
judging whether the dependency term comprises the preset queue or not based on the detection period information;
when the dependency item comprises the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item does not have faults;
and when the dependency item does not comprise the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item breaks down.
Specifically, the request information sent to the dependent item may be information for reading a relevant parameter of an interface of the dependent item; the dependent item responds to the request information and sends interface information of the dependent item to the health detection component, the health detection component obtains the interface information of the dependent item, and the queue information used by the current service is identified through the interface information so as to detect whether the queue information used by the current service comprises a preset queue or not.
Referring to fig. 4, taking a preset queue as a rabitmq queue as an example, whether the dependency item includes the preset queue may be determined by detecting whether a direct queue exists in a default switch corresponding to the dependency item. A direct queue exists in a default switch corresponding to the dependent item, which means that the dependent item comprises a preset queue, and the dependent item can be determined that no fault exists; and the default switch corresponding to the dependent item does not have a direct queue, which means that the dependent item does not include a preset queue, and the dependent item can be determined to have a fault. The direct queue is a message queue mode, and belongs to an implementation mode of an AMQP (Advanced Message Queuing Protocol, advanced message queue protocol). In direct queue mode, messages are sent to a particular queue and messages are routed to one or more consumers bound to that queue.
In some optional embodiments provided in the present disclosure, when the dependent item is a service external to the current service, in S12, detecting the dependent item based on the detection period information, to obtain a target detection result corresponding to the dependent item, including:
And calling an interface provided by a communication framework of the dependent item based on the detection period information to detect the dependent item to obtain a target detection result corresponding to the dependent item, wherein the communication framework is used for communication among a plurality of services.
In some embodiments, referring to fig. 2, the item-dependent communication framework may be an FRPC (Fast Remote Procedure Call ) framework, or may be another non-FRPC framework. When the communication framework of the dependent item is an FRPC framework, the interface provided by the communication framework of the dependent item can be a detection interface (Check interface) of the FRPC framework; when the communication framework of the dependent item is other than an FRPC framework, the interface provided by the communication framework of the dependent item can be a simple idempotent interface provided by the dependent item, such as a GET type interface, wherein the GET type interface is a common HTTP (Hypertext Transfer Protocol ) request method and is used for acquiring resources, data and the like.
In the scheme, the dependency items of different types are detected in a targeted manner, and a proper detection method can be selected, so that the actual running condition of the dependency items can be better known, different scenes and changes can be adapted, and the expansibility and maintainability of the detection mode are effectively improved.
In some embodiments, the detection period information corresponding to the different types of dependent items may be different, i.e., different detection period information is set for the different types of dependent items.
For example, for a Web application, common types of dependencies include database type, cache type, message queue type, and so on. The dependency item of the database type is an important component of the application program, and a smaller period (such as 1 s) can be set to ensure the normal operation of the dependency item of the database type; for the dependent item of the cache type, a proper larger period (such as 30s or 60 s) can be set, because the importance of the dependent item of the cache type is relatively low, and the normal operation of the application program is less affected by the occurrence of operation faults; for the dependency of the message queue type, the evaluation can be performed according to the factors such as the processing capacity, the message quantity and the like, and the proper period is set.
In addition, the dependency item can be detected by using an asynchronous detection mode and increasing the number of detection threads, so that different detection environments and scenes can be better adapted, and multi-dimensional optimization and adjustment can be performed according to specific situations.
According to the scheme, fine granularity configuration can be carried out aiming at different types of dependent items, and the detection period is adjusted according to actual conditions, so that the detection efficiency, accuracy and flexibility are improved as much as possible on the premise of ensuring the system stability.
And S13, when the target detection result indicates that the dependent item has an operation fault, displaying alarm information, wherein the alarm information is used for indicating that the dependent item has the operation fault.
In some embodiments, the health detection component may print the target detection results into a log file, and analyze and process the target detection results.
In some embodiments, the alarm information may be audio information or text information, which is used to inform relevant manager that the dependency item has operation failure, and to perform maintenance in time, so as to improve stability and maintainability of service. In addition, the target detection result can be stored and archived so as to facilitate subsequent analysis and troubleshooting.
The method comprises the steps of responding to the starting operation of a current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends; detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item; when the target detection result indicates that the dependent item has an operation fault, alarm information is displayed, wherein the alarm information is used for indicating a scheme of the dependent item having the operation fault, and the detection configuration information obtained by reading a preset configuration file can be utilized to directly carry out health detection on external services and third-party middleware on which the current service depends, without carrying out a complex detection process, so that the detection efficiency of the operation conditions of the external services and the third-party middleware on which the micro service depends is improved.
Fig. 5 is a schematic structural diagram of a detection device according to an exemplary embodiment of the present disclosure, where the detection device includes:
the obtaining unit 51 is configured to respond to the start of operation of a current service, and read a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, where the detection configuration information includes corresponding detection period information of a dependent item of the current service, and the dependent item is an external service or middleware on which the current service depends;
a detection unit 52, configured to detect the dependent item based on the detection period information, to obtain a target detection result corresponding to the dependent item;
and the display unit 53 is configured to display alarm information when the target detection result indicates that the dependent item has an operation failure, where the alarm information is used to indicate that the dependent item has an operation failure.
In some optional embodiments provided in the present disclosure, the detection period information includes a detection threshold and a plurality of periods, and the detection unit 52 is specifically configured to, when configured to detect the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item:
Sequencing a plurality of periods included in the detection period information corresponding to the dependent items from small to large;
taking a period arranged at the first bit in the plurality of periods as a target period;
and detecting the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
In some optional embodiments provided by the present disclosure, the detection device is further configured to:
if the target detection result indicates that the dependent item has faults, determining the detection times of the fault of the dependent item which is continuously detected currently;
and under the condition that the detection times are smaller than the detection threshold value, returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
In some optional embodiments provided by the present disclosure, the detection device is further configured to:
under the condition that the detection times are equal to the detection threshold value, resetting the detection times when the current continuous detection of the occurrence of faults of the dependent item is performed;
and taking the period arranged next to the target period in the plurality of periods as a new target period, and returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
In some optional embodiments provided in the present disclosure, when the dependent item is an external middleware on which the current service depends, the detecting unit 52 is configured to detect, based on the target period, the dependent item, and obtain a target detection result corresponding to the dependent item, where the detection unit is specifically configured to:
obtaining a target type of the dependent item, wherein the target type is any one of the following types: database type, message queue type, and search engine type;
determining a target detection mode corresponding to the dependent item based on the target type;
and detecting the dependent item based on the target period and the target detection mode to obtain a target detection result corresponding to the dependent item.
In some optional embodiments provided in the present disclosure, when the target detection manner is a first detection manner of detecting a corresponding dependency term by using a preset command, the detection unit is configured to detect the dependency term based on the target period and the target detection manner, and obtain a target detection result corresponding to the dependency term, where the detection unit is specifically configured to:
transmitting the preset command based on the target period;
If the response information corresponding to the preset command is received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item does not have faults;
if the response information corresponding to the preset command is not received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item fails.
In some optional embodiments provided in the present disclosure, when the target detection manner is a second detection manner of detecting a corresponding dependency item based on the state identifier of the dependency item, the detection unit 52 is specifically configured to, when detecting the dependency item based on the target period and the target detection manner to obtain a target detection result corresponding to the dependency item:
acquiring a state identifier of the dependent item based on the target period;
when the state identifier is a preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item does not have faults;
and when the state identifier is not the preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item has faults.
In some optional embodiments provided in the present disclosure, when the target detection manner is a third detection manner for detecting the dependent item by determining whether the dependent item includes a preset queue, the detection unit is configured to, when detecting the dependent item based on the target period and the target detection manner, obtain a target detection result corresponding to the dependent item, specifically configured to:
judging whether the dependency term comprises the preset queue or not based on the target period;
when the dependency item comprises the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item does not have faults;
and when the dependency item does not comprise the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item breaks down.
In some optional embodiments provided in the present disclosure, when the dependent item is a service external to the current service, the detecting unit 52 is configured to detect the dependent item based on the detection period information, and obtain a target detection result corresponding to the dependent item, and is specifically configured to:
And calling an interface provided by a communication framework of the dependent item based on the detection period information to detect the dependent item to obtain a target detection result corresponding to the dependent item, wherein the communication framework is used for communication among a plurality of services.
It should be understood that apparatus embodiments and method embodiments may correspond with each other and that similar descriptions may refer to the method embodiments. To avoid repetition, no further description is provided here. Specifically, the apparatus may perform the above method embodiments, and the foregoing and other operations and/or functions of each module in the apparatus are respectively for corresponding flows in each method in the above method embodiments, which are not described herein for brevity.
It will be appreciated that in the specific embodiments of the disclosure, related data such as detection configuration information is involved, and when the above embodiments of the disclosure are applied to specific products or technologies, user permissions, agreements or authorizations need to be obtained, and collection, use and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
The apparatus of the embodiments of the present disclosure are described above in terms of functional modules with reference to the accompanying drawings. It should be understood that the functional module may be implemented in hardware, or may be implemented by instructions in software, or may be implemented by a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present disclosure may be implemented by an integrated logic circuit of hardware in a processor and/or an instruction in software form, and the steps of the method disclosed in connection with the embodiments of the present disclosure may be directly implemented as a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. Alternatively, the software modules may be located in a well-established storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, and the like. The storage medium is located in a memory, and the processor reads information in the memory, and in combination with hardware, performs the steps in the above method embodiments.
Fig. 6 is a schematic block diagram of an electronic device provided by an embodiment of the present disclosure, which may include:
a memory 701 and a processor 702, the memory 701 being for storing a computer program and for transmitting the program code to the processor 702. In other words, the processor 702 may call and run a computer program from the memory 701 to implement the methods in the embodiments of the present disclosure.
For example, the processor 702 can be configured to perform the method embodiments described above in accordance with instructions in the computer program.
In some embodiments of the present disclosure, the processor 702 may include, but is not limited to:
a general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
In some embodiments of the present disclosure, the memory 701 includes, but is not limited to:
volatile memory and/or nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DR RAM).
In some embodiments of the present disclosure, the computer program may be partitioned into one or more modules that are stored in the memory 701 and executed by the processor 702 to perform the methods provided by the present disclosure. The one or more modules may be a series of computer program instruction segments capable of performing the specified functions, which are used to describe the execution of the computer program in the electronic device.
As shown in fig. 6, the electronic device may further include:
a transceiver 703, the transceiver 703 being connectable to the processor 702 or the memory 701.
The processor 702 may control the transceiver 703 to communicate with other devices, and in particular, may send information or data to other devices or receive information or data sent by other devices. The transceiver 703 may include a transmitter and a receiver. The transceiver 703 may further include antennas, the number of which may be one or more.
It will be appreciated that the various components in the electronic device are connected by a bus system that includes, in addition to a data bus, a power bus, a control bus, and a status signal bus.
The present disclosure also provides a computer storage medium having stored thereon a computer program which, when executed by a computer, enables the computer to perform the method of the above-described method embodiments. Alternatively, embodiments of the present disclosure also provide a computer program product comprising instructions which, when executed by a computer, cause the computer to perform the method of the method embodiments described above.
When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function, in whole or in part, according to embodiments of the present disclosure. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, functional modules in various embodiments of the present disclosure may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The foregoing is merely a specific embodiment of the disclosure, but the protection scope of the disclosure is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the disclosure, and it should be covered in the protection scope of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (12)

1. A method of detection comprising:
responding to the starting operation of the current service, reading a preset configuration file corresponding to the current service to obtain detection configuration information corresponding to the current service, wherein the detection configuration information comprises detection period information corresponding to a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends;
Detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item;
and when the target detection result indicates that the dependent item has an operation fault, displaying alarm information, wherein the alarm information is used for indicating that the dependent item has the operation fault.
2. The method according to claim 1, wherein the detection period information includes a detection threshold and a plurality of periods, and detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item includes:
sequencing a plurality of periods included in the detection period information corresponding to the dependent items from small to large;
taking a period arranged at the first bit in the plurality of periods as a target period;
and detecting the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
3. The method according to claim 2, wherein the method further comprises:
if the target detection result indicates that the dependent item has faults, determining the detection times of the fault of the dependent item which is continuously detected currently;
And under the condition that the detection times are smaller than the detection threshold value, returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
4. A method according to claim 3, characterized in that the method further comprises:
under the condition that the detection times are equal to the detection threshold value, resetting the detection times when the current continuous detection of the occurrence of faults of the dependent item is performed;
and taking the period arranged next to the target period in the plurality of periods as a new target period, and returning to execute the detection of the dependent item based on the target period to obtain a target detection result corresponding to the dependent item.
5. The method according to any one of claims 2-4, wherein when the dependent item is an external middleware on which the current service depends, detecting the dependent item based on the target period, to obtain a target detection result corresponding to the dependent item, includes:
obtaining a target type of the dependent item, wherein the target type is any one of the following types: database type, message queue type, and search engine type;
Determining a target detection mode corresponding to the dependent item based on the target type;
and detecting the dependent item based on the target period and the target detection mode to obtain a target detection result corresponding to the dependent item.
6. The method according to claim 5, wherein when the target detection mode is a first detection mode for detecting a corresponding dependent item by using a preset command, detecting the dependent item based on the target period and the target detection mode to obtain a target detection result corresponding to the dependent item, includes:
transmitting the preset command based on the target period;
if the response information corresponding to the preset command is received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item does not have faults;
if the response information corresponding to the preset command is not received within the preset time period, determining to obtain a target detection result corresponding to the dependent item and used for indicating that the dependent item fails.
7. The method of claim 5, wherein when the target detection mode is a second detection mode for detecting a corresponding dependency based on the state identifier of the dependency, detecting the dependency based on the target period and the target detection mode to obtain a target detection result corresponding to the dependency, comprising:
Acquiring a state identifier of the dependent item based on the target period;
when the state identifier is a preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item does not have faults;
and when the state identifier is not the preset state identifier, determining to obtain a target detection result which corresponds to the dependent item and is used for indicating that the dependent item has faults.
8. The method according to claim 5, wherein when the target detection manner is a third detection manner for detecting the dependent item by determining whether the dependent item includes a preset queue, detecting the dependent item based on the target period and the target detection manner, to obtain a target detection result corresponding to the dependent item, includes:
judging whether the dependency term comprises the preset queue or not based on the target period;
when the dependency item comprises the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item does not have faults;
and when the dependency item does not comprise the preset queue, determining to obtain a target detection result which corresponds to the dependency item and is used for indicating that the dependency item breaks down.
9. The method according to claim 1, wherein when the dependent item is a service external to the current service dependency, detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item, including:
and calling an interface provided by a communication framework of the dependent item based on the detection period information to detect the dependent item to obtain a target detection result corresponding to the dependent item, wherein the communication framework is used for communication among a plurality of services.
10. A detection apparatus, characterized by comprising:
the system comprises an acquisition unit, a detection unit and a control unit, wherein the acquisition unit is used for responding to the starting operation of a current service, reading a preset configuration file corresponding to the current service, so as to acquire detection configuration information corresponding to the current service, wherein the detection configuration information comprises corresponding detection period information of a dependent item of the current service, and the dependent item is external service or middleware on which the current service depends;
the detection unit is used for detecting the dependent item based on the detection period information to obtain a target detection result corresponding to the dependent item;
And the display unit is used for displaying alarm information when the target detection result indicates that the dependent item has an operation fault, and the alarm information is used for indicating that the dependent item has the operation fault.
11. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-9 via execution of the executable instructions.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any of claims 1-9.
CN202311248333.1A 2023-09-25 2023-09-25 Detection method, detection device, electronic equipment and computer medium Pending CN117194269A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311248333.1A CN117194269A (en) 2023-09-25 2023-09-25 Detection method, detection device, electronic equipment and computer medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311248333.1A CN117194269A (en) 2023-09-25 2023-09-25 Detection method, detection device, electronic equipment and computer medium

Publications (1)

Publication Number Publication Date
CN117194269A true CN117194269A (en) 2023-12-08

Family

ID=88984907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311248333.1A Pending CN117194269A (en) 2023-09-25 2023-09-25 Detection method, detection device, electronic equipment and computer medium

Country Status (1)

Country Link
CN (1) CN117194269A (en)

Similar Documents

Publication Publication Date Title
US10560465B2 (en) Real time anomaly detection for data streams
US11269718B1 (en) Root cause detection and corrective action diagnosis system
US11005730B2 (en) System, method, and apparatus for high throughput ingestion for streaming telemetry data for network performance management
US8595564B2 (en) Artifact-based software failure detection
US8966039B1 (en) End-to-end communication service monitoring and reporting
CN111913818A (en) Method for determining dependency relationship between services and related device
CN110362455B (en) Data processing method and data processing device
CN111861140A (en) Service processing method, device, storage medium and electronic device
US20070174462A1 (en) Reporting information to a network
CN113452607A (en) Distributed link acquisition method and device, computing equipment and storage medium
CN113242297A (en) Service system and service state adjusting method
US10248508B1 (en) Distributed data validation service
CN109510730A (en) Distributed system and its monitoring method, device, electronic equipment and storage medium
CN108156061B (en) esb monitoring service platform
US11153769B2 (en) Network fault discovery
CN117194269A (en) Detection method, detection device, electronic equipment and computer medium
CN110875832A (en) Abnormal service monitoring method, device and system and computer readable storage medium
CN111291127B (en) Data synchronization method, device, server and storage medium
US11582345B2 (en) Context data management interface for contact center
CN114090293A (en) Service providing method and electronic equipment
EP3756310B1 (en) Method and first node for managing transmission of probe messages
CN112148508A (en) Information processing method and related device
CN112596974A (en) Full link monitoring method, device, equipment and storage medium
US10970152B2 (en) Notification of network connection errors between connected software systems
US10296967B1 (en) System, method, and computer program for aggregating fallouts in an ordering system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination