MetricWriter has a bug that may not have an index file
Open
area/logging
kind/bug
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## 问题描述
MetricWriter存在隐含bug
MetricWriter构造函数中将lastSecond初始化为当前时间戳,如果在同一时间戳调用write函数写入log,走下面的分支,可能出现没有写索引文件的bug:

Contributor guide
Research direction
Locate MetricWriter and inspect its constructor and write path, especially the branch reached when both use the same timestamp. Reproduce that call sequence and verify whether the expected index file is created; done means the same-timestamp write no longer leaves the log without an index file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100