feat: add GeneralMetricPublisher to collect and publish general metrics - #667
Merged
Merged
Conversation
seafile-dev
reviewed
Sep 22, 2026
seafile-dev
left a comment
There was a problem hiding this comment.
Verdict: Comment
Warnings:
- 启动阶段首轮 General 指标可能在订阅建立前被 Redis Pub/Sub 丢弃,导致面板和
/metrics最多一小时没有这些指标;见行内评论。
Suggested fix: 为MetricReceiver增加订阅就绪同步,在启动发布器前等待该信号,并对超时记录或重试。
| self._metric_task.start() | ||
|
|
||
| logging.info('Start general metric publisher, interval = %s sec', self._general_metric_internal) | ||
| self._general_metric_publisher = GeneralMetricPublisher(self._general_metric_internal) |
There was a problem hiding this comment.
[Warning] 启动首轮指标可能丢失
Why this matters:
MetricReceiver.start() 只会调度线程,尚不能保证其中的 get_subscriber() 已完成订阅;随后发布器会立即通过 Redis Pub/Sub 推送首轮数据。若订阅尚未建立,这些消息会被直接丢弃,General 指标会直到下一小时才出现,违背设计中首轮采集在一个 saver 周期后可见的预期。
Suggested fix: 为 Receiver 增加在成功订阅后置位的 ready Event,并在启动 GeneralMetricPublisher 前等待该信号;超时应记录日志并重试或延后首次发布。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.