A method for dynamically adjusting the sampling rate of call chains
通过动态调整调用链采样率,结合服务访问失败率和健康度,实现了在微服务架构下调用链数据采集的智能性和效率,解决了传统采集方法中存储成本和数据丢失的问题,降低了 Operating costs and improve fault location capabilities.
Patent Information
- Application Number
- CN202411142687.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-20
AI Technical Summary
Traditional call chain data collection uses a fixed sampling rate, which cannot be adjusted in real time according to business conditions, resulting in increased storage costs and data reporting pressure when the business system increases, and key abnormal call chain data may be lost in the event of system failure, making it difficult to verify Efficiency and storage costs.
The method of dynamically adjusting the call chain sampling rate is adopted. By configuring the upper limit, lower limit, amplitude coefficient and service access failure rate threshold, the service access failure rate is calculated in real time, dynamically up or down the sampling rate, and the sampling rate is adjusted online according to service health.
It effectively reduces storage costs and data upload pressure, improves the intelligence of call chain monitoring and fault location efficiency, saves operational costs, and reduces the burden of data collection when the service is running well.
Smart Images

Figure CN118659985B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of PaaS infrastructure, and in particular relates to a method for dynamically adjusting a call chain sampling rate. Background Art
[0002] The PaaS (Platform as a Service) platform monitoring system provides call chain monitoring services. When the system completes the business call, the call information (time, interface, level, result) between services is logged, and then all the dotted data is connected into a tree chain to generate a call chain. The log information generated in the process is analyzed and processed, the complete call process of the end-to-end execution of the business is restored, and statistical analysis is performed according to different dimensions; thus, abnormal service calls are identified, and the abnormal service can be quickly analyzed and demarcated; at the same time, the system performance bottleneck can be analyzed based on data statistics.
[0003] With the increase in business systems and service calls, call chain data has grown to a huge scale. In this case, collecting the full amount of call chain data requires huge storage costs, which also brings great pressure to data reporting. Traditional call chain data collection uses a fixed sampling rate and cannot be adjusted in real time according to business conditions, and cannot effectively balance verification efficiency and storage costs.
[0004] With the popularity of microservice architecture, the composition of application systems has become increasingly complex, and the difficulty of system monitoring and fault location has also increased. Call chain is an effective tool for microservice monitoring and fault analysis. However, since the mechanism of call chain is to collect information from all nodes under the entire call chain, the amount of call chain data is huge when the system request volume increases. Although the sampling rate can be used to control whether to sample, it will still cause some key abnormal call chain data to be lost.
[0005] How to ensure that valuable call chains are not lost while reducing the amount of call chain data has become a difficult problem for PaaS platform monitoring. Summary of the invention
[0006] In view of the above deficiencies in the prior art, an object of the present invention is to provide a method for dynamically adjusting the call chain sampling rate, which can effectively improve the intelligence of call chain collection.
[0007] The present invention proposes a method for dynamically adjusting a call chain sampling rate, comprising:
[0008] S1, configuring a dynamic sampling rate adjustment rule, wherein the dynamic sampling rate adjustment rule includes: a sampling rate upper limit, a sampling rate lower limit, an amplitude coefficient, a service access failure rate threshold, and a sampling adjustment frequency;
[0009] S2, collects service gateway access logs in real time and calculates service access failure rate in real time;
[0010] S3, acquiring the service access failure rate according to the sampling adjustment frequency, and comparing the service access failure rate with the service access failure rate threshold. When it is determined that the service access failure rate reaches the service access failure rate threshold, executing step S4; otherwise, executing step S5;
[0011] S4, when it is determined that the service access failure rate reaches or exceeds the service access failure rate threshold, the sampling rate is increased according to the amplitude coefficient, and the increased sampling rate is less than or equal to the sampling rate upper limit;
[0012] S5, when it is determined that the service access failure rate is lower than the service access failure rate threshold, the sampling rate is lowered according to the amplitude coefficient, and the lowered sampling rate is greater than or equal to the sampling rate lower limit;
[0013] S6, continuously looping at a predetermined frequency, and dynamically adjusting the sampling rate according to the real-time situation of the service access failure rate.
[0014] Further, in S1, the sampling rate upper limit is that the service sampling rate is adjusted to be no higher than the upper limit value;
[0015] The sampling rate lower limit is the service sampling rate that is adjusted to not be less than the lower limit;
[0016] The adjusted sampling rate is between the upper sampling rate limit and the lower sampling rate limit;
[0017] The amplitude coefficient is the amplitude of each adjustment of the sampling rate;
[0018] The service access failure rate threshold is used to determine the result of the sampling rate adjustment according to the determination result of the service access failure rate and the threshold;
[0019] The sampling adjustment frequency is a periodic frequency for adjusting the sampling rate periodically.
[0020] Furthermore, in S2, a log collector is used to collect access logs of the service gateway and push them to a message queue for aggregation.
[0021] Furthermore, the service gateway first receives the service access, forwards the service access to each service, collects the log messages in the service gateway and stores them in the message queue, calculates the service access failure rate in real time based on the log, and then modifies the sampling rate of the service.
[0022] Furthermore, in the S3, the sampling adjustment frequency is read, and the adjustment logic is triggered regularly according to the sampling adjustment frequency, including: obtaining the service access failure rate calculated in real time, and comparing it with the configured service access failure rate threshold.
[0023] Furthermore, the dynamic sampling rate adjustment rule is configurable, including:
[0024] The dynamic sampling rate adjustment rule is defined by configuring the sampling rate upper limit, the sampling rate lower limit, the amplitude coefficient, the service access failure rate threshold and the sampling adjustment frequency;
[0025] Configure dynamic sampling rate adjustment rules to meet business needs for specific scenarios.
[0026] Furthermore, the method for dynamically adjusting the call chain sampling rate adopts one of the following ways to adjust the sampling rate:
[0027] (1) Shell mode: manually modify the sampling rate through shell commands;
[0028] (2) Remote call mode: Modify the sampling rate through the remote call mode.
[0029] The beneficial effects of the present invention are as follows:
[0030] (1) With the increasing application of microservice architecture, call chain monitoring has become a monitoring method that more and more companies need to adopt. The present invention creatively proposes a dynamic sampling rate, which provides a good corresponding solution for different verification requirements of low service failure and high failure rate, effectively saves costs and reduces server pressure.
[0031] The dynamic sampling rate modification scheme implemented by the present invention can effectively promote the call chain monitoring scenario to reduce costs and increase efficiency. Compared with the fixed sampling rate used in traditional call chain collection, the present invention can better adapt to business scenarios and reduce operating costs. After the telecommunications PaaS platform uses dynamic sampling rate adjustment, compared with full collection without dynamic sampling rate, the dynamic sampling rate adjustment scheme saves 90% of storage, better adapts to business scenarios, and reduces operating costs.
[0032] (2) The present invention uses dynamic adjustment of the sampling rate. When the business is good, the sampling rate is reduced to save costs. When the business system access failure rate increases, the call chain sampling rate is dynamically increased to enhance the verification efficiency.
[0033] (3) The present invention supports dynamic and automatic adjustment of the call chain sampling rate. In scenarios where the service access failure rate is high and the verification demand is strong, the service call chain sampling rate is dynamically increased to collect a larger proportion of call chain data to better support fault verification. When the service call failure rate is low and the verification demand is low, the service call chain sampling rate can be dynamically reduced to reduce the upload pressure and storage cost of the call chain data, effectively improving the intelligence of call chain collection. The present invention helps to better locate service fault problems and save service fault location time. In scenarios where the service runs well and the verification demand is weak, the service call chain sampling rate is dynamically reduced to help save storage costs and reduce the pressure of uploading data.
[0034] (4) In the call chain sampling rate scenario, the present invention calculates the service health in real time based on the service access log as a basis for deciding whether to adjust the sampling rate.
[0035] (5) The present invention uses a service-oriented approach to dynamically adjust the sampling rate online. At the same time, based on the health status of the business system service, when the service response error rate increases, the sampling rate is dynamically increased based on the error rate to collect a higher proportion of call chain data to better support fault verification. When the service response failure rate is low, the service call chain sampling rate is dynamically reduced to reduce the amount of call chain data, reduce the data upload pressure and storage cost, and effectively improve the intelligence of call chain collection and storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0037] Figure 1 A flow chart of a method for dynamically adjusting a call chain sampling rate according to an embodiment of the present invention;
[0038] Figure 2 An architectural diagram of a method for dynamically adjusting a call chain sampling rate according to an embodiment of the present invention;
[0039] Figure 3 A schematic diagram of a method for dynamically adjusting a call chain sampling rate according to an embodiment of the present invention;
[0040] Figure 4 The present invention is a flowchart of a method for dynamically adjusting a call chain sampling rate applied to a PaaS platform. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0042] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0043] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0045] The present invention proposes a method for dynamically adjusting a call chain sampling rate, and relates to the technical field of PaaS infrastructure, in particular to the field of large-scale call chain data collection.
[0046] like Figure 1 and Figure 3 As shown, the method for dynamically adjusting the call chain sampling rate according to an embodiment of the present invention includes the following steps:
[0047] S1, configure dynamic sampling rate adjustment rules.
[0048] In the embodiment of the present invention, the dynamic sampling rate adjustment rules include: a sampling rate upper limit, a sampling rate lower limit, an amplitude coefficient, a service access failure rate threshold, and a sampling adjustment frequency.
[0049] (1) The upper limit of the sampling rate is the service sampling rate adjusted to meet the upper limit value.
[0050] (2) The lower limit of the sampling rate is the service sampling rate that is adjusted to not less than the lower limit.
[0051] The adjusted sampling rate is between the upper sampling rate limit and the lower sampling rate limit.
[0052] (3) The amplitude coefficient is the amplitude of each adjustment of the sampling rate.
[0053] For example, the upper limit of the sampling rate is 100% (10 call chain data records), the lower limit is 1%, and the amplitude coefficient can be 5%.
[0054] (4) The service access failure rate threshold is used to determine the result of the sampling rate adjustment based on the judgment result of the service access failure rate and the threshold.
[0055] The service access failure rate threshold is set based on service operation experience. For example, if there are 3 errors out of 100 accesses, a 3% error rate is acceptable.
[0056] The result of the sampling rate adjustment is determined, that is, the action of adjusting the sampling rate in steps S4 and S5.
[0057] (5) The sampling adjustment frequency is the periodic frequency for adjusting the sampling rate regularly.
[0058] The method for dynamically adjusting the sampling rate of a call chain according to an embodiment of the present invention supports configurable dynamic sampling rate adjustment rules, including:
[0059] Dynamic sampling rate adjustment rules are defined by configuring key parameters such as the upper and lower limits of the sampling rate, the amplitude coefficient, the service access failure rate threshold, and the sampling adjustment frequency. In addition, dynamic sampling rate adjustment rules that are closer to business needs can be configured for specific scenarios.
[0060] The PaaS (Platform as a Service) platform monitoring system provides call chain monitoring services. The amount of call chain data is huge, and reasonable adjustment of the sampling rate can achieve an effective balance between verification efficiency and storage cost.
[0061] S2, collects service gateway access logs in real time and calculates service access failure rate in real time.
[0062] refer to Figure 2,Service access goes to the service gateway first, and then the service gateway forwards it to each service, such as service A, service B, and service C. The logs in the service gateway are collected and stored in the message queue. After that, the service access failure rate will be calculated in real time based on these data, and then the sampling rate of the service will be modified according to the rules of step S4 / S5.
[0063] In this step, a log collector is used to collect service gateway access logs and push them to the message queue for aggregation. The error rate of collecting service gateway access logs is calculated based on the access log data. For example, if there are 100 access logs and 3 access errors, the error rate is 3%.
[0064] S3, regularly obtaining the service access failure rate according to the sampling adjustment frequency, and comparing the service access failure rate with the service access failure rate threshold.
[0065] Specifically, the sampling adjustment frequency is read, and the adjustment logic is triggered according to the sampling adjustment frequency, including: obtaining the service access failure rate calculated in real time, and comparing it with the configured service access failure rate threshold. When it is determined that the service access failure rate reaches the service access failure rate threshold, step S4 is executed; otherwise, step S5 is executed.
[0066] S4: When it is determined that the service access failure rate reaches or exceeds the service access failure rate threshold, the sampling rate is increased according to the amplitude coefficient, and the increased sampling rate is less than or equal to the sampling rate upper limit.
[0067] Specifically, refer to Figure 4 , the real-time calculated service access failure rate and the service access failure rate threshold are judged. If the service access failure rate reaches or exceeds the service access failure rate threshold, the system confirms the increase amplitude according to the amplitude.
[0068] The increase range must be compared with the upper limit of the sampling rate, and the increased sampling rate must be guaranteed to be below the upper limit of the sampling rate. The sampling rate value is automatically adjusted through shell mode or remote call.
[0069] S5, when it is determined that the service access failure rate is lower than the service access failure rate threshold, the sampling rate is lowered according to the amplitude coefficient, and the lowered sampling rate is greater than or equal to the sampling rate lower limit.
[0070] Specifically, the service access failure rate calculated in real time is judged against the service access failure rate threshold. If the service access failure rate is lower than the service access failure rate threshold, the system confirms the reduction amplitude according to the amplitude.
[0071] The reduction range must be compared with the lower limit of the sampling rate, and the sampling rate after reduction must be guaranteed to be above the lower limit of the sampling rate. The sampling rate value is automatically adjusted through shell mode or remote call.
[0072] S6, continuously cycles at a predetermined frequency and dynamically adjusts the sampling rate according to the real-time situation of the service access failure rate.
[0073] In this step, the predetermined frequency is a fixed value, which can be set according to the total number of service visits and experience. For example, the predetermined frequency is set to 10s.
[0074] Through the timing module, the service access failure rate is analyzed regularly and continuously, and the service sampling rate is modified dynamically and continuously.
[0075] The method for dynamically adjusting the call chain sampling rate according to the embodiment of the present invention may adjust the sampling rate in one of the following ways:
[0076] (1) Shell mode: manually modify the sampling rate through shell commands;
[0077] (2) Remote call mode: The sampling rate can be modified through the remote call mode, and the sampling rate dynamic adjustment module can be used to realize the function of automatically modifying the sampling rate.
[0078] The method for dynamically adjusting the call chain sampling rate of the embodiment of the present invention can be applied to a telecommunications PaaS platform, and the method for dynamically adjusting the call chain sampling rate of the present invention is used in the application monitoring process.
[0079] The method for dynamically adjusting the call chain sampling rate of an embodiment of the present invention can be applied to the following scenarios: large-scale call chain monitoring and call chain monitoring scenarios under a microservice architecture.
[0080] The method for dynamically adjusting the call chain sampling rate according to the embodiment of the present invention has the following beneficial effects:
[0081] (1) With the increasing application of microservice architecture, call chain monitoring has become a monitoring method that more and more companies need to adopt. The present invention creatively proposes a dynamic sampling rate, which provides a good corresponding solution for different verification requirements of low service failure and high failure rate, effectively saves costs and reduces server pressure.
[0082] The dynamic sampling rate modification scheme implemented by the present invention can effectively promote the call chain monitoring scenario to reduce costs and increase efficiency. Compared with the fixed sampling rate used in traditional call chain collection, the present invention can better adapt to business scenarios and reduce operating costs. After the telecommunications PaaS platform uses dynamic sampling rate adjustment, compared with full collection without dynamic sampling rate, the dynamic sampling rate adjustment scheme saves 90% of storage, better adapts to business scenarios, and reduces operating costs.
[0083] (2) The present invention uses dynamic adjustment of the sampling rate. When the business is good, the sampling rate is reduced to save costs. When the business system access failure rate increases, the call chain sampling rate is dynamically increased to enhance the verification efficiency.
[0084] (3) The present invention supports dynamic and automatic adjustment of the call chain sampling rate. In scenarios where the service access failure rate is high and the verification demand is strong, the service call chain sampling rate is dynamically increased to collect a larger proportion of call chain data to better support fault verification. When the service call failure rate is low and the verification demand is low, the service call chain sampling rate can be dynamically reduced to reduce the upload pressure and storage cost of the call chain data, effectively improving the intelligence of call chain collection. The present invention helps to better locate service fault problems and save service fault location time. In scenarios where the service runs well and the verification demand is weak, the service call chain sampling rate is dynamically reduced to help save storage costs and reduce the pressure of uploading data.
[0085] (4) In the call chain sampling rate scenario, the present invention calculates the service health in real time based on the service access log as a basis for deciding whether to adjust the sampling rate.
[0086] (5) The present invention uses a service-oriented approach to dynamically adjust the sampling rate online. At the same time, based on the health status of the business system service, when the service response error rate increases, the sampling rate is dynamically increased based on the error rate to collect a higher proportion of call chain data to better support fault verification. When the service response failure rate is low, the service call chain sampling rate is dynamically reduced to reduce the amount of call chain data, reduce the data upload pressure and storage cost, and effectively improve the intelligence of call chain collection and storage.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for dynamically adjusting a call chain sampling rate, characterized in that: include: S1, configuring a dynamic sampling rate adjustment rule, wherein the dynamic sampling rate adjustment rule includes: a sampling rate upper limit, a sampling rate lower limit, an amplitude coefficient, a service access failure rate threshold, and a sampling adjustment frequency; wherein the sampling rate upper limit is the service sampling rate that is adjusted to be no higher than the upper limit value; The sampling rate lower limit is the service sampling rate that is adjusted to not be less than the lower limit; The adjusted sampling rate is between the upper sampling rate limit and the lower sampling rate limit; The amplitude coefficient is the amplitude of each adjustment of the sampling rate; The service access failure rate threshold is used to determine the result of the sampling rate adjustment according to the determination result of the service access failure rate and the threshold; The sampling adjustment frequency is a periodic frequency for regularly adjusting the sampling rate; S2, real-time collection of service gateway access logs, and real-time calculation of service access failure rate; wherein, a log collector is used to collect service gateway access logs and push them to a message queue for aggregation; the service gateway first receives a service access, and the service gateway forwards the service access request to each service, collects log messages in the service gateway and stores them in the message queue, calculates the service access failure rate in real time based on the log, and then modifies the service sampling rate; S3, acquiring the service access failure rate according to the sampling adjustment frequency, and comparing the service access failure rate with the service access failure rate threshold. When it is determined that the service access failure rate reaches the service access failure rate threshold, executing step S4; otherwise, executing step S5; Among them, reading the sampling adjustment frequency and triggering the adjustment logic according to the sampling adjustment frequency include: obtaining the service access failure rate calculated in real time and comparing it with the configured service access failure rate threshold; S4, when it is determined that the service access failure rate reaches or exceeds the service access failure rate threshold, the sampling rate is increased according to the amplitude coefficient, and the increased sampling rate is less than or equal to the sampling rate upper limit; S5, when it is determined that the service access failure rate is lower than the service access failure rate threshold, the sampling rate is lowered according to the amplitude coefficient, and the lowered sampling rate is greater than or equal to the sampling rate lower limit; S6, continuously looping at a predetermined frequency, and dynamically adjusting the sampling rate according to the real-time situation of the service access failure rate.
2. A method for dynamically adjusting the call chain sampling rate according to claim 1, characterized in that: The dynamic sampling rate adjustment rules are configurable and include: The dynamic sampling rate adjustment rule is defined by configuring the sampling rate upper limit, the sampling rate lower limit, the amplitude coefficient, the service access failure rate threshold and the sampling adjustment frequency; Configure dynamic sampling rate adjustment rules that meet business needs.
3. The method for dynamically adjusting the call chain sampling rate according to claim 1, characterized in that: The method for dynamically adjusting the call chain sampling rate uses one of the following methods to adjust the sampling rate: (1) Shell mode: manually modify the sampling rate through shell commands; (2) Remote call mode: Modify the sampling rate through the remote call mode.
