A traffic tracking method and device, electronic equipment and storage medium
By using eBPF technology at the kernel layer to generate unique IDs and combining them with application layer protocol parsing, the efficiency and accuracy issues of existing traffic tracing solutions are resolved, enabling cross-thread end-to-end traffic tracing.
Patent Information
- Application Number
- CN202411577364.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-11-06
AI Technical Summary
Existing traffic tracing solutions suffer from problems such as code intrusion, lack of support for tracing multiple languages and transmission protocols under a unitized architecture, and difficulty in tracing across threads, resulting in low efficiency and accuracy of traffic tracing.
eBPF technology is used to perform transport protocol parsing at the kernel layer, generate unique IDs, and associate service call request data packets through application layer protocol parsing, thereby achieving cross-thread end-to-end traffic tracing.
It improves the efficiency and accuracy of traffic tracing, solves the problems of not supporting multiple languages, multiple transmission protocols and cross-thread tracing, and realizes end-to-end traffic tracing.
Smart Images

Figure CN119420816B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network services, and in particular to a traffic tracking method and device, electronic equipment and a storage medium. BACKGROUND
[0002] At present, under the unit architecture, the existing traffic tracking scheme often adopts the manner of recording relevant call link information, service state information and the like logs at each end node, using TraceId and SpanId to connect the entire call chain, and then collecting through log aggregation analysis or message queue and the like and entering the analysis system node for analysis to finally obtain the traffic tracking information. The existing traffic tracking scheme has problems such as code invasion, not supporting multi-language and multi-transport protocol tracking, and difficulty in tracking in the cross-thread case, resulting in low efficiency and accuracy of traffic tracking. SUMMARY
[0003] The main purpose of the embodiments of the present application is to provide a traffic tracking method, device, electronic equipment and storage medium, which can realize traffic tracking and improve the efficiency and accuracy of traffic tracking.
[0004] In one aspect, the embodiments of the present application provide a traffic tracking method, which comprises the following steps:
[0005] Obtaining a service call request data packet;
[0006] Generating a corresponding traffic tracking identifier according to the service call request data packet, and adding the traffic tracking identifier into the service call request data packet;
[0007] Associating the service call information corresponding to the service call request data packet by using the traffic tracking identifier, and generating corresponding traffic tracking information.
[0008] In some embodiments, the method further comprises:
[0009] Performing application layer protocol analysis on the service call request data packet to determine traffic detection and analysis data;
[0010] Obtaining service call result information from the traffic detection and analysis data, and determining whether a service call exception occurs according to the service call result information.
[0011] In some embodiments, the generating a corresponding traffic tracking identifier according to the service call request data packet and adding the traffic tracking identifier into the service call request data packet specifically comprises:
[0012] Obtaining a preset traffic tracking identifier format;
[0013] performing kernel layer transmission protocol analysis on the service call request data packet to determine corresponding service call request information;
[0014] generating a corresponding traffic tracking identifier according to the service call request information and the traffic tracking identifier format, and adding the traffic tracking identifier into the service call request data packet.
[0015] In some embodiments, the service call request information corresponding to the service call request data packet is associated with the traffic tracking identifier to generate corresponding traffic tracking information, specifically including:
[0016] monitoring a plurality of routing forwarding services corresponding to the service call request data packet;
[0017] performing kernel layer transmission protocol analysis on the service call request data packet to determine current service call request information corresponding to the service call request data packet in the current routing forwarding service;
[0018] updating the traffic tracking identifier according to the current service call request information and the traffic tracking identifier format, and adding the updated traffic tracking identifier into the service call request data packet before performing the current routing forwarding service.
[0019] In some embodiments, the service call result information is obtained from the traffic detection and analysis data, and it is determined whether a service call exception occurs according to the service call result information, specifically including:
[0020] obtaining a plurality of preset service call exception result codes;
[0021] determining a corresponding service call result code according to the service call result information;
[0022] determining whether there is a target service call exception result code matching the service call result code from a plurality of service call exception result codes;
[0023] when there is the target service call exception result code matching the service call result code, determining corresponding target service call exception information according to the target service call exception result code.
[0024] In some embodiments, the traffic tracking identifier corresponding to the service call request information and the traffic tracking identifier format are generated, and the traffic tracking identifier is added into the service call request data packet, specifically including:
[0025] According to the service call request information, corresponding unit service division information and service call request identification information are determined, wherein the unit service division information at least includes a current service call request timestamp, a service call unit code and a unit call service domain name, and the service call request identification information at least includes a current service call request sequence number corresponding to the service call request data packet;
[0026] According to the flow tracking identification format, the unit service division information and the service call request identification information are used for information filling to generate corresponding flow tracking identification.
[0027] In some embodiments, for each routing forwarding service, the service call request data packet is subjected to kernel layer transmission protocol analysis to determine current service call request information of the service call request data packet in the current routing forwarding service, specifically including:
[0028] The service call request data packet is subjected to kernel layer transmission protocol analysis to obtain a previous flow tracking identification and a current time, and to determine a current service call unit code and a current unit call service domain name;
[0029] According to the previous flow tracking identification, a previous service call request sequence number is determined, and according to the previous service call request sequence number, a current service call request sequence number is determined by incrementing;
[0030] The current time is obtained as a current service call request timestamp, and according to the current service call unit code, the current unit call service domain name, the current service call request sequence number and the current service call request timestamp, the current service call request information is determined.
[0031] On the other hand, the embodiments of the present application propose a flow tracking device, the device comprising:
[0032] A first module is configured to obtain a service call request data packet;
[0033] A second module is configured to generate corresponding flow tracking identification according to the service call request data packet, and add the flow tracking identification into the service call request data packet;
[0034] A third module is configured to associate service call information corresponding to the service call request data packet by using the flow tracking identification to generate corresponding flow tracking information.
[0035] On the other hand, the embodiments of the present application propose an electronic device, the electronic device comprising a memory and a processor, the memory stores a computer program, and the processor implements the flow tracking method described above when executing the computer program.
[0036] In another aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the flow tracking method described above.
[0037] The embodiments of the present application have at least the following beneficial effects: The flow tracking method, device, electronic device and storage medium provided by the present application can acquire a service call request data packet, generate a corresponding flow tracking identifier according to the service call request data packet, add the flow tracking identifier into the service call request data packet, associate the flow tracking identifier with service call information corresponding to the service call request data packet, and generate corresponding flow tracking information. The present application can realize flow tracking, solve the problems of not supporting multi-language and multi-transmission protocol tracking and difficulty in tracking in a cross-thread case, improve the efficiency of flow tracking, and improve the comprehensiveness and accuracy of flow tracking. BRIEF DESCRIPTION OF DRAWINGS
[0038] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
[0040] Figure 1 is a flowchart of a flow tracking method provided by an embodiment of the present application;
[0041] Figure 2 is a structural schematic diagram of a unitized architecture in an embodiment of the present application;
[0042] Figure 3 is a flowchart of step S102 in an embodiment of the present application;
[0043] Figure 4 is a flowchart of step S103 in an embodiment of the present application;
[0044] Figure 5 is a flowchart of step S203 in an embodiment of the present application;
[0045] Figure 6 is a flowchart of step S302 in an embodiment of the present application;
[0046] Figure 7 is another flowchart of a flow tracking method provided by an embodiment of the present application;
[0047] Figure 8 is a flow chart of step S602 in the embodiment of the present application;
[0048] Figure 9 is a structural schematic diagram of a flow tracking device provided by the embodiment of the present application;
[0049] Figure 10 is a hardware structural schematic diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application. When the following description relates to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementation described in the following exemplary embodiments does not represent all the implementations consistent with the embodiments of the present application, and they are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.
[0051] It can be understood that the terms "first", "second", and the like used in the present application can be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present application, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "when" or "when" or "in response to determining".
[0052] The terms "at least one", "multiple", "each", "any" and the like used in the present application include one, two or more than two, multiple includes two or more than two, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as understood by those skilled in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.
[0054] It should be noted that in each specific embodiment of the present application, when relevant processing needs to be performed on data related to the identity or characteristics of the user, such as user information, user behavior data, user history data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain sensitive personal information of the user, the user's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page, and after obtaining the separate permission or separate consent of the user, the necessary user-related data for enabling the embodiments of the present application to function normally will be obtained.
[0055] Before the embodiments of the present application are described in detail, first, some of the terms and terminologies involved in the embodiments of the present application will be explained, and the terms and terminologies involved in the embodiments of the present application are applicable to the following explanations.
[0056] 1) Unit architecture: Unit architecture comes from the field of parallel computing and is applied to the field of distributed service design. Unitization refers to the process of transforming a service design into a unit that meets certain characteristics, and each unit meets all business operations in a certain partition.
[0057] 2) Traffic tracking: Traffic tracking generally includes two aspects of call chain tracking and traffic direction tracking. The existing call chain tracking scheme often uses TraceId and SpanId to mark the whole link. The traffic direction is recorded through the service domain name and other ways to record the relevant node information.
[0058] 3) eBPF (extended Berkeley Packet Filter): It is a virtual machine technology running on the Linux kernel, which can extend the kernel function to realize the monitoring of network data packets, performance statistics, and other functions.
[0059] Under the unit architecture, the existing micro-service traffic tracking scheme often adopts the method of recording relevant call link information, service state information and other logs at each end node, using TraceId, SpanId to link the entire call chain, and then collecting through log aggregation analysis or message queue and other methods to enter the analysis system node for analysis, finally obtaining the traffic tracking information. Some micro-service traffic tracking schemes use bytecode enhancement technology to achieve zero-intrusion to business applications, but this scheme needs to deploy agents for tracking services to collect data, and in the case of different development languages, agents of corresponding languages need to be written. Specifically, for example, the SkyWalking open source project of the OpenTracing standard needs to deploy a java agent in a java language project, and other development languages are the same. In addition, other micro-service traffic tracking schemes use eBPF technology to match kernel layer data packets according to regular expressions and other methods, and detect traffic according to the matching results. This scheme uses the linux kernel to complete the processing of data packets, and has the characteristics of fast, convenient and non-perception. However, due to the limitation of only analyzing the transport layer protocol, it is difficult to associate the front and rear traffic data packets in the traffic tracking demand, and it is also difficult to obtain enough business data.
[0060] Based on this, the embodiment of the application provides a traffic tracking method, device, electronic equipment and storage medium, which can introduce eBPF to realize traffic tracking based on the unit architecture. Specifically, a unique ID that can be tracked is generated by dividing the unit gateway node, kernel layer transmission protocol analysis and distinction are performed through eBPF code, and information is transmitted to the user state for application layer protocol analysis. When processing service call request data packets, especially cross-thread service calls, the unique ID is transmitted to the service call request data packet through application layer protocol analysis to associate the data packets, and full-process traffic tracking of different protocols is realized.
[0061] Reference Figure 1 , Figure 1 is an optional flowchart of a traffic tracking method provided by the embodiment of the application. The method can include but is not limited to steps S101 to S103:
[0062] Step S101, obtaining a service call request data packet;
[0063] Step S102, generating a corresponding traffic tracking identifier according to the service call request data packet, and adding the traffic tracking identifier into the service call request data packet;
[0064] Step S103, associating the service call information corresponding to the service call request data packet by using the traffic tracking identifier, and generating corresponding traffic tracking information.
[0065] In some embodiments, under the unitization architecture, there are micro-service gateways and multiple unit gateway nodes, etc. service calling units, and the service calling request packet corresponding unit service division information and service calling request identification information, etc. information is associated with the generation of a unique ID (such as the above-mentioned traffic tracking identification), and the unique ID is used to realize the traffic tracking of the service calling request packet. Optionally, the unique ID is TraceId.
[0066] In some embodiments, referring to Figure 2 , Figure 2 is an optional structural schematic diagram of the unitization architecture in the embodiments of the present application, which includes micro-service gateways, upstream units, and unit gateway nodes 1 to N. The micro-service gateways obtain service calling request packets from the upstream units (including various application programs, etc.), then process the service calling request packets through the eBPF unit built in the micro-service gateways, generate traffic tracking identifications and obtain traffic detection and analysis data, finally transmit the service calling request packets with the traffic tracking identifications to the corresponding unit gateway nodes for service calling, determine the calling link according to the traffic tracking identifications, and realize traffic tracking.
[0067] In some embodiments, referring to Figure 3 , Figure 3 is an optional flowchart of step S102 in the embodiments of the present application. Step S102 can include but is not limited to steps S201 to S203:
[0068] Step S201, a preset traffic tracking identification format is obtained;
[0069] Step S202, the service calling request packet is parsed according to the kernel layer transmission protocol to determine the corresponding service calling request information;
[0070] Step S203, according to the service calling request information and the traffic tracking identification format, a corresponding traffic tracking identification is generated, and the traffic tracking identification is added to the service calling request packet.
[0071] In some embodiments, the traffic tracking identifier is in the format of: random string + timestamp + service call unit code + unit call service domain name + service call request sequence number. According to the service call request data packet, after completing a complete service call, the complete call link is obtained according to the random string sorting in the traffic tracking identifier, and the call time corresponding to the service call request data packet is determined according to the timestamp, the unit gateway node currently called by the service call request data packet is determined according to the service call unit code, the current call service information of the unit gateway node is determined according to the unit call service domain name, and the current service call request data packet is determined to be in the nth routing forwarding through the service call request sequence number, so as to achieve the purpose of traffic tracking through the traffic tracking identifier.
[0072] In some embodiments, referring to Figure 4 , Figure 4 is an optional flowchart of step S103 in the embodiments of the application, and step S103 can include but is not limited to steps S301 to S303:
[0073] Step S301, monitoring a plurality of routing forwarding services corresponding to the service call request data packet;
[0074] Step S302, for each routing forwarding service, performing kernel layer transmission protocol analysis on the service call request data packet to determine the current service call request information corresponding to the service call request data packet in the current routing forwarding service;
[0075] Step S303, updating the traffic tracking identifier according to the current service call request information and the traffic tracking identifier format, and adding the updated traffic tracking identifier into the service call request data packet before executing the current routing forwarding service.
[0076] In some embodiments, referring to Figure 5 , Figure 5 is an optional flowchart of step S203 in the embodiments of the application, and step S203 can include but is not limited to steps S401 to S402:
[0077] Step S401, determining the corresponding unit service division information and service call request identification information according to the service call request information, wherein the unit service division information at least includes the current service call request timestamp, the service call unit code and the unit call service domain name, and the service call request identification information at least includes the current service call request sequence number corresponding to the service call request data packet;
[0078] Step S402, filling information according to the traffic tracking identifier format, using the unit service division information and the service call request identification information, to generate the corresponding traffic tracking identifier.
[0079] In some embodiments, referring to Figure 6 , Figure 6 is an optional flowchart of step S302 in the embodiments of the present application, and step S302 can include but is not limited to including steps S501 to S503:
[0080] Step S501, performing kernel layer transmission protocol analysis on the service call request data packet, obtaining the last traffic tracking identifier and the current time, and determining the current service call unit code and the current unit call service domain name;
[0081] Step S502, determining the last service call request sequence number according to the last traffic tracking identifier, and determining the corresponding current service call request sequence number by incrementing the last service call request sequence number;
[0082] Step S503, obtaining the current time as the current service call request timestamp, and determining the current service call request information according to the current service call unit code, the current unit call service domain name, the current service call request sequence number and the current service call request timestamp.
[0083] In some embodiments, the service call request data packet is analyzed by the eBPF system for kernel layer transmission protocol, the current service call request information is determined, and then the current routing forwarding service corresponding traffic tracking identifier is updated according to the current service call request information and the traffic tracking identifier format.
[0084] Exemplarily, a kernel layer transmission protocol of a service call request data packet is identified by the eBPF system, the service call request data packet can be a TCP packet, a UDP packet or a custom protocol packet, and it is assumed that the service call request data packet is a TCP packet. The eBPF system outputs current service call request information corresponding to the TCP packet, including: a source port number, a destination port number, a sequence number, an acknowledgement number, a data offset, a reserved field, control bits including URG, ACK, PSH, RST, SYN, FIN and the like, used for controlling the sending and receiving of a message segment, a window size of 16 bits, used for flow control, a check of 16 bits, used for verifying the integrity of data and an urgent pointer, and the like. According to the current service call request information, a target unit gateway node to be called by the service call request data packet and a calling service to be executed by the target unit gateway node are determined from a plurality of unit gateway nodes. According to the calling service to be executed by the target unit gateway node, a target unit calling service domain name is determined. According to the target unit gateway node, a target service call unit code is determined. A current identification completion time is obtained as a current service call request timestamp. A current random string corresponding to the target unit gateway node is generated by the eBPF system. A last generated traffic tracking identifier in the service call request data packet is obtained. A last service call request sequence number is determined. The last service call request sequence number is incremented to obtain a current service call request sequence number. According to the traffic tracking identifier format, the target unit calling service domain name, the current service call request timestamp, the target service call unit code, the current service call request sequence number and the current random string are used to update the information of the traffic tracking identifier to generate a new traffic tracking identifier. The newly generated traffic tracking identifier is added to the service call request data packet. Then, the service call request data packet is transmitted from the kernel layer to the user layer.
[0085] In some embodiments, with reference to Figure 7 , Figure 7 is another optional flowchart of a traffic tracking method provided by the embodiments of the present application. The traffic tracking method can further include, but is not limited to, steps S601 to S602:
[0086] In step S601, a service call request data packet is subjected to application layer protocol analysis to determine traffic detection and analysis data.
[0087] In step S602, service call result information is obtained from the traffic detection and analysis data, and it is determined whether a service call exception occurs according to the service call result information.
[0088] In some embodiments, the service call request packet is subjected to application layer protocol analysis by the eBPF system in the user layer, specifically, the service call packet is subjected to application layer protocol analysis by the eBPF system to obtain corresponding traffic detection and analysis data. For example, the http protocol, the grpc protocol, the rpcx protocol, and the like are application layer protocols based on the TCP protocol, and the RTP protocol and the QUIC protocol are application layer protocols based on the UDP protocol. After the eBPF system transfers the TCP packet from the kernel layer to the user layer, the eBPF system matches the http protocol corresponding to the TCP packet in the application layer by using the http version number and other keywords to complete the application layer protocol analysis, and then obtains application protocol packet information including a request method, a url, a request header, a request body, a response header, a system status code, a business result code, a response status code, and the like. The application protocol packet information is the traffic detection and analysis data, and the traffic detection and analysis data is sent to the micro-service gateway or the unit gateway node for mutual cooperation for traffic detection and analysis.
[0089] In some embodiments, referring to Figure 8 , Figure 8 is an optional flowchart of step S602 in the embodiments of the present application, and step S602 can include but is not limited to steps S701 to S704:
[0090] Step S701, obtaining a plurality of preset service call abnormal result codes;
[0091] Step S702, determining a corresponding service call result code according to service call result information;
[0092] Step S703, determining whether there is a target service call abnormal result code matching the service call result code from the plurality of service call abnormal result codes;
[0093] Step S704, when there is a target service call abnormal result code matching the service call result code, determining corresponding target service call abnormal information according to the target service call abnormal result code.
[0094] In some embodiments, the traffic detection analysis is completed by the micro-service gateway or the unit gateway, and specifically, response status codes and system response codes 404 / 500 / 502 / 504 in the HTTP protocol in the traffic detection analysis data are analyzed to determine whether there is a service response exception or the like, and business result codes in the traffic detection analysis data are analyzed. By distinguishing the result codes for abnormal services, a plurality of service call abnormal result codes are determined, for example, a service call abnormal result code corresponding to a database exception is 11021, a service call abnormal result code corresponding to a query failure is 12001, and the like. It is determined whether there is a target service call abnormal result code corresponding to the business result code from the plurality of service call abnormal result codes. Assuming that the business result code is 11021, the service call abnormal result code corresponding to the database exception is consistent, the service call abnormal result code corresponding to the database exception is obtained as the target service call abnormal result code, and then the target service call abnormal information of the database exception is output, thereby realizing the traffic detection analysis.
[0095] Referring to Figure 9 , Figure 9 is an optional structural schematic diagram of a traffic tracking device provided by an embodiment of the present application. The device can be used to implement the traffic tracking method described above. The device can include:
[0096] A first module is configured to obtain service call request data packets.
[0097] A second module is configured to generate corresponding traffic tracking identifiers according to the service call request data packets, and add the traffic tracking identifiers into the service call request data packets.
[0098] A third module is configured to associate the service call information corresponding to the service call request data packets by using the traffic tracking identifiers, and generate corresponding traffic tracking information.
[0099] It can be understood that the contents in the method embodiments described above are applicable to the device embodiments. The device embodiments specifically implement the same functions as the method embodiments described above, and achieve the same beneficial effects as the method embodiments described above.
[0100] An electronic device is also provided by an embodiment of the present application. The electronic device includes a memory and a processor. The memory stores a computer program. The processor implements the traffic tracking method described above when executing the computer program. The electronic device can be any smart terminal such as a tablet computer.
[0101] It can be understood that the contents in the method embodiments described above are applicable to the device embodiments. The device embodiments specifically implement the same functions as the method embodiments described above, and achieve the same beneficial effects as the method embodiments described above.
[0102] Referring to Figure 10 , Figure 10 Fig. 1 illustrates a hardware structure of an electronic device according to another embodiment, and the electronic device includes:
[0103] The processor 901 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., and is configured to execute related programs to implement the technical solutions provided by the embodiments of the present application.
[0104] The memory 902 can be implemented by a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory 902 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 902 and are called and executed by the processor 901 to implement the traffic tracking method of the embodiments of the present application.
[0105] The input / output interface 903 is configured to realize information input and output.
[0106] The communication interface 904 is configured to realize the communication interaction between the device and other devices. The communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0107] The bus 905 is configured to transmit information between various components (for example, the processor 901, the memory 902, the input / output interface 903, and the communication interface 904) of the device.
[0108] The processor 901, the memory 902, the input / output interface 903, and the communication interface 904 are connected to each other through the bus 905 to realize the communication connection between them in the device.
[0109] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the traffic tracking method.
[0110] It can be understood that the contents in the above method embodiments are all applicable to the present storage medium embodiments. The present storage medium embodiments specifically implement the same functions as the above method embodiments, and achieve the same beneficial effects as the above method embodiments.
[0111] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include high-speed random access memory and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include memory that is remotely located with respect to the processor, which can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0112] The traffic tracking method and device, the electronic device and the storage medium provided by the embodiments of the present application can realize traffic tracking, solve the problems of not supporting multi-language and multi-transmission protocol tracking, and tracking difficulty in the case of cross-thread, improve the efficiency of traffic tracking, and improve the comprehensiveness and accuracy of traffic tracking.
[0113] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0114] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures shown, or combine certain steps, or different steps.
[0115] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, that is, can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0116] Those skilled in the art can understand that all or some steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0117] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or chronological mundane operation, reverse order operation, based on circuitry availability, based on stated preference or the like, and that "default" or other orderings are thus permissible. Further, the terms "comprise", "comprising", "include", "including", and the like, are specifically intended to be open-ended. That is, references to individual steps and the like do not suhstantially exclude the presence of two or more of a given step or its integral presence in the process, method, system, article, or apparatus having been made with a wider scope. The use of notation such as "first", "second", "third", etc. does not generally limit the areas, but can be used for clarity, and merely establishes the order of the steps or placement of components. Moreover, singular forms "a", "an" and "the" include plural referents unless the context clearly dictates otherwise.
[0118] It should be understood that, in the application, "at least one" means one or more, and "multiple" means two or more. "And / or", used to describe the relationship between associated objects, means that there can be three relationships, for example, "A and / or B" can mean that there are only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including single or multiple combinations. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0119] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the above-mentioned units is only a logical functional division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0120] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0121] In addition, each of the function units in the embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.
[0122] It should be appreciated that the embodiments of the present application can be realized or implemented by computer hardware, a combination of hardware and software, or through computer instructions stored in a non-transitory computer readable storage medium. The method can be implemented in a computer program using standard programming techniques, including a non-transitory computer readable storage medium configured with a computer program, wherein the storage medium thus configured makes the computer operate in a specific and predefined manner according to the method described in the specific embodiments and the accompanying drawings. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, the program can be run on a programmed special integrated circuit for this purpose.
[0123] If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application, essentially or the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0124] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, but this does not limit the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.
Claims
1. A traffic tracking method, characterized by, The method comprises the following steps: Obtain a service call request data packet; According to the kernel layer transmission protocol analysis on the service call request data packet, generate a corresponding traffic tracking identifier, add the traffic tracking identifier into the service call request data packet, and the traffic tracking identifier comprises a random string, a timestamp, a service call unit code, a unit call service domain name, and a service call request sequence number; Correlate the service call information corresponding to the service call request data packet by using the traffic tracking identifier, and generate corresponding traffic tracking information; Perform application layer protocol analysis on the service call request data packet to determine traffic detection and analysis data; Obtain service call result information from the traffic detection and analysis data, and determine whether a service call exception occurs according to the service call result information.
2. The flow tracking method of claim 1, wherein, According to the kernel layer transmission protocol analysis on the service call request data packet, generate a corresponding traffic tracking identifier, add the traffic tracking identifier into the service call request data packet, and the traffic tracking identifier comprises a random string, a timestamp, a service call unit code, a unit call service domain name, and a service call request sequence number. Obtain a preset traffic tracking identifier format; Perform kernel layer transmission protocol analysis on the service call request data packet to determine corresponding service call request information; According to the service call request information and the traffic tracking identifier format, generate a corresponding traffic tracking identifier, and add the traffic tracking identifier into the service call request data packet.
3. The flow tracking method of claim 2, wherein, The traffic tracking information corresponding to the service call request data packet is generated by correlating the service call information corresponding to the service call request data packet by using the traffic tracking identifier, and the traffic tracking information comprises: Monitor a plurality of routing forwarding services corresponding to the service call request data packet; For each routing forwarding service, perform kernel layer transmission protocol analysis on the service call request data packet to determine current service call request information corresponding to the service call request data packet in the current routing forwarding service; According to the current service call request information and the traffic tracking identifier format, update the traffic tracking identifier, and add the updated traffic tracking identifier into the service call request data packet before executing the current routing forwarding service.
4. The flow tracking method of claim 1, wherein, The service call result information is obtained from the traffic detection and analysis data, and whether a service call exception occurs is determined according to the service call result information, and the service call result information comprises: Obtain a plurality of preset service call exception result codes; According to the service call result information, determine a corresponding service call result code; Determine whether there is a target service call exception result code matching the service call result code from a plurality of service call exception result codes; When there is the target service call exception result code matching the service call result code, determine corresponding target service call exception information according to the target service call exception result code.
5. The flow tracking method of claim 2, wherein, According to the service call request information and the traffic tracking identifier format, generate a corresponding traffic tracking identifier, and add the traffic tracking identifier into the service call request data packet, and the traffic tracking identifier comprises a random string, a timestamp, a service call unit code, a unit call service domain name, and a service call request sequence number. According to the service call request information, corresponding unit service division information and service call request identification information are determined, wherein the unit service division information at least includes a current service call request timestamp, a service call unit code and a unit call service domain name, and the service call request identification information at least includes a current service call request sequence number corresponding to the service call request data packet; According to the traffic tracking identification format, the unit service division information and the service call request identification information are used for information filling to generate corresponding traffic tracking identification.
6. The flow tracking method of claim 3, wherein, For each routing forwarding service, the service call request data packet is subjected to kernel layer transmission protocol analysis to determine current service call request information of the service call request data packet in the current routing forwarding service, specifically including: The service call request data packet is subjected to kernel layer transmission protocol analysis to obtain a previous traffic tracking identification and a current time, and to determine a current service call unit code and a current unit call service domain name; According to the previous traffic tracking identification, a previous service call request sequence number is determined, and according to the previous service call request sequence number, a corresponding current service call request sequence number is determined by incrementing; The current time is obtained as a current service call request timestamp, and according to the current service call unit code, the current unit call service domain name, the current service call request sequence number and the current service call request timestamp, the current service call request information is determined.
7. A flow tracking device, characterized by The device is used for implementing the traffic tracking method according to any one of claims 1-6, and the device comprises: A first module is used for obtaining a service call request data packet; A second module is used for generating corresponding traffic tracking identification according to the service call request data packet, and adding the traffic tracking identification into the service call request data packet, wherein the traffic tracking identification comprises a random string + a timestamp + a service call unit code + a unit call service domain name + a service call request sequence number; A third module is used for associating the service call information corresponding to the service call request data packet by using the traffic tracking identification to generate corresponding traffic tracking information.
8. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the traffic tracking method according to any one of claims 1-6 when executing the computer program.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by the processor to implement the traffic tracking method according to any one of claims 1-6.
Citation Information
Patent Citations
Link tracking method and system based on Socket communication protocol
CN115314542A
Data tracking method and electronic equipment
CN115562901A