A multi-dimensional DevOps metrics collection method

By obtaining the database metainformation of the DevOps tool chain and generating custom DML statements and ElasticSearch index templates, efficient collection and query of DevOps metrics are realized, solving the problems of low data collection efficiency and difficult maintenance in the existing technology, and improving data efficiency. Demonstrate flexibility and efficiency.

CN114238338BActive Publication Date: 2024-10-01WUHAN ZBANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111576139.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-10-01
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

Existing DevOps tool chain operation data collection and query efficiency is low, especially because no field index is set, making it difficult to efficiently query key dimension data. As the tool chain is upgraded, the database table structure is volatile and it is difficult to maintain relationships.

Method used

A multi-dimensional DevOps metric collection method is used to obtain the structured database meta-information of the tool chain, generate customized DML statements and ElasticSearch index templates, collect data regularly and write it into ElasticSearch in batches, and perform aggregate queries based on the configured dimension fields.

Benefits of technology

It achieves the flexibility and efficiency of DevOps data collection, reduces the need for manual writing of database queries, and improves the efficiency and maintainability of data display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238338B_ABST
    Figure CN114238338B_ABST
Patent Text Reader

Abstract

The present invention relates to the fields of DevOps and software engineering, and discloses a multi-dimensional DevOps metric index collection method, which is mainly capable of efficiently collecting raw data generated by DevOps tools, and flexibly searching and displaying according to custom dimensions. The method comprises: obtaining structured database meta information corresponding to the indicator data generated by tools in each stage of DevOps; an indicator collection component generates a DML statement and a search engine ElasticSearch index template according to user-defined database query conditions and metric indicator dimension fields; calling the indicator collection component, regularly collecting metric indicator data, and initiating batch write requests to the search engine ElasticSearch; and aggregating query indicator results to the search engine ElasticSearch according to the dimension fields configured by developers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of DevOps and software engineering, and more specifically, to a multi-dimensional DevOps metric collection method. Background Art

[0002] DevOps is a combination of Development and Operations, representing a culture that emphasizes communication and cooperation between software developers (Dev) and IT operations and maintenance technicians (Ops). It aims to make the process of building, testing, and releasing software faster, more frequent, and more reliable through automated software delivery and architecture change processes.

[0003] The implementation of DevOps requires the introduction of a large number of tool chains: for example, Jira and Ones in the project management stage, Gitlab and SVN in the version control and collaboration stage, Jenkins and Gitlab CI in the continuous integration stage, SonarQube in the quality scanning stage, Ant, Selenium, Jmeter in the automated testing stage, Spinnaker, Tekton in the continuous deployment stage.

[0004] Each operation of different tools at each stage of DevOps will generate corresponding data, such as demand status information, code submission information, single build results, automated test results, deployment results, etc. From these raw data, we can calculate many key DevOps metrics, such as the number of builds, automated test pass percentage, deployment frequency, etc. according to different dimensions. Metrics are the key to measuring the success of DevOps.

[0005] DevOps tool chain operation data is stored in the database or files of each tool. It is necessary to manually write a large number of database query statements or scripts to collect data into a unified database according to different data display dimensions. Usually, it is difficult to efficiently query key dimension data because field indexes are not set. Moreover, with the upgrade of the DevOps tool chain, the original database table structure is prone to change, making it difficult to maintain the corresponding relationship. Summary of the invention

[0006] The purpose of the present invention is to provide a multi-dimensional DevOps metric collection method that can efficiently collect the original data generated by DevOps tools and flexibly search and display them according to custom dimensions.

[0007] According to the present invention, the following technical solutions are adopted to achieve the above-mentioned purpose:

[0008] A multi-dimensional DevOps metric collection method includes the following steps:

[0009] Step S1, obtaining structured database metadata of indicator data generated by tools at each stage of DevOps;

[0010] Step S2, the indicator collection component generates DML statements and search engine ElasticSearch index templates according to the user-defined database query conditions and metric dimension fields;

[0011] Step S3, calling the indicator collection component, regularly collecting metric data, and initiating a batch write request to the search engine ElasticSearch;

[0012] Step S4, aggregate query indicator results to the search engine ElasticSearch according to the configured indicator dimension fields.

[0013] In the above technical solution, before step S1, it also includes: step S0, implementing a DevOps tool chain based on a unified user ID and project ID,

[0014] The DevOps tool chain specifically includes but is not limited to the following:

[0015] (1) Jira requirements management original database;

[0016] (2) Project build information obtained through the Jenkins REST API, including at least the following fields: task full name, trigger, build result, and task execution time;

[0017] (3) SonarQube task execution database, which contains at least the following fields: task full name, score, number of defects, number of vulnerabilities, and trigger;

[0018] In the above technical solution, step S1 includes:

[0019] S11, try to create a database connection object with the database link information, and write the database connection information into the search engine ElasticSearch;

[0020] S12. Obtain metadata information of the data by determining the database type, such as INFORMATION_SCHEMA of a MySQL or MariaDB database, and tablespace_name of an Oracle database.

[0021] 4. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that, step S2 comprises:

[0022] S21, obtaining database table information and field information from the metadata information in step S1, selecting the required table, and the valid data fields and dimension fields in the table, and the indicator collection component assembles the query fields into a complete database query statement DML by splicing;

[0023] S22. The indicator collection component persists the generated DML and the set metric dimension fields to the collection configuration index of the search engine ElasticSearch, where the metric dimension fields can be aggregatable fields such as user ID, project ID, organization name, etc.

[0024] S23. The indicator collection component creates an index template for the search engine ElasticSearch based on the aggregate dimension fields. The template name is named "table name*" and specifies the field mapping rules. The dimension fields use keyword segmentation, and the remaining fields are not segmented to improve the efficiency of aggregate search.

[0025] In the above technical solution, step S3 includes:

[0026] S31. Within an execution cycle specified by the scheduled execution, when the task starts, the current time and the last synchronization time are calculated, and the following DML statement is generated:

[0027] SELECT table name (field 1, field 2, field 3, ...) WHERE `time_field`>=last synchronization time AND `time_field`<current time, where time_field is the timestamp field defined in the original collection table;

[0028] The default value of the last synchronization time is the Unix initial time "January 1, 1970 0:00", which is dynamically modified in S33. ;

[0029] s32. After executing the DML statement, the acquired row data is written to the search engine ElasticSearch in batches in a loop, and the written index name is the name of the query database table;

[0030] S33. Determine the execution result of S32. If successful, update the field "last synchronization time" in the collection configuration index in step S22 to the current execution time. If failed, update the syncErrorMsg field in the collection configuration index and write the failure reason. Since the "last synchronization time" is not updated, the next execution cycle will continue to obtain the uncollected data in the failure cycle.

[0031] In the above technical solution, step S4 includes:

[0032] S41. Dimension fields can be selected as needed, but the time field must be used as the MUST clause in the Boolean query to search for quantitative data based on the time interval to prevent excessive time consumption due to excessive data volume. Sub-aggregation dimensions and aggregation methods are executed as needed.

[0033] S42. The aggregation method of the sub-aggregation can be selected according to the needs, and finally a customized aggregation query builder is generated to re-initiate a query request to the search engine ElasticSearch.

[0034] Because the present invention adopts the above technical solution, it has the following beneficial effects:

[0035] The present invention proposes a multi-dimensional DevOps metric index collection method, which generates a custom data operation language, collects indicator data from the database of the DevOps tool chain and writes it in batches to the search engine ElasticSearch, and generates aggregate query statements based on dimensional information, so that DevOps data collection is more flexible, more configurable and has no data duplication compared to writing scheduled tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 The figure is a simplified flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0038] like Figure 1 FIG. 1 is a flow chart of a multi-dimensional DevOps metric collection method of the present invention, comprising:

[0039] S1. Obtain the structured database metadata corresponding to the indicator data generated by the tools in each stage of DevOps.

[0040] The DevOps tools at each stage include the project management tool Jira, the continuous integration tool Jenkins, and the code quality scanning tool SonarQube. Since Jenkins uses a file directory to store data, the detailed information of the build results is obtained by parsing the XML file structure of each build result.

[0041] In order to accurately and intuitively configure the DevOps metric fields, the application will try to connect to the database, define metadata query statements based on the database type, and obtain metadata such as database table structure and field definition.

[0042] S2. Provide the customized DML (Data Manipulation Language) and the specified indicator dimension fields to the indicator collection component.

[0043] Specifically, the collector generates DML query statements by splicing SQL statements based on the database table fields selected by the developer, which can specifically query the data rows that are meaningful to the DevOps metrics, thereby reducing meaningless field queries and improving the speed of structured queries and data transmission efficiency. In addition, the collection component will save the customized DML and persist it to the search engine ElasticSearch for use in each execution of the data collection scheduled task. In order to improve the efficiency of the search engine ElasticSearch's multi-dimensional aggregation query, an index template will be further created to create word segmentation for the dimension fields required for the query.

[0044] S3. Call the indicator collection component, collect metric data regularly, and initiate a batch write request to the search engine ElasticSearch.

[0045] Among them, the scheduled collection generates a WEHRE clause (WHERE CLAUSE) based on the DML and database information persisted in S2 and the current execution time and the last execution time, generates the final DML statement and executes it, and writes the collected data in batches (Bulk Request) to the search engine ElasticSearch to improve writing efficiency. After writing is completed, the collection results (including the execution time of this task and whether this task is successful) need to be persisted for the next execution to generate DML query statements. DbSyncConfig is defined here to describe the detailed collection rules of a data indicator.

[0046] The definition of DbSyncConfig is as follows:

[0047]

[0048] Among them, description is used to identify the specific collection indicators of this collection rule. dbInfo represents the connection configuration information interface of the database. The program can implement different database connection classes and objects according to the database type. tableName and fetchFields represent the collection target table and the specific collection fields of the target table respectively. The default value of fetchFields is empty, and the application will collect all table fields. The program creates an index template for the search engine ElasticSearch based on the aggregatable metric fields stored in aggregationFields. enable can dynamically control whether the collection task is executed. timeField is the time field for the query. The program uses this field to query the incremental data generated within the collection interval period.

[0049] lastSyncTime indicates the start time of the last collection execution, and is also the last start time in the WHERE statement in DML. SyncErrorMsg can record the collection error exception stack to facilitate developers to troubleshoot collection problems.

[0050] CronExpression is a CRON expression that can define different collection frequencies for different indicators. The default value of this parameter is 24 hours a day. The program will determine every minute whether the cronExpression of all collection tasks should be triggered at the current time.

[0051] S4. Aggregate the query indicator results to the search engine ElasticSearch according to the dimension fields and aggregation methods configured by the developer;

[0052] The application will assemble the SearchRequest query statement, first perform a Bool query based on the time interval, and then add it to the sub-aggregation in order according to the aggregation field and aggregation method.

[0053] The present invention proposes a multi-dimensional DevOps metric index collection method, which obtains indicator data from the DevOps tool chain through customized collection fields and dimensions, creates an index template to the search engine ElasticSearch, and uploads the collected data in batches, making the data collection and aggregation of the DevOps tool chain more universal, efficient and flexible.

[0054] Finally, the method of the present invention is only a preferred embodiment and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A multi-dimensional DevOps metric collection method, characterized in that: The following steps are involved: Step S1, obtaining structured database metadata of indicator data generated by tools at each stage of DevOps; Step S2, the indicator collection component generates DML statements and search engine ElasticSearch index templates according to the user-defined database query conditions and metric dimension fields; Step S3, calling the indicator collection component, regularly collecting metric data, and initiating a batch write request to the search engine ElasticSearch; Step S4, aggregate query indicator results to the search engine ElasticSearch according to the configured indicator dimension fields.

2. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that: Before step S1, the method further includes: step S0, implementing a DevOps tool chain based on a unified user ID and project ID, The DevOps tool chain specifically includes the following: (1) Jira requirements management original database; (2) Project build information obtained through the Jenkins REST API, including at least the following fields: task full name, trigger, build result, and task execution time; (3) SonarQube task execution database, which contains at least the following fields: task full name, score, number of defects, number of vulnerabilities, and triggerer.

3. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that: in, Step S1 includes: S11, try to create a database connection object with the database link information, and write the database connection information into the search engine ElasticSearch; S12. Obtain metadata information of the data by determining the database type, including INFORMATION_SCHEMA of a MySQL or MariaDB database and tablespace_name of an Oracle database.

4. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that: in, Step S2 includes: S21, obtaining database table information and field information from the metadata information in step S1, selecting the required table, and the valid data fields and dimension fields in the table, and the indicator collection component assembles the query fields into a complete database query statement DML by splicing; S22, the indicator collection component persists the generated DML and the set metric indicator dimension fields to the collection configuration index of the search engine ElasticSearch, where the metric indicator dimension fields are aggregatable fields, including user ID, project ID, and organization name; S23. The indicator collection component creates an index template for the search engine ElasticSearch based on the aggregate dimension fields. The template name is named "table name*" and specifies the field mapping rules. The dimension fields use keyword segmentation, and the remaining fields are not segmented to improve the efficiency of aggregate search.

5. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that: in, Step S3 includes: S31. Within an execution cycle specified by the scheduled execution, when the task starts, the current time and the last synchronization time are calculated, and the following DML statement is generated: SELECT table name (field1, field2, field3, ...) WHERE `time_field` >= last synchronization time AND `time_field` < current time, where time_field is the timestamp field defined in the original collection table; The default value of the last synchronization time is the Unix initial time "January 1, 1970 0:00", which is dynamically modified in S33; s32. After executing the DML statement, the acquired row data is written to the search engine ElasticSearch in batches in a loop, and the written index name is the name of the query database table; S33. Determine the execution result of S32. If successful, update the field "last synchronization time" in the collection configuration index in step S22 to the current execution time. If failed, update the syncErrorMsg field in the collection configuration index and write the failure reason. Since the "last synchronization time" is not updated, the next execution cycle will continue to obtain the uncollected data in the failure cycle.

6. According to a multi-dimensional DevOps metric collection method according to claim 1, it is characterized in that: Step S4 includes: S41. Dimension fields can be selected as needed, but the time field must be used as the MUST clause in the Boolean query to search for quantitative data based on the time interval to prevent excessive time consumption due to excessive data volume. Sub-aggregation dimensions and aggregation methods are executed as needed; S42. The aggregation method of the sub-aggregation can be selected according to the needs, and finally a customized aggregation query builder is generated to re-initiate a query request to the search engine ElasticSearch.