A traffic monitoring data acquisition method based on Sentinel and InfluxDB

By verifying user terminal information and configuring custom annotation classes in the Sentinel console component, traffic data is stored in InfluxDB, and a data migration mechanism is introduced. This solves the security and fine-grained monitoring issues of Sentinel traffic monitoring data acquisition, and achieves efficient and stable data storage and analysis.

CN120110773BActive Publication Date: 2025-12-26NORTH CLOUD VIEW TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510304149.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-12-26
Estimated Expiration
2045-03-14

AI Technical Summary

Technical Problem

Existing Sentinel traffic monitoring data acquisition methods suffer from low security and an inability to achieve granular monitoring, especially in the case of potential data leakage during data transmission and the inability to meet millisecond-level real-time analysis requirements.

Method used

By obtaining user terminal information from the Sentinel console component, communication verification is performed. Traffic data is stored in InfluxDB based on custom annotation classes and configuration classes. A data migration mechanism is introduced to achieve security and fine-grained monitoring, including user role and terminal ID verification, traffic control rules, the use of custom annotation classes, and the data migration mechanism.

Benefits of technology

It achieves highly secure and stable traffic data acquisition, supports millisecond-level real-time analysis and fine-grained monitoring, and improves data storage efficiency and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120110773B_ABST
    Figure CN120110773B_ABST
Patent Text Reader

Abstract

The application relates to a Sentinel and InfluxDB-based traffic monitoring data acquisition method and belongs to the technical field of traffic data monitoring. The method solves the problems of low safety and incapability of realizing fine monitoring of the traffic data acquisition method in the prior art. User terminal information of a current Sentinel console component is acquired, the user terminal information is sent to a cloud database, the cloud database comprises multiple time-series databases InfluxDB, the cloud database receives the user terminal information, communication verification is realized based on the user terminal information, if the verification is passed, a business requirement is input in the Sentinel console component, traffic data collection is realized based on the business requirement and a self-defined annotation class, and the collected traffic data is stored in the InfluxDB based on a self-defined configuration class, so that traffic monitoring data is acquired. The application realizes a traffic monitoring data acquisition method with high safety and supporting fine monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of flow data monitoring, and in particular to a flow monitoring data acquisition method based on Sentinel and InfluxDB. BACKGROUND

[0002] Sentinel is an open-source lightweight traffic control component, focusing on traffic management, fuse degradation and system protection, widely used in micro-service architecture, helping developers to ensure system stability and high availability.

[0003] In order to overcome the limitations of real-time monitoring data storage of Sentinel, it is usually necessary to integrate InfluxDB time series database. In the prior art, technicians often realize it through the steps of introducing dependencies, creating SentinelMetric class, implementing MetricsRepository interface, configuring data storage, modifying Sentinel console, testing and verifying, etc. However, the link configured in this way has the following shortcomings: (1) the existing link method does not consider security, for example, monitoring data may contain sensitive information or confidential information, such as system running status, user behavior, business indicators, etc. If these data are obtained by unauthorized personnel, it may lead to data leakage, business risk and other problems; (2) it is impossible to realize fine-grained monitoring. Introducing Kafka and other message middleware in data transmission, the intermediate service can cache data and write to InfluxDB in batches regularly, but this way cannot realize real-time data analysis. For more fine-grained monitoring requirements (such as millisecond level), the limitation of data granularity may lead to the fact that some fine-grained monitoring scenarios cannot be met.

[0004] Therefore, it is necessary to provide a flow monitoring data acquisition method based on Sentinel and InfluxDB with high security and supporting fine-grained monitoring. SUMMARY

[0005] In view of the above analysis, the embodiments of the present application aim to provide a flow monitoring data acquisition method based on Sentinel and InfluxDB, to solve the problems of low security and inability to realize fine-grained monitoring of the existing flow data acquisition method.

[0006] The embodiments of the present application provide a flow monitoring data acquisition method based on Sentinel and InfluxDB, comprising:

[0007] Obtaining user terminal information of a current Sentinel console component, the user terminal information including a user terminal ID, a user role, an application number, and a target time series database InfluxDB, sending the user terminal information to a cloud database, the cloud database including a plurality of time series databases InfluxDB, each time series database being configured to store traffic data of a specific application;

[0008] The cloud database receives the user terminal information and performs communication verification based on the user terminal information, inputs a business requirement in the Sentinel console component if the verification is passed, implements traffic data collection based on the business requirement and a custom annotation class, and stores the collected traffic data to the InfluxDB based on a custom configuration class to obtain traffic monitoring data.

[0009] Based on the further improvement of the above method, for each Sentinel console component, a dependency relationship of a time series database InfluxDB is defined in a configuration file pom.xml, and connection information of the time series database InfluxDB is specified, the connection information including a database address, a port number, a Token, and a timeout time, so as to use the InfluxDB as a data source of the Sentinel console component; the query interface of the Sentinel console component is modified, and the execution logic of the query interface is modified to obtain data from the InfluxDB.

[0010] Based on the further improvement of the above method, the communication verification based on the user terminal information includes:

[0011] The user role and the user terminal ID are compared with a role-terminal table stored in the cloud database to verify whether the current user has the right to store data, if so, whether the current application number and the corresponding relationship of the target time series database InfluxDB are correct, if so, the verification is passed; wherein the role-terminal table is configured to store the corresponding relationship of the user role and the user terminal ID.

[0012] Based on the further improvement of the above method, the business requirement includes a traffic control rule, the traffic control rule including a resource name, a traffic control type, and a traffic control threshold; wherein the resource name is configured to specify a business name of traffic to be monitored, the traffic control type is configured to specify a monitoring parameter of traffic, and the traffic control threshold is configured to limit a maximum value of the traffic control type parameter.

[0013] Based on the further improvement of the above method, the custom annotation class includes: conditional annotation, used to verify whether the attribute value in the configuration file is the time series database InfluxDB, and if so, the custom configuration class takes effect; automatic configuration annotation, used to realize the automatic configuration of the target InfluxDB; configuration class annotation, used to limit whether to use the proxy mode; Bean annotation, used to create an InfluxDB entity warehouse instance to realize data storage operation.

[0014] Based on the further improvement of the above method, the business requirement further includes InfluxDB attribute configuration information and target mode.

[0015] The traffic data collection based on the business requirement and the custom annotation class includes:

[0016] A1: Adopt FlowRuleManager.loadRules to load traffic control rules to the Sentinel console component;

[0017] A2: Determine whether the attribute value of the conditional annotation is InfluxDB, and if so, enable the InfluxDB2AutoConfiguration.class function;

[0018] A3: Realize the automatic configuration of InfluxDB attribute based on the automatic configuration annotation;

[0019] A4: Modify the configuration class annotation value to the target mode;

[0020] A5: Create and register the Bean annotation function to realize the collection of traffic data of the query interface, and the traffic data includes: application name, resource name, number of requests per second passing through the Sentinel rule check, number of requests per second intercepted by the Sentinel rule, number of exceptions, average response time, total number of requests, resource code, creation time, modification time, and timestamp.

[0021] Based on the further improvement of the above method, the custom configuration class includes a data conversion method, used to convert the collected traffic data into an acceptable data type of InfluxDB;

[0022] The collected traffic data is stored into the InfluxDB based on the custom configuration class to obtain traffic monitoring data, including:

[0023] The data conversion method is called to process the collected traffic data to obtain the data to be stored;

[0024] The data to be stored is written into the database by a millisecond-level time precision using a synchronous write interface WriteApiBlocking of InfluxDB, so as to obtain the traffic monitoring data.

[0025] Based on the further improvement of the above method, the cloud database sets a preset storage space for each time-series database, and monitors the space usage and data write rate of each time-series database in real time, and when it is monitored that the traffic data of the application program reaches the preset storage space, data migration is triggered.

[0026] Based on the further improvement of the above method, the data migration comprises:

[0027] A temporary storage buffer is dynamically created, and the data exceeding the limit is temporarily stored in the buffer;

[0028] The cold data capacity of the current time-series database is calculated as a first data capacity, the capacity of the data in the current buffer is calculated as a second data capacity, if the first data capacity is greater than the second data capacity, the cold data in the previous time-series database is migrated, and after the migration is completed, the data in the buffer is stored in the current time-series database; if it is less, a preset quota of time-series database is re-allocated, the data in the buffer is stored in the newly allocated time-series database, and after the storage is completed, a storage topology update instruction is sent to the current Sentinel console component, so that subsequent data is directly written into the newly allocated time-series database.

[0029] Based on the further improvement of the above method, a storage health probe is integrated in the Sentinel console component, and the remaining storage space and write delay index of the target time-series database are obtained in real time.

[0030] When the storage performance is monitored to decrease, the Sentinel console component automatically triggers a relief scheme, and the relief scheme comprises:

[0031] If the remaining storage space of the target time-series database is lower than a preset emergency threshold, the collection frequency of the traffic monitoring data of the application program is reduced;

[0032] If the write delay index exceeds a preset index value, a local cache queue is enabled and the traffic monitoring data of the application program is batch compressed and transmitted.

[0033] Compared with the prior art, the present application can at least realize one of the following beneficial effects:

[0034] 1. The application provides a kind of based on Sentinel and InfluxDB's flow monitoring data acquisition method, introduce communication verification method, based on the data matching of user terminal information, only through the verification of the correspondence between user role and user terminal ID and the verification of the correspondence between application program number and target time series database InfluxDB, can the flow data monitoring between Sentinel console component and cloud database be carried out, to realize a kind of high security, strong stability flow data mode.In addition, the application gives up the way of using middleware batch storage data often used in prior art, the monitoring data of Sentinel console component is directly stored in the specified time series database in cloud database, improve data storage efficiency, so that system user can realize data analysis and use to existing data in real time, realize the fine monitoring of flow data.

[0035] 2. The application provides a kind of based on Sentinel and InfluxDB's flow monitoring data acquisition method, introduce data migration method in the time series database in cloud database, so that the method proposed in the application can support the processing of flow data exceeding the storage capacity of current time series database, further improve the stability of data storage.

[0036] In the application, the above-mentioned technical solutions can be combined with each other to realize more preferred combination schemes. Other features and advantages of the application will be described in the subsequent specification, and some advantages will become apparent from the specification or by implementing the application. The purpose and other advantages of the application can be achieved and obtained from the contents specifically pointed out in the specification and the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0037] The accompanying drawings are included to provide a further understanding of the application and are incorporated herein and constitute a part of the application.

[0038] Fig. 1 is an example diagram of a kind of based on Sentinel and InfluxDB's flow monitoring data acquisition method in the embodiment of the application;

[0039] Figure 2 For the example diagram of the correspondence between Sentinel console component and time series database InfluxDB in cloud database in the embodiment of the application. DETAILED DESCRIPTION

[0040] The preferred embodiments of the application will be described in detail below with reference to the accompanying drawings, wherein the drawings constitute a part of the application and are used to illustrate the principles of the embodiments of the application, but are not used to limit the scope of the application.

[0041] One specific embodiment of the present application discloses a Sentinel and InfluxDB-based traffic monitoring data acquisition method, as shown in the accompanying drawings, comprising: Figure 1

[0042] S1: Obtain the user terminal information of the current Sentinel console component, wherein the user terminal information comprises a user terminal ID, a user role, an application number, and a target time series database InfluxDB; and send the user terminal information to a cloud database, wherein the cloud database comprises a plurality of time series databases InfluxDB, and each time series database is used to store the traffic data of a specific application.

[0043] The method client comprises a plurality of Sentinel console components, and the cloud database end comprises a plurality of time series databases InfluxDB. Each InfluxDB is used to store the traffic data of a specific application, which is to facilitate the acquisition of traffic data. The system user can quickly acquire the traffic data of a specific application from the cloud database according to the correspondence between the time series database and the application number. As shown in the accompanying drawings, Sentinel console component 1 corresponds to InfluxDB 1, Sentinel console component 2 corresponds to InfluxDB 2, Sentinel console component 3 corresponds to InfluxDB 3, and Sentinel console component N corresponds to InfluxDB N. Figure 2 Figure 2 The correspondence shown in the accompanying drawings is only a schematic representation. In actual use, the correspondence between the Sentinel console component and the InfluxDB can be set according to actual needs.

[0044] The user terminal ID is used to limit the client device used by the current system user. The user role is used to limit the permission of the current system user. It can be understood that different user roles correspond to different permissions. This setting enhances the security of data, prevents data abuse, and reduces the risk of human error. The application number is used to indicate the application to be monitored. Exemplarily, the application number can be represented by numbers such as 1, 2, and 3, or by other forms of strings, bytecodes, etc. The system user can set the form of the application number according to business needs. The present application does not make any limitation here, as long as each application can be distinguished. The target time series database InfluxDB is used to indicate the storage location of the monitoring traffic data of the application.

[0045] ​​The application directly stores the monitoring data of the Sentinel console component to the time-series database InfluxDB, and thus, the configuration file of the Sentinel console component needs to be modified. Specifically, for each Sentinel console component, the dependency of the Sentinel console component is defined in the configuration file pom.xml, the dependency of the time-series database InfluxDB is defined, and the connection information of the time-series database InfluxDB is specified, the connection information including a database address, a port number, a Token and a timeout time, so as to take the InfluxDB as a data source of the Sentinel console component; the query interface of the Sentinel console component is modified, and the execution logic of the query interface is modified to acquire data from the InfluxDB.

[0046] Specifically, the Sentinel-related dependency is introduced in the build file (pom.xml) of the project, as follows:

[0047]

[0048] The InfluxDB-related dependency is introduced in the build file (pom.xml) of the project, as follows:

[0049]

[0050] In the configuration file, the connection information of the InfluxDB is added, including a database address, a port number, a Token and a timeout time, as follows:

[0051] influx.url=http: / / lcoalhost:8086 /

[0052] influx.token=UfgaW37A93PkncmJum25G7M2QkBg6xqqjGthh

[0053] influx.org=sentinel

[0054] infux.bucket=sentinel

[0055] influx.log-level=NONE

[0056] influx.read-timeout=10s

[0057] influx.write-timeout=10s

[0058] influx.connect-timeout=10s

[0059] Locate the query interface code in the code of the Sentinel console, find the part of the query interface code responsible for obtaining application traffic monitoring information, this part of the code directly reads data from various Sentinel client components; Introduce the InfluxDB client library: Introduce the corresponding InfluxDB client library (influxdb-client); Modify the query logic: modify the logic of the query interface to obtain data from InfluxDB.

[0060] S2: The cloud database receives the user terminal information, and realizes communication verification based on the user terminal information, if the verification is passed, input the business requirements in the Sentinel console component, realize traffic data collection based on the business requirements and custom annotation class, and store the collected traffic data to the InfluxDB based on the custom configuration class to obtain the traffic monitoring data.

[0061] The communication verification based on the user terminal information includes: comparing the user role and the user terminal ID with the role-terminal table stored in the cloud database, verifying whether the current user has the right to store data, if yes, verifying whether the corresponding relationship between the current application number and the target time series database InfluxDB is correct, if yes, the verification is passed; Wherein, the role-terminal table is used to store the corresponding relationship between the user role and the user terminal ID.

[0062] Wherein, the role-terminal table is stored in the cloud database by the system administrator in advance, and the information in the table is updated based on the business requirements, which is used to complete the verification of the user role and the user terminal ID. The corresponding relationship between the application number and the target time series database InfluxDB can also be stored by a data table, for example, a program-database table, which can also be stored in the cloud database by the system administrator in advance, and the information in the table is updated based on the business requirements, which is used to complete the verification of the corresponding relationship between the application number and the target time series database InfluxDB. The method proposed in the application first verifies the user role and the user terminal ID, and then verifies the corresponding relationship between the application number and the target time series database InfluxDB. Only when both verifications are passed, the system user can obtain the traffic data. Based on this way, the security and stability of the traffic data acquisition are further improved.

[0063] The business requirement includes a traffic control rule, and the traffic control rule includes a resource name, a traffic control type, and a traffic control threshold. The resource name is used to specify a business name of traffic to be monitored, the traffic control type is used to specify a monitoring parameter of traffic, and the traffic control threshold is used to limit a maximum value of the traffic control type parameter. The business requirement further includes InfluxDB attribute configuration information and a target mode.

[0064] Exemplarily, the resource name can be an application program, and a system user can specify an application program to be monitored according to a business requirement. The traffic control type includes a parameter type commonly used in traffic monitoring, such as a number of requests per second passing a Sentinel rule check, a number of requests per second intercepted by a Sentinel rule, an exception number, an average response time, and a total number of requests. The traffic control threshold can be a query per second, which can be set according to a business requirement, for example, a value of QPS (query per second) is set to 80, that is, a maximum of 80 requests per second is allowed to pass.

[0065] The custom annotation class includes a condition annotation, an automatic configuration annotation, a configuration class annotation, and a Bean annotation. The condition annotation is used to verify whether an attribute value in the configuration file is the time series database InfluxDB, and if yes, the custom configuration class is effective. The automatic configuration annotation is used to implement automatic configuration of the target InfluxDB. The configuration class annotation is used to limit whether a proxy mode, for example, a Full mode and a Lite mode, is used. The Bean annotation is used to create an InfluxDB entity warehouse instance to implement a data storage operation.

[0066] Exemplarily, an implementation of each annotation is as follows:

[0067] The condition annotation is as follows:

[0068] @EnableConfigurationProperties(InfluxDBMetricsProperties.class), this annotation indicates that the configuration class is effective only when a sentinel.metrics.type attribute in a configuration file and a value of the attribute are equal to influxdb;

[0069] The automatic configuration annotation is as follows:

[0070] @AutoConfigureAfter(InfluxDB2AutoConfiguration.class), the annotation specifies that the configuration class should be configured after the InfluxDB2AutoConfiguration configuration class;

[0071] The configuration class annotation is as follows:

[0072] @Configuration(proxyBeanMethods = false), this annotation identifies the class as a configuration class, and the Spring container will load this configuration class at startup and process the configuration information in it, proxyBeanMethods = false indicates using Lite mode, which does not proxy the methods of the configuration class to improve the processing efficiency of the configuration class;

[0073] Bean annotation:

[0074]

[0075] Define a Spring Bean named InfluxDBMetricsEntityRepository to create an instance of InfluxDB entity repository, which is responsible for handling storage operations related to InfluxDB data.

[0076] The custom annotation class can also include:

[0077] Configuration property annotation:

[0078] @EnableConfigurationProperties(InfluxDBMetricsProperties.class), this annotation is used to enable support for InfluxDBMetricsProperties class, allowing binding of property values in configuration files to instances of InfluxDBMetricsProperties class, making it easier to use these properties in configuration classes;

[0079] Constructor injection annotation:

[0080] @RequiredArgsConstructor,

[0081] This is an annotation provided by Lombok, which will automatically generate a constructor containing all final modified fields.

[0082] The traffic data collection is implemented based on the business requirements and custom annotation class, including:

[0083] A1: Use FlowRuleManager.loadRules to load traffic control rules to the Sentinel console component;

[0084] A2: Determine whether the attribute value of the conditional annotation is InfluxDB, if so, enable the InfluxDB2AutoConfiguration.class function;

[0085] A3: automatically configuring InfluxDB properties based on the automatic configuration annotation;

[0086] A4: modifying the configuration class annotation value to the target mode;

[0087] A5: creating and registering a Bean annotation function to collect traffic data of the query interface, including: application name, resource name, number of requests per second passing through the Sentinel rule check, number of requests per second intercepted by the Sentinel rule, number of exceptions, average response time, total number of requests, resource code, creation time, modification time, and timestamp.

[0088] The collected traffic data is stored in the InfluxDB based on the custom configuration class to obtain traffic monitoring data, including:

[0089] A data conversion method is called to process the collected traffic data to obtain data to be stored;

[0090] The data to be stored is written into the database with millisecond-level time accuracy using the synchronous write interface WriteApiBlocking of InfluxDB to obtain traffic monitoring data.

[0091] The data conversion method refers to converting the collected traffic data into a data type acceptable to InfluxDB.

[0092] The application directly stores the monitoring data of the Sentinel console component into a specified time series database in the cloud database through a custom configuration class, improves the data storage efficiency, and thus enables real-time data analysis and use of existing data by system users, and realizes fine monitoring of traffic data.

[0093] The cloud database sets a preset storage space for each time series database and monitors the space usage and data write rate of each time series database in real time, and triggers data migration when the traffic data of the application reaches the preset storage space. The data migration includes:

[0094] B1: dynamically creating a temporary storage buffer to temporarily store data exceeding the limit in the buffer;

[0095] B2: calculating the cold data capacity of the current time-series database as a first data capacity, calculating the capacity of the current buffer data as a second data capacity, if the first data capacity is greater than the second data capacity, migrating the cold data in the previous time-series database, after the migration is completed, storing the data in the buffer to the current time-series database; if it is less, reallocating a preset quota of time-series database, storing the data in the buffer to the newly allocated time-series database, after the storage is completed, sending a storage topology update instruction to the current Sentinel console component, so that the subsequent data is directly written to the newly allocated time-series database.

[0096] In addition, the application integrates a storage health probe in the Sentinel console component, and real-time obtains the remaining storage space and write delay index of the target time-series database.

[0097] In Sentinel, the main function of the health probe is to monitor and manage the health status of the system, to ensure the stability and high availability of the service, and the health probe of Sentinel can usually obtain the following types of indexes: availability of service, response time, resource utilization (such as CPU, memory), number of database connections, average response time of database query, for time-series database (for example, InfluxDB), the following indexes can be obtained: write rate, query rate, number of data points, data storage size. On this basis, the health probe of Sentinel is further improved in the application, so that it can support obtaining the remaining storage space and write delay index (i.e. the write rate of the current target time-series database) of each target time-series database in the cloud database.

[0098] When the storage performance is monitored to decrease, the Sentinel console component automatically triggers a relief scheme, the relief scheme includes: if the remaining storage space of the target time-series database is lower than a preset emergency threshold, reducing the collection frequency of the application traffic monitoring data; if the write delay index exceeds a preset index value, enabling a local cache queue and batch compressing and transmitting the traffic monitoring data of the application. Exemplarily, the preset emergency threshold can be 500KB, and the preset index value can be 5KB / S.

[0099] Compared with the prior art, the traffic monitoring data acquisition method based on Sentinel and InfluxDB provided by the embodiment introduces a communication verification method, and only after the verification of the correspondence between the user role and the user terminal ID and the verification of the correspondence between the application program number and the target time series database InfluxDB, can the traffic data monitoring between the Sentinel console component and the cloud database be carried out, so that a traffic data mode with high security and strong stability is realized. In addition, the application discards the way of using middleware to store data in batches in the prior art, and directly stores the monitoring data of the Sentinel console component into the specified time series database in the cloud database, thereby improving the data storage efficiency, so that the system user can realize real-time data analysis and use of the existing data, and realizes fine monitoring of the traffic data. The time series database in the cloud database introduces a data migration method, so that the method proposed in the application can support processing of traffic data exceeding the storage capacity of the current time series database, further improving the stability of data storage.

[0100] Those skilled in the art can understand that all or part of the processes of the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. The computer readable storage medium includes a magnetic disk, an optical disk, a read-only memory, a random access memory, etc.

[0101] The above is only a preferred specific embodiment of the application, but the protection scope of the application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the application, which should be covered within the protection scope of the application.

Claims

1. A method for acquiring traffic monitoring data based on Sentinel and InfluxDB, characterized in that, The application comprises the following steps: Obtaining user terminal information of a current Sentinel console component, the user terminal information comprising a user terminal ID, a user role, an application number, and a target time series database InfluxDB, and sending the user terminal information to a cloud database, the cloud database comprising a plurality of time series databases InfluxDB, each time series database being used to store traffic data of a specific application; For each Sentinel console component, defining a dependency relationship of a time series database InfluxDB in a configuration file; The cloud database receives the user terminal information, and performs communication verification based on the user terminal information, if the verification is passed, inputting a business requirement in the Sentinel console component, implementing traffic data collection based on the business requirement and a custom annotation class, and storing the collected traffic data to the InfluxDB based on a custom configuration class to obtain traffic monitoring data; The communication verification based on the user terminal information comprises the following steps: Comparing the user role and the user terminal ID with a role-terminal table stored in the cloud database to verify whether the current user has the right to store data, if yes, verifying whether the current application number and the corresponding relationship of the target time series database InfluxDB are correct, if yes, the verification is passed; wherein the role-terminal table is used to store the corresponding relationship of the user role and the user terminal ID.

2. The Sentinel and InfluxDB-based traffic monitoring data acquisition method according to claim 1, characterized in that, For each Sentinel console component, defining a dependency relationship of a time series database InfluxDB in a configuration file pom.xml, and specifying connection information of the time series database InfluxDB, the connection information comprising a database address, a port number, a Token, and a timeout time, so as to use the InfluxDB as a data source of the Sentinel console component; modifying a query interface of the Sentinel console component, and modifying the execution logic of the query interface to obtain data from the InfluxDB.

3. The Sentinel and InfluxDB-based traffic monitoring data acquisition method of claim 1, wherein, The business requirement comprises a traffic control rule, the traffic control rule comprising a resource name, a traffic control type, and a traffic control threshold value; wherein the resource name is used to specify a business name of traffic to be monitored, the traffic control type is used to specify a monitoring parameter of traffic, and the traffic control threshold value is used to limit the maximum value of the traffic control type parameter.

4. The Sentinel and InfluxDB-based traffic monitoring data acquisition method according to claim 3, wherein the custom annotation class comprises: Conditional annotation is used to verify whether the attribute value in the configuration file is the time series database InfluxDB, if yes, the custom configuration class is effective; automatic configuration annotation is used to implement automatic configuration of the target InfluxDB; configuration class annotation is used to limit whether to use a proxy mode; and Bean annotation is used to create an InfluxDB entity warehouse instance to implement data storage operation.

5. The Sentinel and InfluxDB-based traffic monitoring data acquisition method of claim 4, wherein, The business requirement further comprises InfluxDB attribute configuration information and a target mode. The traffic data collection based on the business requirement and the custom annotation class comprises the following steps: A1: load traffic control rules to the Sentinel console component by using FlowRuleManager.loadRules; A2: determine whether the attribute value of the current condition annotation is InfluxDB, if yes, enable the InfluxDB2AutoConfiguration.class function; A3: automatically configure the InfluxDB attribute based on the automatic configuration annotation; A4: modify the configuration class annotation value to the target mode; A5: create and register a Bean annotation function to collect traffic data of the query interface, including: application name, resource name, number of requests per second passing through the Sentinel rule check, number of requests per second intercepted by the Sentinel rule, number of exceptions, average response time, total number of requests, resource code, creation time, modification time, and timestamp.

6. The Sentinel and InfluxDB-based traffic monitoring data acquisition method of claim 5, wherein, The custom configuration class includes a data conversion method for converting the collected traffic data into a data type acceptable to InfluxDB; The collected traffic data is stored in the InfluxDB based on the custom configuration class to obtain traffic monitoring data, including: calling the data conversion method to process the collected traffic data to obtain data to be stored; using the synchronous write interface WriteApiBlocking of InfluxDB to write the data to be stored into the database with millisecond-level time accuracy to obtain traffic monitoring data.

7. The Sentinel and InfluxDB-based traffic monitoring data acquisition method of claim 1, wherein, The cloud database sets a preset storage space for each time-series database and monitors the space usage and data write rate of each time-series database in real time. When the traffic data of the application reaches the preset storage space, data migration is triggered.

8. The Sentinel and InfluxDB-based traffic monitoring data acquisition method of claim 7, wherein, The data migration includes: dynamically creating a temporary storage buffer to temporarily store data that exceeds the limit in the buffer; calculating the cold data capacity of the current time-series database as a first data capacity, and calculating the capacity of the current buffer data as a second data capacity. If the first data capacity is greater than the second data capacity, the cold data in the previous time-series database is migrated, and after the migration is completed, the data in the buffer is stored in the current time-series database. If it is less, a preset quota of time-series databases is allocated, the data in the buffer is stored in the newly allocated time-series database, and after the storage is completed, a storage topology update instruction is sent to the current Sentinel console component to enable subsequent data to be directly written to the newly allocated time-series database.

9. The traffic monitoring data acquisition method based on Sentinel and InfluxDB according to claim 8, wherein a storage health probe is integrated in the Sentinel console component to obtain the remaining storage space and write delay indicators of the target time-series database in real time; When the storage performance is monitored to decrease, the Sentinel console component automatically triggers a mitigation scheme, and the mitigation scheme includes: if the remaining storage space of the target time-series database is lower than a preset emergency threshold, reducing the collection frequency of the application traffic monitoring data; if the write delay index exceeds a preset index value, enabling a local cache queue and batch compressing and transmitting the application traffic monitoring data.

Citation Information

Patent Citations

  • Sensinel-based service fusion, degradation, and current limiting system

    CN111475382A

  • Microservice flow limiting method and device

    CN115604344A