Skip to content

feat: add GeneralMetricPublisher to collect and publish general metrics - #667

Merged
r350178982 merged 3 commits into
masterfrom
add-general-metric
Sep 23, 2026
Merged

r350178982 merged 3 commits into
masterfrom
add-general-metric

Conversation

@GX020124

Copy link
Copy Markdown
Contributor

No description provided.

@seafile-dev seafile-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Comment

Warnings:

  • 启动阶段首轮 General 指标可能在订阅建立前被 Redis Pub/Sub 丢弃,导致面板和 /metrics 最多一小时没有这些指标;见行内评论。
    Suggested fix: 为 MetricReceiver 增加订阅就绪同步,在启动发布器前等待该信号,并对超时记录或重试。

Comment thread events/metrics.py
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Warning] 启动首轮指标可能丢失

Why this matters:
MetricReceiver.start() 只会调度线程,尚不能保证其中的 get_subscriber() 已完成订阅;随后发布器会立即通过 Redis Pub/Sub 推送首轮数据。若订阅尚未建立,这些消息会被直接丢弃,General 指标会直到下一小时才出现,违背设计中首轮采集在一个 saver 周期后可见的预期。

Suggested fix: 为 Receiver 增加在成功订阅后置位的 ready Event,并在启动 GeneralMetricPublisher 前等待该信号;超时应记录日志并重试或延后首次发布。

@r350178982
r350178982 merged commit eb9d8fd into master Sep 23, 2026
1 check passed
@r350178982
r350178982 deleted the add-general-metric branch September 23, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants