Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promtimer fails if logs have no persistent blocks #34

Open
jameseh96 opened this issue Mar 14, 2022 · 0 comments
Open

Promtimer fails if logs have no persistent blocks #34

jameseh96 opened this issue Mar 14, 2022 · 0 comments

Comments

@jameseh96
Copy link

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 <module>
    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 <listcomp>
    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.

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

No branches or pull requests

1 participant