You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The description below is in English, if you wish to read the description in Chinese, please scroll to the end of this issue.
Requirement Description
In database systems, statistical metrics and monitoring functions are crucial for troubleshooting, especially when addressing performance issues. This requirement aims to add monitoring metrics to NebulaGraph, specifically to count the number of executions and measure the execution time of the Limit operator.
Implementation Approach
Learn from the Implementation of Other Metrics
Firstly, by consulting NebulaGraph's official documentation (monitoring metrics), we can find implementations of metrics similar to our requirements, such as num_sort_executors, which will serve as a reference for implementing our new metric.
Add New Code for Feature Implementation
Based on the reference information above, we can follow these steps for the code implementation of the new metric:
2.1 Define and Declare Metrics
Initially, define and declare the new metrics in the src/graph/stats/GraphStats.h and src/graph/stats/GraphStats.cpp files, as shown below:
Next, implement the metric logic in LimitExecutor.cpp and Executor.cpp. This specifically includes adding a count for the number of executions during the execution of the Limit operator and calculating the execution time:
Finally, using the method provided by NebulaGraph's official documentation for querying metrics, we can retrieve the results of the newly implemented metric. By executing several queries containing the Limit operator, we can further verify the accuracy of the metric.
The idea was provided by @AntiTopQuark , thank you.
Requirement Description
In database systems, statistical metrics and monitoring functions are crucial for troubleshooting, especially when addressing performance issues. This requirement aims to add monitoring metrics to NebulaGraph, specifically to count the number of executions and measure the execution time of the Limit operator.
Implementation Approach
Firstly, by consulting NebulaGraph's official documentation (monitoring metrics), we can find implementations of metrics similar to our requirements, such as
num_sort_executors
, which will serve as a reference for implementing our new metric.Based on the reference information above, we can follow these steps for the code implementation of the new metric:
2.1 Define and Declare Metrics
Initially, define and declare the new metrics in the
src/graph/stats/GraphStats.h
andsrc/graph/stats/GraphStats.cpp
files, as shown below:2.2 Metric Logic Implementation
Next, implement the metric logic in
LimitExecutor.cpp
andExecutor.cpp
. This specifically includes adding a count for the number of executions during the execution of the Limit operator and calculating the execution time:Finally, using the method provided by NebulaGraph's official documentation for querying metrics, we can retrieve the results of the newly implemented metric. By executing several queries containing the Limit operator, we can further verify the accuracy of the metric.
中文版描述
为 NebulaGraph 新增监控统计项
需求描述
在数据库系统中,系统的统计项和监控功能对于排查问题至关重要,尤其是在解决性能问题时。本次需求旨在为 NebulaGraph 新增监控统计项,具体为统计
Limit
算子的执行次数及其执行时间。实现思路
首先,通过查阅 NebulaGraph 的官方文档(监控统计项),我们可以找到与我们需求相似的统计项实现,例如
num_sort_executors
,作为我们实现新统计项的参考。基于上述参考信息,我们可以按照以下步骤进行新统计项的代码实现:
2.1 定义和声明统计项
首先,在
src/graph/stats/GraphStats.h
和src/graph/stats/GraphStats.cpp
文件中定义并声明新的统计项,如下所示:2.2 统计项逻辑实现
接着,在
LimitExecutor.cpp
和Executor.cpp
中实现统计逻辑,具体包括在执行Limit
算子时增加执行次数的统计,并计算执行时间:最后,按照 NebulaGraph 官方提供的统计项查询方法,我们可以获取新实现的统计项结果。通过执行几条包含
Limit
算子的查询语句,进一步验证统计项的准确性。The text was updated successfully, but these errors were encountered: