Tuning progress tracking and problem positioning method and device
By obtaining and building top-level and secondary object groups in Kubernetes, combined with the time sorting algorithm, the cumbersomeness of tuning progress tracking and problem positioning is solved, and intuitive progress tracking and fast problem positioning is achieved.
Patent Information
- Application Number
- CN202311422941.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2025-07-29
AI Technical Summary
In the prior art, Kubernetes' tuning progress tracking method is complicated and has high requirements for users. Users need to understand the hierarchical relationship between top-level objects and secondary objects, and the tuning problem investigation process is complicated.
By obtaining all top-level objects and secondary object types of the target task, a group of associated objects is constructed, and a time sorting algorithm is used to locate problem events based on the association relationship between object state and event.
It realizes simple and intuitive tuning progress tracking and problem positioning, so users do not need to understand the hierarchy relationship of specific objects and quickly locate problems in the tuning process.
Smart Images

Figure CN120386705A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of automated operation and maintenance, and particularly relates to a tuning progress tracking and problem positioning method and device. Background Art
[0002] Kubernetes is the currently recognized de facto standard in the field of container orchestration. One of its design concepts is the declarative API + Control Loop, which is also known as the Operator Pattern, or simply Operator. Generally speaking, the declarative API is used to describe the final state that the user expects the system to reach, but does not specify how to do it specifically. The Control Loop is to continuously observe the gap between the current system state and the user's expected state, and then decide how to do it by itself to reach the user's expected state. For example, if the user wants a 5-node system, they only need to declare the number of nodes as 5 through the declarative API. The Control Loop will listen to the user's declaration, determine and execute several steps by itself, and finally generate a 5-node system. As for how many steps to divide into and how many nodes to generate in each step, etc., these are all determined by the Control Loop itself.
[0003] For an "operation", an Operator usually needs several "tunings" to complete. Therefore, users need a progress tracking method to understand the progress. By default, Kubernetes provides progress information through the current state of the object + object-related events, but this current state does not contain process information, and the object-related events are all events related to the object within one hour, which has no intuitive correlation with the specific operation.
[0004] At the same time, the method provided by Kubernetes only contains information about the top-level object and does not contain information about the secondary objects. This makes it necessary for users to further understand which specific secondary objects are included and view them one by one in order to know more detailed information. Such an operation is not only cumbersome but also requires users to master more prerequisite knowledge.
[0005] In addition, when a problem occurs during the tuning process, users usually need to understand the hierarchical relationship between the top-level object and the secondary objects, and check layer by layer and one by one to find the problem. This process is also very cumbersome and raises the threshold for problem troubleshooting. Summary of the Invention
[0006] A tuning progress tracking and problem positioning method provided by this application aims to solve the problems that the process is cumbersome and requires high requirements for users when determining the specific tuning progress and tuning problems in the prior art.
[0007] To achieve the above object, this application adopts the following technical solutions:
[0008] A method for tuning progress tracking and problem location of the present application includes the following steps:
[0009] Obtain all top-level object types and second-level object types corresponding to the target task, and determine all top-level objects and second-level objects based on each object type;
[0010] Construct several associated object groups according to the association relationship between each top-level object and second-level object, and determine all events corresponding to each of the associated object groups;
[0011] Determine whether the target task is completed according to the status of each top-level object. If not, sort all the events by time, and when a deviation occurs in tuning, locate the problem event according to the sorting result.
[0012] Preferably, the determining all top-level objects and second-level objects based on each object type includes:
[0013] Monitor each top-level object type to obtain all top-level objects and second-level objects included in each top-level object type.
[0014] Preferably, the second-level object type is defaulted to all types.
[0015] Preferably, the constructing several associated object groups according to the association relationship between each top-level object and second-level object includes:
[0016] Determine all second-level objects associated with each top-level object according to the ownerReference field, and set each top-level object and all its associated second-level objects as an associated object group.
[0017] Preferably, the determining whether the target task is completed according to the status of each top-level object includes:
[0018] Compare the current status of each top-level object with its expected status respectively. If all are the same, it is determined that the final state is reached and the target task is completed.
[0019] Preferably, the sorting all the events by time and when a deviation occurs in tuning, locating the problem event according to the sorting result includes:
[0020] Sort all the events by time according to the preset sorting rule, and when a deviation occurs in tuning, locate the event at the end of the time after sorting as the problem event.
[0021] Preferably, the preset sorting rule is a sorting algorithm based on physical clock or a sorting algorithm based on logical clock.
[0022] A tuning progress tracking and problem location device includes:
[0023] An acquisition module, configured to acquire all top-level object types and second-level object types corresponding to a target task, and determine all top-level objects and second-level objects based on each object type;
[0024] A construction module, configured to construct a number of associated object groups according to the association relationships between each top-level object and second-level object, and determine all events corresponding to each of the associated object groups;
[0025] A judgment module, configured to determine whether the target task is completed according to the status of each top-level object. If not, perform a time sorting on all the events, and when a deviation occurs in tuning, locate the problem event according to the sorting result.
[0026] An electronic device, including a memory and a processor, where the memory is used to store one or more computer instructions, and wherein the one or more computer instructions are executed by the processor to implement a tuning progress tracking and problem location method as described in any one of the above.
[0027] A computer-readable storage medium storing a computer program, where the computer program causes a computer to implement a tuning progress tracking and problem location method as described in any one of the above when executed.
[0028] The present application has the following beneficial effects:
[0029] The present application can display the tuning processes of all objects involved in the target task in a single time line, and without the user's understanding of the specific object hierarchy of the Operator, it is possible to simply and intuitively track the task progress. When a problem occurs in the tuning process, the location of the problem can also be quickly determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0031] Figure 1 is a flowchart of a tuning progress tracking and problem location method implemented by the present application;
[0032] Figure 2 is a schematic diagram of a tuning progress tracking and problem location device implemented by the present application;
[0033] Figure 3 is a schematic diagram of an electronic device for implementing a tuning progress tracking and problem location method by the present application. Detailed implementation manners
[0034] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.
[0035] The terms "first", "second", etc. in the claims and the description of the present application are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances. This is only a way of distinguishing when describing objects with the same attributes in the embodiments of the present application. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product or device including a series of units does not have to be limited to those units, but may include other units not clearly listed or inherent to these processes, methods, products or devices.
[0036] As Figure 1 shown, the present application provides a tuning progress tracking and problem positioning method, including the following steps:
[0037] S110. Obtain all top-level object types and second-level object types corresponding to the target task, and determine all top-level objects and second-level objects based on each object type;
[0038] S120. Construct a number of associated object groups according to the association relationship between each top-level object and the second-level object, and determine all events corresponding to each of the associated object groups;
[0039] S130. Determine whether the target task is completed according to the status of each top-level object. If not, sort all the events by time, and when a deviation occurs in tuning, locate the problem event according to the sorting result.
[0040] The process in which the Operator, after receiving an event, collects the current state of the object, calculates the difference from the expected state, determines the actions to be executed and then executes them is called tuning. Tuning itself is a continuous process. That is, when the Operator finds that the current state of the object it manages is different from the expected state, it will perform tuning until the two are the same and the tuning will stop. If all tuning processes are simply defined as progress, then the progress will have no start and end, which is not conducive to users to view and understand. In this embodiment, the progress is defined as: the progress is a single timeline, starting from the most recent time when the object reaches the final state and ending at the current state of the object. The progress includes all tuning processes that occur in the middle, and the tuning process consists of several events.
[0041] In this embodiment, first, all top-level object types and all second-level object types corresponding to the target task need to be obtained. The basic unit in K8s is the object, and objects all have types. For example, StatefulSet is one type, deployment is one type, and there are also ConfigMaps, etc. Developers can also extend their own types, such as DBCluster. Among them, the types of top-level objects are all pre-set by users, and the types of second-level objects are defaulted to all known object types. Of course, users can also set them by themselves, and there is no restriction here. Then, each top-level object type is listened to. The top-level object and the second-level object form a tree structure. The root node is the top-level object, and each layer below and the final leaf nodes are second-level objects. The algorithm listens to one top-level object type, which means that multiple top-level objects will be listened to, which also means that there are multiple tree structures, so that all top-level objects and second-level objects included under each top-level object type can be obtained.
[0042] Furthermore, all second-level objects associated with each top-level object are determined according to the ownerReference field, and each top-level object and all its associated second-level objects are set as an associated object group.
[0043] Next, first determine all the secondary objects associated with each top-level object according to the ownerReference field. The association relationship between the top-level object and the secondary object can be analyzed through the ownerReference field. Then, construct an association object group according to the association relationship between each top-level object and the secondary object. Each top-level object and all its associated secondary objects form a group, that is, each tree structure will be set as an association object group in the algorithm. Finally, obtain all the events corresponding to each association object group by listening to all the top-level objects and secondary objects. Among them, the events include two types. One is the change of the object itself, such as Create, Update, and Delete. The other is the KubernetesEvent related to the object. The event content includes mandatory and optional items. The mandatory items are the object name and object type. If the event is a Kubernetes Event, the mandatory items also include the Event Message field. The optional items are determined by the configurable CEL.
[0044] Furthermore, compare the current state of each top-level object with its expected state respectively. If they are all the same, it is determined that the final state has been reached and the target task is completed.
[0045] Then, compare the current state of each top-level object with its expected state. If the current states of all top-level objects are the same as their expected states, the final state is reached and the target task is completed. At this time, all events can be cleared. Among them, each object itself will include three parts of information: meta information, expected state, and current state.
[0046] Furthermore, the preset sorting rule is a sorting algorithm based on physical clock or a sorting algorithm based on logical clock.
[0047] When the current state of a certain top-level object does not match its expected state, all events are sorted by time according to a physical clock-based sorting algorithm or a logical clock-based sorting algorithm. Among them, the physical clock-based sorting algorithm means setting a timestamp for each event that represents the real time when the event occurs. After that, based on this timestamp, they are arranged in ascending order of time. This timestamp is physical time, and the sources are not unified. The timestamp sources are shown in Table 1. When the real occurrence time needs to be displayed in the progress and occasional order reversals can be accepted, this algorithm is suitable; the logical clock-based sorting algorithm is to set a timestamp for each event that represents the time of the event relative to other events. After that, based on this timestamp, they are arranged in ascending order. In K8s, both objects and K8s Event contain a resourceVersion field, which is actually a logical timestamp issued by a central time service (TSO), and the sources are unified. When the real time does not need to be displayed in the progress or strict requirements are imposed on the order of event occurrence, this algorithm is suitable.
[0048] Table 1 Timestamp Sources of the Physical Clock-Based Sorting Algorithm
[0049] Event type Timestamp source Create CreationTimestamp field of the object Update Machine time of the monitoring component when the monitoring component detects that the object has been updated Delete DeletionTimestamp field of the object Kubernetes Event FirstTimestamp & LastTimestamp fields of the Event
[0050] Furthermore, all the events are sorted by time according to the preset sorting rules, and when a deviation occurs in tuning, the events at the end of the time after sorting are located as problem events.
[0051] When a problem occurs in tuning, there must be a problem in the tuning process of a certain top-level object or second-level object, because the events in the tuning process are shown on the same timeline and the order of event occurrence is guaranteed. If there is a problem, it must be "stuck" on the last event. Therefore, the problem location method becomes very simple, that is, just check the last event on the progress timeline.
[0052] This embodiment can display the tuning processes of all objects involved in the target task in a single timeline manner, and users can simply and intuitively track the task progress without understanding the specific object hierarchy of the Operator. When problems occur in the tuning process, the location of the problem can also be quickly determined.
[0053] As Figure 2 shown, this application also provides a tuning progress tracking and problem location device, including:
[0054] An acquisition module 10, configured to acquire all top-level object types and second-level object types corresponding to the target task, and determine all top-level objects and second-level objects based on each object type;
[0055] The construction module 20 is used to construct a number of associated object groups according to the association relationships between each top-level object and the secondary objects, and determine all events corresponding to each of the associated object groups;
[0056] The judgment module 30 is used to determine whether the target task is completed according to the status of each top-level object. If not, it sorts all the events in terms of time, and when there is a deviation in tuning, locates the problem event according to the sorting result.
[0057] An implementation manner of the above device may be: The acquisition module 10 acquires all top-level object types and secondary object types corresponding to the target task, and determines all top-level objects and secondary objects based on each object type; the construction module 20 constructs a number of associated object groups according to the association relationships between each top-level object and the secondary objects obtained by the acquisition module 10, and determines all events corresponding to each of the associated object groups; the judgment module 30 determines whether the target task is completed according to the status of each top-level object. If not, it sorts all the events determined by the construction module 20 in terms of time, and when there is a deviation in tuning, locates the problem event according to the sorting result.
[0058] As Figure 3 shown, the present application also provides an electronic device, including a memory 301 and a processor 302. The memory 301 is used to store one or more computer instructions. Among them, the one or more computer instructions are executed by the processor 302 to implement the above-mentioned method for tracking the tuning progress and locating problems.
[0059] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working process of the above-described electronic device can refer to the corresponding process in the foregoing method embodiment, and will not be elaborated herein.
[0060] The present application also provides a computer-readable storage medium storing a computer program, and the computer program, when executed by a computer, implements the above-mentioned method for tracking the tuning progress and locating problems.
[0061] Exemplarily, the computer program can be divided into one or more modules / units. One or more modules / units are stored in the memory 301, executed by the processor 302, and the data I / O interface transmission is completed by the input interface 305 and the output interface 306 to complete the present invention. One or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device.
[0062] The computer device can be a computing device such as a desktop computer, a notebook, a handheld computer, and a cloud server. The computer device may include, but is not limited to, a memory 301 and a processor 302. Those skilled in the art can understand that this embodiment is only an example of the computer device and does not constitute a limitation on the computer device. It may include more or fewer components, or combine certain components, or different components. For example, the computer device may also include an input device 307, a network access device, a bus, etc.
[0063] The processor 302 can be a central processing unit (CPU), or can also be other general-purpose processors 302, digital signal processors 302 (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor 302 can be a microprocessor 302 or the processor 302 can also be any conventional processor 302, etc.
[0064] The memory 301 can be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. The memory 301 can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 301 can also include both the internal storage unit and the external storage device of the computer device. The memory 301 is used to store computer programs and other programs and data required by the computer device. The memory 301 can also be used to temporarily store in the output device 308, and the foregoing storage media include various media such as USB flash drives, mobile hard disks, read-only memory ROM 303, random access memory RAM 304, diskettes, or optical discs that can store program codes.
[0065] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A tuning progress tracking and problem location method, characterized in that, It includes the following steps: Obtain all top-level object types and second-level object types corresponding to the target task, and determine all top-level objects and second-level objects based on each object type; Construct several associated object groups according to the association relationships between each top-level object and second-level object, and determine all events corresponding to each of the associated object groups; Determine whether the target task is completed according to the status of each top-level object. If not, perform a time sorting on all the events, and when there is a deviation in tuning, locate the problem event according to the sorting result.
2. The method for tuning progress tracking and problem location according to claim 1, characterized in that The determining all top-level objects and second-level objects based on each object type includes: Monitor each top-level object type to obtain all top-level objects and second-level objects included in each top-level object type.
3. A method for tuning progress tracking and problem localization according to claim 1, characterized in that, The second-level object type is defaulted to all types.
4. A method for tuning progress tracking and problem location according to claim 1, characterized in that The constructing several associated object groups according to the association relationships between each top-level object and second-level object includes: Determine all second-level objects associated with each top-level object according to the ownerReference field, and set each top-level object and all its associated second-level objects as an associated object group.
5. A method for tuning progress tracking and problem localization according to claim 1, characterized in that The determining whether the target task is completed according to the status of each top-level object includes: Compare the current status of each top-level object with its expected status respectively. If all are the same, it is determined that the final state is reached and the target task is completed.
6. A method for tuning progress tracking and problem location according to claim 1, characterized in that, The performing a time sorting on all the events and, when there is a deviation in tuning, locating the problem event according to the sorting result includes: Perform a time sorting on all the events according to a preset sorting rule, and when there is a deviation in tuning, locate the event at the time tail end after sorting as the problem event.
7. A method for tuning progress tracking and problem localization according to claim 6, characterized in that The preset sorting rule is a sorting algorithm based on a physical clock or a sorting algorithm based on a logical clock.
8. A tuning progress tracking and problem location device, characterized in that, It includes: An obtaining module, configured to obtain all top-level object types and second-level object types corresponding to the target task, and determine all top-level objects and second-level objects based on each object type; A constructing module, configured to construct several associated object groups according to the association relationships between each top-level object and second-level object, and determine all events corresponding to each of the associated object groups; A judging module, configured to determine whether the target task is completed according to the status of each top-level object. If not, perform a time sorting on all the events, and when there is a deviation in tuning, locate the problem event according to the sorting result.
9. An electronic device, characterized in that, It includes a memory and a processor. The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a tuning progress tracking and problem location method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when executed by a computer, implements a tuning progress tracking and problem location method as described in any one of claims 1 to 7.