CN115580607A - Lottery system link monitoring method, device and system - Google Patents

Lottery system link monitoring method, device and system Download PDF

Info

Publication number
CN115580607A
CN115580607A CN202211251299.9A CN202211251299A CN115580607A CN 115580607 A CN115580607 A CN 115580607A CN 202211251299 A CN202211251299 A CN 202211251299A CN 115580607 A CN115580607 A CN 115580607A
Authority
CN
China
Prior art keywords
link
request
server
response
client
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
CN202211251299.9A
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.)
China Sports Lottery Operation Co ltd
Sports Lottery Management Center Of State Sports General Administration
Original Assignee
China Sports Lottery Operation Co ltd
Sports Lottery Management Center Of State Sports General Administration
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 China Sports Lottery Operation Co ltd, Sports Lottery Management Center Of State Sports General Administration filed Critical China Sports Lottery Operation Co ltd
Priority to CN202211251299.9A priority Critical patent/CN115580607A/en
Publication of CN115580607A publication Critical patent/CN115580607A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/04Processing captured monitoring data, e.g. for logfile generation
    • H04L43/045Processing captured monitoring data, e.g. for logfile generation for graphical visualisation of monitoring data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/126Applying verification of the received information the source of the received data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/30Network architectures or network communication protocols for network security for supporting lawful interception, monitoring or retaining of communications or communication related information
    • H04L63/306Network architectures or network communication protocols for network security for supporting lawful interception, monitoring or retaining of communications or communication related information intercepting packet switched data communications, e.g. Web, Internet or IMS communications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing

Abstract

The application relates to a method, a device and a system for monitoring a lottery system link. The method comprises the following steps: acquiring a request initiated by a user client; adding set tracking information to the request, and recording log information of the request to obtain first log data; sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information; receiving the response, recording log information of the response, obtaining second log data, and monitoring a link from the front-end user equipment to the back-end server by combining the first log data; and returning the response to the user client. According to the scheme, the link between the front-end user equipment and the back-end server can be monitored, and the tracking of the whole link of the micro-service architecture system is achieved.

Description

Lottery system link monitoring method, device and system
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method, an apparatus, and a system for monitoring a lottery system link.
Background
With the popularity of microservice architectures, services are split according to different dimensions, and often multiple services need to be involved in a single request. Internet applications are built on different sets of software modules, possibly developed by different teams, possibly implemented using different programming languages, possibly distributed over thousands of servers, spanning multiple different data centers.
In a complex microservice architecture system (e.g., a lottery system), nearly every front-end request forms a complex distributed service invocation link. For example, a request initiated by a front-end user device may need to call another server to complete a response to the request after the request reaches a back-end server. For a lottery system (e.g., a sports lottery management system), after a user accesses a sports lottery website through a front-end user device (e.g., a personal computer), the sports lottery management system server typically needs to invoke another server during the user's interaction with the sports lottery management system server. To understand the behavior of a distributed system, it is necessary to monitor the associated actions between different servers across different applications. In the related art, monitoring of the call link may be implemented by a link monitoring component (e.g., google Dapper, zipkin, etc.).
However, the monitoring of the called link in the related art can only be performed between the back-end server and the server called by the back-end server, and cannot monitor the link from the front-end ue to the back-end server.
Disclosure of Invention
In order to solve or partially solve the problems in the related art, the application provides a method, a device and a system for monitoring a lottery system link, which can monitor a link from front-end user equipment to a back-end server and realize the tracking of the whole link of a micro-service architecture system.
A first aspect of the present application provides a method for monitoring a lottery system link, including:
acquiring a request initiated by a user client;
adding set tracking information to the request, and recording log information of the request to obtain first log data;
sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information;
receiving the response, recording log information of the response, obtaining second log data, and monitoring a link from the front-end user equipment to the back-end server by combining the first log data;
and returning the response to the user client.
In one embodiment, the client comprises a browser;
the acquiring a request initiated by a user client includes: after a browser enters a webpage and loads a preset component, a request initiated by a user browser is obtained through the preset component.
In one embodiment, the lottery system link monitoring method further comprises:
and obtaining client link tracking data according to the first log data and the second log data, and uploading the client link tracking data to monitor a link from the front-end user equipment to the back-end server.
In one embodiment, the uploading the client link trace data includes:
and uploading the client link tracking data to a monitoring server or the back-end server, so that the monitoring server or the back-end server monitors a link from the front-end user equipment to the back-end server according to the client link tracking data.
In one embodiment, the uploading the client link trace data includes:
and uploading the client link tracking data according to a preset reporting delay time according to a preset sampling rate rule.
In one embodiment, the lottery system link monitoring method further comprises:
and adjusting the preset sampling rate and the preset reporting delay according to the load condition of the client for processing the service data.
A second aspect of the present application provides a lottery system link monitoring apparatus, comprising:
the first request intercepting module is used for acquiring a request initiated by a user client;
the link processing module is used for adding set tracking information to the request intercepted by the first request intercepting module;
the recording module is used for recording the log information of the request processed by the link processing module to obtain first log data;
the first request intercepting module is further configured to send the request after the set tracking information is added to the link processing module to a back-end server, so that the back-end server processes the request and returns a response carrying the set tracking information;
a first response intercepting module for receiving the response;
the recording module is further configured to record log information of the response intercepted by the first response intercepting module to obtain second log data, so as to implement monitoring on a link from the front-end user equipment to the back-end server in combination with the first log data;
and the first response intercepting module is used for returning the response to the user client.
In one embodiment, the lottery system link monitoring apparatus further comprises an upload module;
the uploading module is used for obtaining client link tracking data according to the first log data and the second log data and uploading the client link tracking data so as to monitor a link from front-end user equipment to a back-end server.
A third aspect of the present application provides a lottery system link monitoring system, comprising:
the front-end user equipment is used for acquiring a request initiated by a user client; adding set tracking information to the request, and recording log information of the request to obtain first log data; sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information; receiving the response, recording log information of the response, obtaining second log data, and monitoring a link from the front-end user equipment to the back-end server by combining the first log data; returning the response to the user client;
and the back-end server is used for processing the request and returning a response carrying the set tracking information.
The present application provides, in a fourth aspect, an electronic device comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method as described above.
A fifth aspect of the present application provides a computer-readable storage medium having stored thereon executable code, which, when executed by a processor of an electronic device, causes the processor to perform the method as described above.
The technical scheme provided by the application can comprise the following beneficial effects:
according to the method, a request initiated by a user client is obtained, set tracking information is added to the request, log information of the request is recorded, and first log data are obtained; sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information; and receiving the response, and recording the log information of the response to obtain second log data. Thus, the request is sent to the back-end server after the set tracking information is added, so that the full link tracking of the user request from the front-end user equipment is realized; according to the obtained first log data and the second log data, the time consumed in the process from the time when the front-end user equipment initiates a request to the time when a response returned by the back-end server is received can be monitored, and the monitoring of the link from the front-end user equipment to the back-end server is realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The foregoing and other objects, features and advantages of the application will be apparent from the following more particular descriptions of exemplary embodiments of the application as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the application.
Fig. 1 is a schematic flowchart illustrating a lottery system link monitoring method according to an embodiment of the present application;
fig. 2 is another schematic flow chart of a lottery system link monitoring method according to an embodiment of the present application;
fig. 3 is a schematic processing diagram of a lottery system link monitoring method according to an embodiment of the present application;
fig. 4 is a schematic view illustrating visualization processing of client-side link tracing data and server-side link tracing data in the lottery system link monitoring method according to the embodiment of the present application;
fig. 5 is a schematic structural diagram of a lottery system link monitoring device according to an embodiment of the present application;
fig. 6 is another schematic structural diagram of a lottery system link monitoring device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a lottery system link monitoring system according to an embodiment of the present application;
fig. 8 is another schematic structural diagram of a lottery system link monitoring system according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While embodiments of the present application are illustrated in the accompanying drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms "first," "second," "third," etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
The monitoring of the call link in the related art can only be directed to the monitoring between the backend server and the service called by the backend server, and cannot monitor the link from the front-end user equipment to the backend server.
In view of the above problems, embodiments of the present application provide a method for monitoring a lottery system link, which can monitor a link from a front-end user device to a back-end server, and implement tracking of a full link of a micro-service architecture system.
The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a lottery system link monitoring method according to an embodiment of the present application. The method of the embodiment of fig. 1 may be applied to a front-end user device, such as a personal computer, a mobile intelligent device, and the like.
Referring to fig. 1, the method includes:
step S101, a request initiated by a user client is obtained.
Wherein the client may comprise a browser.
In this step, after the browser enters the web page and loads the preset component, the request initiated by the user browser may be acquired through the preset component.
The preset component may be a JS (Javascript) file, which is a web script file. In one embodiment, the preset assembly may be an Axios assembly. The browser of the front-end user equipment triggers the loading of the preset component after entering the set webpage, the link monitoring device can be initialized (loaded) after the preset component is loaded, the link monitoring device can be a JS file, and the link monitoring method provided by the application is executed through the link monitoring device.
The request may be an http request, i.e., an http request message. The user may initiate an http request on a web page loaded by a browser of the front-end user equipment in a behavioral manner such as clicking.
Step S102, adding the setting tracking information to the request, and recording the requested log information to obtain first log data.
Wherein the setting trace information may be added to the request headers (headers) of the http request. The tracking information may be set to X-B3 information, and the X-B3 information includes but is not limited to: link ID (i.e., traceId), node ID (i.e., spanId), parent-child relationship ID (i.e., partensspanid), sampling flag (i.e., sampled).
In this step, log information (e.g., link ID, timestamp event, etc.) of the http request is recorded, and first log data is obtained. The first log data may include the setting trace information, and the first log data may further include log information (e.g., a timestamp) of a time when the http request is initiated.
Step S103, the request added with the setting tracking information is sent to the back-end server, so that the back-end server processes the request and returns a response carrying the setting tracking information.
In this step, the http request carrying the set tracking information is sent to the back-end server, and the back-end server performs service logic processing on the http request to generate a response carrying the set tracking information to return to the front-end user equipment. The response may be an http response, that is, an http response message. It can be understood that the http response includes service data corresponding to the request, so that the client receives and processes the service data, and renders the service data.
And step S104, receiving the response, recording the log information of the response, obtaining second log data, and monitoring a link from the front-end user equipment to the back-end server by combining the first log data.
In this step, log information (e.g., link ID, timestamp event, etc.) of the http response returned by the backend server is recorded, and second log data is obtained. In this way, according to the obtained first log data and the second log data, the time consumed by the front-end user equipment to initiate a request until the back-end server receives a link between requests can be monitored (for example, by comparing timestamp information in the first log data and the second log data), so that the link between the front-end user equipment and the back-end server can be monitored. Note that the second log data includes log information at the time of receiving the http response.
And step S105, returning the response to the user client.
In this step, the http response returned by the back-end server may be returned to the browser of the front-end user equipment through a preset component (e.g., axios component). And the browser renders the received http response by utilizing an internal working mechanism of the browser and presents the http response to the user. That is, the browser processes the traffic data in the http response and renders it in the browser page.
It can be seen from this embodiment that, in the method provided in the embodiment of the present application, the request is sent to the backend server after the set tracking information is added, so as to implement full link tracking of the user request from the front-end user equipment; according to the obtained first log data and the second log data, the time consumed in the process from the time when the front-end user equipment initiates a request to the time when a response returned by the back-end server is received can be monitored, and the monitoring of the link from the front-end user equipment to the back-end server is achieved.
Fig. 2 is another schematic flow chart of a lottery system link monitoring method according to an embodiment of the present application. Fig. 2 depicts the solution of the present application in more detail with respect to fig. 1.
Referring to fig. 2, the method includes:
step S201, after the browser enters the webpage and loads the preset component, the request initiated by the user browser is obtained through the preset component.
The preset component may be a JS (Javascript) file, which is a web script file. The browser of the front-end user equipment triggers the loading of the preset component after entering the set webpage, the link monitoring device (JS file) can be initialized (loaded) after the preset component is loaded, and the link monitoring method provided by the application is executed through the link monitoring device. The link monitoring device may be a lottery system link monitoring device.
The request may be an http request, i.e., an http request message. The user may initiate an http request on a web page loaded by a browser of the front-end user equipment in a behavioral manner such as clicking.
Referring also to fig. 3, in one embodiment, the default component (i.e., "FrontEndAPP" as shown in fig. 3) may be an Axios component. The http request initiated by the browser is acquired by a second request intercepting module (interrupts.req) in the Axios component, and meanwhile, a loading module (axios.create) in the Axios component creates and initializes a link monitoring device, which may be a JS (Javascript) file. The Axios component can customize the processing for http requests. A second request intercepting module in the Axios component sends an http request to the link monitoring device, and the link monitoring device obtains the http request, namely the request initiated by the user browser.
Step S202, adding the setting tracking information to the request, and recording the requested log information to obtain the first log data.
Wherein the setting trace information may be added to the request headers (headers) of the http request. The tracking information may be set to X-B3 information, and the X-B3 information includes but is not limited to: link ID (i.e., traceId), node ID (i.e., spanId), parent-child relationship ID (i.e., partensspanid), sampling flag (i.e., sampled).
In one embodiment, the names, meanings, types, and remarks of different information in the trace information are set as shown in table 1 below.
Figure BDA0003888123200000081
TABLE 1
In this step, log information (e.g., link ID, time stamp event, etc.) of the http request is recorded, and first log data is obtained. It should be noted that the first log data may include setting trace information, and the first log data may further include log information (e.g., a timestamp) of a time when the http request is initiated.
Step S203, the request with the setting tracking information added is sent to the back-end server, so that the back-end server processes the request and returns a response carrying the setting tracking information.
In this step, the http request carrying the set tracking information is sent to the back-end server, and the back-end server performs service logic processing on the http request to generate a response carrying the set tracking information to be returned to the front-end user equipment. The response may be an http response, i.e., an http response message. It can be understood that the http response includes service data corresponding to the request, so that the service data is received and processed by the browser, and is rendered.
It should be noted that the back-end server returns an http response to the http request initiated by the front-end user equipment, and completes the service logic processing of the http request, the back-end server may need to Call another server, that is, the back-end server needs to perform RPC (Remote Procedure Call) on the other server, the server called by the back-end server may need to Call another server, and after the interaction between the servers is completed, the back-end server finally returns an http response to the front-end user equipment. It will be appreciated that the set trace information will be passed through the RPC call, i.e., the set trace information will be passed through the full link through the RPC call.
For example, for an http request initiated by a front-end user equipment, the http request first arrives at an a server (i.e., a backend server), the a server calls a B server (i.e., the a server makes a PRC call to the B server), the B server calls a C server and a D server, respectively, and the D server calls an E server and an F server, respectively. The server E and the server F respectively return responses to the server D, the server D and the server C respectively return responses to the server B, the server B returns a response to the server A, and finally the server A responds to the http request of the user. It should be noted that, between two servers (e.g., server a and server B), server a calls server B, that is, server a sends a request to server B, and server B responds to the request and returns the request to server a. The principle and specific process of RPC call between servers can be referred to the description in the related art, and are not described herein again.
Further, in the process of processing the request (i.e. in the process from receiving the http request to returning the http response to the front-end user equipment), the back-end server also records log information to generate the server-side link tracking data. The server-side link trace data may include log information of the time when the backend server initiates the request and the time when the backend server receives the response (i.e., the log information of the time when the backend server initiates the request to the server called by the backend server and the log information of the time when the server called by the backend server receives the response).
In one embodiment, the backend server performs service logic processing on the http request by using a service application module (i.e., "BackEndAPP" shown in fig. 3), generates a response carrying set trace information, and performs log information recording during processing of the request by using the service application module, to generate server-side link trace data. Further, the back-end server may write the server-side link trace data generated by the service application module into a local log file. Furthermore, the collector can be used for collecting the server link tracking data in the local log file, and the server link tracking data is written into a preset database. In one embodiment, the field names, meanings, and remarks of different information in the link trace data of the client are as follows in table 2. In table 2, the "initiator" is a backend server, and the "receiver" is a server called by the backend server.
Figure BDA0003888123200000091
Figure BDA0003888123200000101
TABLE 2
In one embodiment, the server side link trace data type log is exemplified as follows:
Figure BDA0003888123200000102
Figure BDA0003888123200000111
in this embodiment, by using the server-side link trace data, the time consumed by the process from the initiation of the request by the backend server to the receipt of the response returned by the called server (i.e., the time consumed by the duration invocation in table 2) may be monitored, so as to monitor the link from the backend server to the called server.
And step S204, receiving the response, and recording the log information of the response to obtain second log data.
In this step, log information (e.g., link ID, timestamp event, etc.) of the http response returned by the backend server is recorded, and second log data is obtained. It should be noted that the second log data includes log information at the time of receiving the http response.
It can be understood that, according to the obtained first log data and the second log data, time consumed in a process from when the front-end user equipment initiates a request to when a response returned by the back-end server is received can be monitored (for example, by comparing timestamp information of the time when the request is initiated and the time when the response is received), so as to monitor a link between the front-end user equipment and the back-end server.
Step S205, obtaining client link tracking data according to the first log data and the second log data, and uploading the client link tracking data to the monitoring server or the back-end server.
In this step, client link trace data is generated from the first log data and the second log data. In one embodiment, the field names, meanings, and remarks of different information in the client link trace data are as shown in table 3 below. In table 3, "initiator" is the front-end user equipment, and "receiver" is the back-end server.
Figure BDA0003888123200000112
Figure BDA0003888123200000121
TABLE 3
In one embodiment, the client link trace data type log is exemplified as follows:
Figure BDA0003888123200000122
Figure BDA0003888123200000131
in this embodiment, by using the client link trace data, the time consumption (i.e., the time consumption for duration invocation in table 3) of the process from the time when the front-end ue initiates the request to the time when the response returned by the back-end server is received can be monitored, so as to monitor the link from the front-end ue to the back-end server.
It should be noted that, in this embodiment of the present application, when an http request is in a front-end ue, a global link ID (i.e., traceId) is generated by adding trace information, and the entire call chain of the micro service architecture system including the front-end ue can be concatenated by using the TraceId, where one TraceId represents one http request. Each server node will record the ParentId and the SpanId to form the parent-child relationship of the complete call chain. Wherein a Span without a ParentId becomes a root Span and can be regarded as a call chain entry. During the entire invocation process in the microservices architecture system containing the front-end user equipment, each http request initiated passes through the TraceId and the SpanId. And each node records the TraceID and the SpANID carried by the request as parent ids and records the generated SpANID. All the calling records can be searched according to the traceId, and the parent id and the span id are used for organizing the calling parent-child relationship, so that any one-time complete calling link in the micro-service architecture system comprising the front-end user equipment can be checked, and the tracking of the whole link of the micro-service architecture system is realized.
It can be understood that the front-end user equipment will be used as a first node of the micro service architecture system full link, and obtain first log data by recording log information of the first node (i.e. the front-end user equipment) when initiating a request; and recording the log information of the first node (namely the front-end user equipment) when receiving the response to obtain second log data. And according to the first log data and the second log data, client link tracking data can be obtained, and then the client link tracking data is utilized to monitor the time consumed in the process from the initiation of the request by the front-end user equipment to the receipt of the response returned by the back-end server, so that the monitoring of the link from the front-end user equipment to the back-end server is realized.
It should be noted that, in the related art, the monitoring of the microservice architecture system full link is started from the backend server, and the TraceId generates the injection at the backend server, which can only track the call link from the backend server to the called server, and cannot monitor the link from the front-end ue to the backend server. According to the lottery system link monitoring method, the set tracking information is added to the request initiated by the browser in the front-end user equipment, so that full link tracking of the user request from the front-end user equipment can be achieved. According to the obtained client link tracking data, the time consumed in the process from the initiation of the request by the front-end user equipment to the receipt of the response returned by the back-end server can be monitored, and the link between the front-end user equipment and the back-end server can be monitored. The client link tracking data is combined with the server link tracking data, so that the full link of the micro service architecture system comprising the front-end user equipment can be tracked, and the full link of the micro service architecture system can be monitored.
In one embodiment, the client link trace data may be uploaded to a monitoring server. That is, the link between the front-end user device and the back-end server may be monitored by aggregating the client link trace data by the monitoring server. Furthermore, the monitoring server can acquire the client link tracking data by using the acquisition and reporting service module and write the client link tracking data into a local log file. Furthermore, a collector can be used for collecting client link tracking data in the local log file, and the client link tracking data can be written into a preset database. The preset Database may be CTSDB (Cloud Time Series Database).
In another embodiment, the client link trace data may be uploaded to a back-end server. And summarizing the client link tracking data through the back-end server so as to monitor the link from the front-end user equipment to the back-end server. That is, in this embodiment, the backend server also functions as the monitoring server in the above-described embodiment. Furthermore, the back-end server can acquire the client link tracking data by using the acquisition and reporting service module and write the client link tracking data into a local log file. Furthermore, the collector can be used for collecting client link tracking data in the local log file, and the client link tracking data is written into a preset database.
It should be noted that, in an embodiment, the monitoring server and the backend server may belong to the same server cluster, the server cluster may be a distributed system server cluster, and the monitoring server and the backend server are different servers in the server cluster respectively. The monitoring server is provided with an acquisition reporting service module, and the back-end server is provided with a business application module. The server cluster is provided with a local log file and a collector, namely, the client link tracking data and the server link tracking data are written into the same local log file and uploaded and written into a preset database through the same collector.
In other embodiments, the monitoring server may be an independent server, and the server is created with a collection and reporting service module, a local log file, and a collector. The back-end server may be another independent server, which is created with a service application module, created with a local log file, and provided with a collector. That is to say, the client link tracking data and the server link tracking data are respectively written into local log files in different servers, and are uploaded and written into a preset database through different collectors.
Further, in one embodiment, the client link trace data may be uploaded according to a preset sampling rate rule and a preset reporting delay time. For example, the preset sampling rate rule may be set as: and sampling first log data and second log data corresponding to the first request every ten requests, and uploading client link tracking data corresponding to the sampled first log data and second log data. The setting of the preset sampling rate rule may be represented by a parameter "0.1". In other embodiments, the preset sampling rate rule may be set to "0.2" (i.e. sampling the client link trace data corresponding to the second request every ten requests), "0.5" (i.e. sampling the client link trace data corresponding to the fifth request every ten requests), and so on, and the preset sampling rate rule may be set according to the actual application service condition. By setting a reasonable preset sampling rate rule, the conflict generated when the browser processes the service data can be effectively avoided. The preset reporting delay may be set to 2 seconds, 3 seconds, 5 seconds, and the like after receiving the response. Therefore, the execution action of uploading the link tracking data of the client can be ensured to occur after the browser processes the service data, and the conflict with the browser processing the service data can be effectively avoided.
Further, in one embodiment, the preset sampling rate rule and the preset reporting delay may be adjusted according to a load condition of the browser for processing the service data. It will be appreciated that the priority of uploading client link trace data should be lower than the priority of the browser for processing traffic data. Therefore, the processing requirement of the service data can be met preferentially by adjusting the preset sampling rate and the preset reporting delay according to the load condition of the browser for processing the service data.
Step S206, the response is returned to the user browser.
In this step, the http response returned by the back-end server may be returned to the browser of the front-end user equipment through a preset component (e.g., axios component).
Referring to fig. 3 together, in one embodiment, the http response returned by the back-end server is sent to a second response intercepting module (intersections.resp) in the Axios component, and the second response intercepting module sends the http response to the user browser. And the browser renders the received http response by utilizing an internal working mechanism of the browser and presents the http response to the user. That is, the browser processes the traffic data in the http response and renders it in the browser page.
It should be noted that, according to the client link tracking data and the server link tracking data, visualization processing may be performed to show the time consumption of the front-end link (i.e., the link from the front-end user device to the back-end server) and the back-end link (i.e., the link from the back-end server to the back-end server and the called server). Referring to fig. 4, it can be seen that in the embodiment of fig. 4, the time consumed by the front-end link is 1.522 seconds (i.e., the time consumed by the process from the initiation of the request by the front-end user equipment to the receipt of the response returned by the back-end server), and the time consumed by the back-end link is 1.077 seconds (i.e., the time consumed by the process from the initiation of the request by the back-end server to the receipt of the response returned by the called server).
It can be seen from this embodiment that, in the method provided in the embodiment of the present application, the request is sent to the backend server after the set tracking information is added, so as to implement full link tracking of the user request from the front-end user equipment; according to the obtained first log data and the second log data, the time consumed in the process from the time when the front-end user equipment initiates a request to the time when a response returned by the back-end server is received can be monitored, and the monitoring of a link from the front-end user equipment to the back-end server is realized; the client link tracking data and the server link tracking data obtained according to the first log data and the second log data can be used for tracking the full link of the micro service architecture system comprising the front-end user equipment and monitoring the full link of the micro service architecture system.
It can be found that the method provided by the embodiment of the application is particularly suitable for monitoring a lottery system (such as a sports lottery management system), after a user accesses a sports lottery website through front-end user equipment (such as a personal computer), in the process of interaction between the user and a sports lottery management system server, the link monitoring between the front-end user equipment and the sports lottery management system server can be realized, the positioning tracking of faults, the combing of service dependency relationships, the summarizing and analyzing of business processes are favorably realized, and the optimization of the services of the sports lottery management system is favorably realized. Corresponding to the embodiment of the application function implementation method, the application also provides a lottery system link monitoring device.
Fig. 5 is a schematic structural diagram of a lottery system link monitoring device according to an embodiment of the present application.
Referring to fig. 5, a lottery system link monitoring apparatus 50 includes: interceptor 510, link processing module 520, recording module 530. The interceptor 510 includes a first request intercepting module 511 and a first response intercepting module 512.
The first request intercepting module 511 is configured to obtain a request initiated by a user client.
A link processing module 520, configured to add setting trace information to the request intercepted by the first request intercepting module 511.
A recording module 530, configured to record log information of the request processed by the link processing module 520, so as to obtain first log data.
The first request intercepting module 511 is further configured to send the request after the link processing module 520 adds the set tracking information to the backend server, so that the backend server processes the request and returns a response carrying the set tracking information;
a first response intercepting module 512, configured to receive a response.
The recording module 530 is further configured to record log information of the response intercepted by the first response intercepting module 512, to obtain second log data, so as to implement monitoring on a link from the front-end user equipment to the back-end server in combination with the first log data.
A first response intercepting module 512, configured to return a response to the user client.
It can be seen from this embodiment that, the apparatus provided in the present application, by adding the set tracking information to the request and then sending the tracking information to the back-end server, realizes full link tracking of the user request from the front-end user equipment; according to the obtained first log data and the second log data, the time consumed in the process from the time when the front-end user equipment initiates a request to the time when a response returned by the back-end server is received can be monitored, and the monitoring of the link from the front-end user equipment to the back-end server is realized.
Fig. 6 is another schematic structural diagram of a lottery system link monitoring device according to an embodiment of the present application.
Referring to fig. 6, a lottery system link monitoring apparatus 50 includes: interceptor 510, link processing module 520, recording module 530 (Recorder), upload module 540 (HttpLogger), initialization module 550 (initserver), first node module 560 (FirstSpan). The interceptor 510 includes a first request intercepting module 511 and a first response intercepting module 512.
The functions of the first request intercepting module 511, the first response intercepting module 512, the link processing module 520, and the recording module 530 may refer to the description in fig. 5, and are not described herein again.
The uploading module 540 is configured to obtain client link tracking data according to the first log data and the second log data, and upload the client link tracking data to monitor a link from the front-end user equipment to the back-end server.
The initialization module 550 is used to initialize each module in the lottery system link monitoring device.
The first node module 560 is used to create a first node (Span) of a full link, and in this embodiment, the traceId and the Span id of the first node are the same and are 64 bits of 16-bit data.
The link processing module 520 may include: the system comprises a link module (Trace), an agent module (Instrumentation), a node recording module (BatchRecorder), a timestamp module (time), a request head module (httpHeaders), a comment type module (annotation), a data type module (model), a conversion type module (JsonEncorder), a parse url type module (parseUrl), a network IP type module (network) and a console reporting type module (Console Rcenter). The link module (Trace) comprises a Record class module (Record), a sampling rate class module (Sampler), a tracking ID class module (TraceId), a random link ID module (randomTraceId) and an empty state class module (Noop). The proxy module (Instrumentation) comprises a client class module (httpclient).
The link processing module 520 adds the setting trace information and generates the client link trace data by using a plurality of different modules included therein. For example, the node recording module 530 may record a summary, timestamp events, key value annotations (tags), span id, span duration (duration), etc. in the node. The annotation class module can annotate and record the request for specific time related information (e.g. time), and there are multiple annotation descriptions in a node, which usually contains the following four annotation information: cs (i.e., client Start, indicating a Client initiated request); sr (i.e. Server Receive, indicating that the Server receives the request); ss (Server Send, which means that the Server finishes processing and sends the result to the client); cr (i.e., client Received, which indicates that the Client acquires the return information of the server). It can be understood that a plurality of different modules included in the link processing module 520 may process and generate information data corresponding to their module names, and the different modules in the link processing module 520 cooperate to implement the addition of the setting trace information and the generation of the client link trace data.
Fig. 7 is a schematic structural diagram of a lottery system link monitoring system according to an embodiment of the present application.
Referring to fig. 7, a lottery system link monitoring system 70, comprises: front-end user equipment 610, back-end server 620.
A front-end user device 610, configured to obtain a request initiated by a user client; adding set tracking information to the request, and recording the log information of the request to obtain first log data; sending the request added with the setting tracking information to the back-end server 620, so that the back-end server 620 processes the request and returns a response carrying the setting tracking information; receiving the response, and recording the log information of the response to obtain second log data, so as to realize monitoring of the link from the front-end user equipment 610 to the back-end server 620 by combining the first log data; the response is returned to the user client.
And the back-end server 620 is used for processing the request and returning a response carrying the setting tracking information.
Fig. 8 is another structural diagram of a lottery system link monitoring system according to an embodiment of the present application.
Referring to fig. 8, a lottery system link monitoring system 70 includes: front-end user equipment 610, back-end server 620, monitoring server 630 and preset database 640.
The functions of the front-end user equipment 610 and the back-end server 620 may refer to the description in fig. 7, and are not described herein again.
Further, the front-end user device 610 is further configured to obtain client link tracking data according to the first log data and the second log data, and upload the client link tracking data to the monitoring server 630.
And the monitoring server 630 is configured to acquire the client link tracking data by using the collection and reporting service module, and write the client link tracking data into a local log file. Further, the monitoring server 630 also collects client link tracking data in the local log file by using the collector, and writes the client link tracking data into the preset database 640.
Further, the monitoring server 630 may also inject the application metadata into the client link trace data, and then write the client link trace data containing the application metadata into the preset database 640.
Further, the back-end server 620 is further configured to perform service logic processing on the http request by using the service application module to generate a response carrying the set tracking information, and perform log information recording during the processing of the request by using the service application module to generate server-side link tracking data; writing the server-side link tracking data generated by the service application module into a local log file; the collector is used for collecting the server link tracking data in the local log file, and the server link tracking data is written into the preset database 640.
Further, the back-end server 620 may further inject the application metadata into the client link trace data, and then write the client link trace data containing the application metadata into the preset database 640.
Wherein, the application metadata may include different information as follows: app-ID (server account ID), application-ID (server application ID), cluster-ID (server cluster ID), namespace-ID (server namespace ID), appProup-ID (server deployment group ID), instance-ID (server deployment instance ID), local-IP (server deployment instance IP address).
The default database 640 is used for storing the client link tracking data and the server link tracking data. The preset Database 640 may be a CTSDB (Cloud Time Series Database).
It can be seen that, by using the client link trace data and the server link trace data, the full link of the micro service architecture system including the front-end ue 610 can be traced and monitored.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated herein.
Fig. 9 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
Referring to fig. 9, an electronic device 900 includes a memory 910 and a processor 920. The electronic device 900 may be a front-end user device.
The Processor 920 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 910 may include various types of storage units, such as system memory, read Only Memory (ROM), and permanent storage. Wherein the ROM may store static data or instructions for the processor 920 or other modules of the computer. The persistent storage device may be a read-write storage device. The persistent storage may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the persistent storage device employs a mass storage device (e.g., magnetic or optical disk, flash memory) as the persistent storage device. In other embodiments, the permanent storage may be a removable storage device (e.g., floppy disk, optical drive). The system memory may be a read-write memory device or a volatile read-write memory device, such as a dynamic random access memory. The system memory may store instructions and data that some or all of the processors require at run-time. Further, the memory 910 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash, programmable read only memory), magnetic and/or optical disks, as well. In some embodiments, memory 910 may include a removable storage device that is readable and/or writable, such as a Compact Disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, dual layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., SD card, min SD card, micro-SD card, etc.), a magnetic floppy disk, or the like. Computer-readable storage media do not contain carrier waves or transitory electronic signals transmitted by wireless or wired means.
The memory 910 has stored thereon executable code that, when processed by the processor 920, may cause the processor 920 to perform some or all of the methods described above.
Furthermore, the method according to the present application may also be implemented as a computer program or computer program product comprising computer program code instructions for performing some or all of the steps of the above-described method of the present application.
Alternatively, the present application may also be embodied as a computer-readable storage medium (or non-transitory machine-readable storage medium or machine-readable storage medium) having executable code (or a computer program or computer instruction code) stored thereon, which, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the various steps of the above-described method according to the present application.
Having described embodiments of the present application, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or improvements to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. A lottery system link monitoring method, comprising:
acquiring a request initiated by a user client;
adding set tracking information to the request, and recording log information of the request to obtain first log data;
sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information;
receiving the response, recording log information of the response, obtaining second log data, and monitoring a link from the front-end user equipment to the back-end server by combining the first log data;
and returning the response to the user client.
2. The method of claim 1, wherein:
the client comprises a browser;
the acquiring a request initiated by a user client includes: after a browser enters a webpage and loads a preset component, a request initiated by a user browser is obtained through the preset component.
3. The method of claim 1, further comprising:
and obtaining client link tracking data according to the first log data and the second log data, and uploading the client link tracking data to monitor a link from the front-end user equipment to the back-end server.
4. The method of claim 3, wherein uploading the client link trace data comprises:
and uploading the client link tracking data to a monitoring server or the back-end server, so that the monitoring server or the back-end server monitors a link from the front-end user equipment to the back-end server according to the client link tracking data.
5. The method of claim 3, wherein uploading the client link trace data comprises:
and uploading the client link tracking data according to a preset reporting delay time according to a preset sampling rate rule.
6. The method of claim 5, further comprising:
and adjusting the preset sampling rate rule and the preset reporting delay according to the load condition of the client for processing the service data.
7. A lottery system link monitoring apparatus, comprising:
the first request intercepting module is used for acquiring a request initiated by a user client;
the link processing module is used for adding set tracking information to the request intercepted by the first request intercepting module;
the recording module is used for recording the log information of the request processed by the link processing module to obtain first log data;
the first request intercepting module is further configured to send the request after the set tracking information is added to the link processing module to a back-end server, so that the back-end server processes the request and returns a response carrying the set tracking information;
a first response intercepting module for receiving the response;
the recording module is further configured to record log information of the response intercepted by the first response intercepting module, to obtain second log data, so as to implement, in combination with the first log data, monitoring on a link from the front-end user equipment to the back-end server;
and the first response intercepting module is used for returning the response to the user client.
8. The apparatus of claim 7, further comprising an upload module;
the uploading module is used for obtaining client link tracking data according to the first log data and the second log data and uploading the client link tracking data so as to monitor a link from front-end user equipment to a back-end server.
9. A lottery system link monitoring system, comprising:
the front-end user equipment is used for acquiring a request initiated by a user client; adding set tracking information to the request, and recording log information of the request to obtain first log data; sending the request added with the set tracking information to a back-end server so that the back-end server processes the request and returns a response carrying the set tracking information; receiving the response, recording log information of the response, and obtaining second log data so as to realize monitoring on a link from the front-end user equipment to the back-end server by combining the first log data; returning the response to the user client;
and the back-end server is used for processing the request and returning a response carrying the set tracking information.
10. A computer-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method of any of claims 1-6.
CN202211251299.9A 2022-10-13 2022-10-13 Lottery system link monitoring method, device and system Pending CN115580607A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211251299.9A CN115580607A (en) 2022-10-13 2022-10-13 Lottery system link monitoring method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211251299.9A CN115580607A (en) 2022-10-13 2022-10-13 Lottery system link monitoring method, device and system

Publications (1)

Publication Number Publication Date
CN115580607A true CN115580607A (en) 2023-01-06

Family

ID=84585992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211251299.9A Pending CN115580607A (en) 2022-10-13 2022-10-13 Lottery system link monitoring method, device and system

Country Status (1)

Country Link
CN (1) CN115580607A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116775440A (en) * 2023-08-21 2023-09-19 青岛民航凯亚系统集成有限公司 Log-level link tracking method and system based on airport production operation system
CN117130870A (en) * 2023-10-26 2023-11-28 成都乐超人科技有限公司 Transparent request tracking and sampling method and device for Java architecture micro-service system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116775440A (en) * 2023-08-21 2023-09-19 青岛民航凯亚系统集成有限公司 Log-level link tracking method and system based on airport production operation system
CN116775440B (en) * 2023-08-21 2023-12-01 青岛民航凯亚系统集成有限公司 Log-level link tracking method and system based on airport production operation system
CN117130870A (en) * 2023-10-26 2023-11-28 成都乐超人科技有限公司 Transparent request tracking and sampling method and device for Java architecture micro-service system
CN117130870B (en) * 2023-10-26 2024-01-26 成都乐超人科技有限公司 Transparent request tracking and sampling method and device for Java architecture micro-service system

Similar Documents

Publication Publication Date Title
US7941789B2 (en) Common performance trace mechanism
US8037458B2 (en) Method and system for providing a common structure for trace data
US7979850B2 (en) Method and system for generating a common trace data format
CN115580607A (en) Lottery system link monitoring method, device and system
US8028200B2 (en) Tracing operations in multiple computer systems
US8037457B2 (en) Method and system for generating and displaying function call tracker charts
US20170187782A1 (en) Telemetry response system
CN107122296B (en) Method and apparatus for data assertion for test interface
US11386061B2 (en) Telemetry request system
US11556456B2 (en) Telemetry system extension
CN112532490A (en) Regression testing system and method and electronic equipment
CN102999314A (en) Immediate delay tracker tool
US20170109379A1 (en) Telemetry definition system
CN106649000B (en) Fault recovery method of real-time processing engine and corresponding server
CN111314535A (en) Method and equipment for recording quality inspection process of mobile phone
CN116881145B (en) Interface testing method, device, equipment and storage medium based on flow playback
CN116126808A (en) Behavior log recording method, device, computer equipment and storage medium
CN113778777A (en) Log playback method and device
CN114895975A (en) Preheating method and equipment for server-side system
CN113297245A (en) Method and device for acquiring execution information
CN114928530B (en) Link information acquisition method and related device
CN116775440B (en) Log-level link tracking method and system based on airport production operation system
CN114760218B (en) Link sampling method and related device thereof
CN118055012A (en) Link acquisition method and system based on orchestration engine
CN116594880A (en) Application program optimization method and device, processor and electronic equipment

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