alibaba / alibaba/Sentinel

Questions regarding FETCH_INTERVAL of dashboard MetricFetcher | 获取各应用监控信息的时间设置问题

Open
#2,332 0 comments 0 reactions 0 assignees View on GitHub
area/dashboard
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

读源代码(版本:`1.8.2` )时,引发的一些问题,位置如下:
`com.alibaba.csp.sentinel.dashboard.metric.MetricFetcher.java(268)`,如图:
![image](https://user-images.githubusercontent.com/12644274/129161160-70f1cefe-dcf4-41ee-90a8-8c11a59a386f.png)
其中 `FETCH_INTERVAL_SECOND` 为何设置为 `6` 秒,按此逻辑, 我做了如下调试:
![image](https://user-images.githubusercontent.com/12644274/129161207-3116b70f-a63a-4f0e-8c97-510169c46b98.png)
若初次启动 `Fetch` 任务时,时间为 `45` 秒,此时内存中没有记录最后时间,所以 `Fetch` 时间段为 `30~36` 秒,按照程序 `10` 秒运行一次的逻辑,如图:
![image](https://user-images.githubusercontent.com/12644274/129162860-1823e8ee-8b78-4d59-8731-1a1274e606ed.png)
当程序 `55` 秒再次运行 `Fetch` 任务时,按代码逻辑,会取时间段为 `40~46` 秒的数据,问:
1、第 `264` 行代码 ` Math.max(lastFetchMs, appLastFetchTime.get(app).get() + 1000)` 似乎永远都是前者大,此处是否多余?
2、`36~40` 秒及 `46~50` 秒的数据为何不取?
3、`FETCH_INTERVAL_SECOND` 设置为 `6` 是因为页面表格只展示6条数据吗?有没有其它作用?是否可以更改?
4、`Fetch` 定时任务的执行周期是否可以设置长一点,当接入应用很多时,是否有性能问题?如何解决?
非常感谢!

Contributor guide

Open the contributing guide

Research direction

Start with com.alibaba.csp.sentinel.dashboard.metric.MetricFetcher.java around lines 264-268 and inspect FETCH_INTERVAL_SECOND plus the scheduled Fetch task. Trace how lastFetchMs and appLastFetchTime are set across successive runs, then check the dashboard metric-query tests or entry points if present. Done means documenting the intended interval behavior, whether gaps are expected, and any confirmed performance impact or required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.