Search

CN-116186091-B - Rule matching-based flow marking method and device

CN116186091BCN 116186091 BCN116186091 BCN 116186091BCN-116186091-B

Abstract

The invention discloses a rule matching-based flow marking method and device, which comprise the steps of firstly, if a program script is set by a matching rule, preferentially executing program script matching, secondly, if the result of script execution is true representing matching, marking the requested flow according to a preset mark, thirdly, if false is returned, indicating that no flow is marked on the matching, fourthly, dynamically transmitting parameters of the script program to the script program when the script is operated, and finally giving a marked result through complex logic execution of the script program, and fifthly, executing matching marking by using provided basic rule information if no script is set. The invention utilizes the high-low collocation of two modes of basic rules and advanced scripts, is flexibly applied, and meets the marking requirements of different scenes.

Inventors

  • ZHANG WEIXIN

Assignees

  • 深圳马可孛罗科技有限公司

Dates

Publication Date
20260505
Application Date
20230310

Claims (2)

  1. 1. A flow marking method based on rule matching is characterized by comprising the following steps of firstly, if a program script is set by a matching rule, preferentially executing program script matching, secondly, if the result of script execution is true, the request flow is marked according to a preset mark, thirdly, if false is returned, the request flow is indicated to be unmatched, the flow is not marked, fourthly, parameters of the script program are request parameters of a system interface, are dynamically transmitted to the script program when the script is operated, and finally, a marked result is given through complex logic execution of the script program, and fifthly, if no script is set, the matching mark is carried out by using the provided basic rule information; The method comprises the following two aspects of a rule loading/updating method and a method for marking traffic by using rule matching; The rule loading/updating method specifically comprises the following steps of S1, constructing RE information, S2, requesting to acquire rule data according to a rule loading address URL of system configuration, S3, acquiring returned RS, S4, judging whether the code of the RS is 0, if not, executing S5, otherwise, executing S6, S5, acquiring RU information contained in the RS, updating a local RU cache, and S6, ending the updating of the round; The method for using rule matching to mark flow specifically comprises the following steps of SS1, receiving an external http request R, SS2, intercepting the request R flow, SS3, obtaining parameter information PARAM of the request R and PATH information PATH, SS4, inquiring whether a marking rule RU corresponding to a system is cached locally, if yes, executing SS5, otherwise SS15, SS5, obtaining RU, judging whether an enable state is true, if yes, executing SS6, otherwise SS15, whether scriptS of SS6 and RU are set, if yes, executing SS7, otherwise executing SS11, SS7, constructing script execution parameters which comprise the PARAM and PATH, SS8, executing a specified S script program by using a script engine, if yes, judging a return result, executing SS10, otherwise executing SS15, executing SS10, marking the flow by using coloringTag information of RU, executing SS15, if SS11, whether PATH of the flow R is contained in APPLYINTERFACEPATH of RU, if yes, executing SS12, randomly generating random numbers between SS12 and SS1 and RU 100, if yes, judging whether the flow is a random number between SS14 and RU 14, and a random number is smaller than that if yes, and if yes, executing the random number is smaller than the random number is set, and if yes, executing SS14, and if yes, judging that the flow is smaller than the flow is executed 14, and if the flow is executed is 14, and is executed.
  2. 2. A traffic marking device is characterized by comprising an RU maintenance module, a traffic interception module, a traffic marking core module, a traffic marking module and a traffic marking module, wherein the RU maintenance module is used for providing an RU maintenance function through the RU maintenance module, providing a new and modified interface of a rule to facilitate the management of the rule, and further carrying out interaction responsibility when an application system is started or the rule is pulled regularly, retrieving the held RU according to request parameters of the application system, intercepting R of incoming traffic, only intercepting the traffic R from other systems, and then performing next marking rule matching and traffic marking, the traffic interception module adopts a mode which is specific to language to dynamically intercept all http interfaces exposed to the current system, so that the traffic is intercepted in a similar cut-off mode when a request comes in, and acquires parameters of the R and an actual http path to be transmitted to the RU application module, the RU application module is responsible for the core logic reality of the traffic marking and local cache according to the request parameters of the application system, analyzing the path and parameter information after external requests are requested by the request interception module, the RU application module is responsible for judging whether the RU application module is in a specific state and the traffic marking module is required to be loaded to the specific running rule and the running rule updating module and the traffic marking module is updated according to the initial running rule and the initial running rule is updated or not loaded, the U loading/updating module is responsible for acquiring RU information configured by the current system through communication with the RU maintenance module according to the configured URL and acquiring the latest rule configuration through timing training communication after starting, and calling the RU application module to update the local RU cache after the RU information is acquired.

Description

Rule matching-based flow marking method and device Technical Field The invention relates to the field of intersystem flow control, in particular to a flow marking method and device based on rule matching. Background Under the background of rapid iteration of the current Internet technology, the application release speed is faster and faster, the request flow of a system is larger and larger, the requirements of release stability, controllable release fault range and reliable performance are brought along, therefore, the requirements of calling flow between systems are higher and higher, the traditional method in the industry is to mark and distinguish the flow by taking version information at a flow inlet or to independently deploy a whole set of system environment for realizing the purposes of release verification, system pressure measurement, AB test and the like, but the traditional method has the defects of extremely high maintenance cost of the whole set of environment, low reusability of version number modes and lack of flexibility of only full-link identification, so that the actual effect is greatly discounted, and the aim of well solving the problems cannot be achieved. Disclosure of Invention The invention aims to solve the technical problems of a flow marking method and a flow marking device based on rule matching, and aims to solve the problem of system flow distinction so as to achieve the purposes of fault controllable edition issuing, flow pressure measurement, AB test, acquisition analysis and the like. The invention is realized by the following technical scheme that a flow marking method based on rule matching, Comprising the following steps: if the matching rule sets the program script, preferentially executing the program script matching; secondly, if the result of script execution is true, the request flow is marked according to a preset mark on the matching; (III) if false is returned, indicating that no traffic is marked on the mismatch; The parameters of the script program are request parameters of a system interface, the request parameters are dynamically transmitted to the script program when the script is run, and then a result whether the script program marks or not is finally given through complex logic execution of the script program; and fifthly, performing matching marking by using the provided basic rule information if no script is set. The preferable technical scheme comprises a rule loading/updating method and a method for marking traffic by using rule matching. As a preferred technical solution, the rule loading/updating method specifically includes the following steps: s1, constructing RE information; S2, loading address URL requests according to rules configured by the system to acquire rule data; s3, acquiring returned RS; s4, judging whether the code of the RS is 0, if not, executing S5, otherwise, executing S6; s5, acquiring RU information contained in the RS, and updating a local RU cache; s6, the update of the round is finished. As a preferred technical solution, the method for marking the flow by using rule matching specifically includes the following steps: SS1, receiving an external http request R; SS2, intercepting request R traffic; SS3, acquiring request R parameter information PARAM and PATH information PATH; the SS4 is used for inquiring whether the marking rule RU corresponding to the system is cached locally or not, if so, the SS5 is executed, otherwise, the SS15 is executed; SS5, obtaining RU, judging whether the enable state is true, if yes, executing SS6, otherwise, SS15; scriptS of the SS6 and RU has a setting or not, if yes, executing the SS7, otherwise executing the SS11; SS7, constructing script execution parameters including the PARAM and PATH described above; SS8, executing the specified S-script program using the script engine; SS9, judging to return a result, if true, executing SS10, otherwise executing SS15; SS10, marking traffic using coloringTag information of RU, performing SS15; Whether the PATH of the SS11 and the flow R is contained in the RU APPLYINTERFACEPATH, if yes, executing the SS12, otherwise executing the SS15; SS12, random number RAM between 1-100 is randomly generated; SS13, judge RAM is smaller than coloringPercent value of RU, if yes, carry out SS14, otherwise carry out SS15; SS14, marking traffic using coloringTag information of RU; And SS15, marking the end of the flow. The invention relates to a device for marking flow, which comprises: in addition, the RU maintenance module also takes the interactive responsibility when the application system is started or the rule is pulled regularly, and searches the held RU and returns the result according to the request parameters of the application system; The flow interception module is used for intercepting the R of the entering flow, and only the flow R from other systems is intercepted first, the next marking rule matching and the flow marking can be carried out; the flow intercep