couchbaselabs / couchbaselabs/promtimer
Promtimer fails if logs have no persistent blocks
- Dominant language
- Python
- Stars
- 9
- Forks
- 26
- Avg merge
- 11d 1h
- Merged PRs (30d)
- 2
Description
A node which has not been up for long may not have any persistent blocks.
That is, stats_snapshot may just have head chunks and the WAL:
```
$ tree ./stats_snapshot/
./stats_snapshot/
├── chunks_head
│ └── 000001
├── queries.active
└── wal
└── 00000000
```
In this case, Promtimer fails with:
```
File ".../promtimer/promtimer.py", line 308, in
main()
File ".../promtimer/promtimer.py", line 259, in main
times = cbstats.CBCollect.compute_min_and_max_times(stats_sources)
File ".../promtimer/promtimer/cbstats.py", line 345, in compute_min_and_max_times
times = [s.get_min_and_max_times() for s in sources]
File ".../promtimer/promtimer/cbstats.py", line 345, in
times = [s.get_min_and_max_times() for s in sources]
File ".../promtimer/promtimer/cbstats.py", line 175, in get_min_and_max_times
return get_prometheus_times(self._cbcollect_dir)
File ".../promtimer/promtimer/cbstats.py", line 570, in get_prometheus_times
return min(min_times), max(max_times)
ValueError: min() arg is an empty sequence
```
Corresponding to:
```
def get_prometheus_times(cbcollect_dir):
min_times = []
max_times = []
meta_files = glob.glob(path.join(cbcollect_dir, 'stats_snapshot', '*', 'meta.json'))
for meta_file in meta_files:
with open(meta_file, 'r') as file:
meta = json.loads(file.read())
min_times.append(meta['minTime'] / 1000.0)
max_times.append(meta['maxTime'] / 1000.0)
return min(min_times), max(max_times)
```
No persistent block dirs like `01F5WQSJ4705B6SRTQE4CCB0DZ` (containing `meta.json`) are present, so the glob does not match anything.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.