Created
May 6, 2021 21:19
-
-
Save jdurgin/5afd7cc126aefba0e383d80b5a48966d to your computer and use it in GitHub Desktop.
script to extract timestamp and dequeue latency for ops from an osd log
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
| #!/usr/bin/python | |
| from datetime import datetime | |
| import re | |
| import sys | |
| class Op(object): | |
| def __init__(self, line): | |
| self.lat = float(re.search('latency (\d+.\\d+)', line).group(1)) | |
| self.line = line | |
| time_format = '%Y-%m-%d %H:%M:%S.%f' | |
| self.time = datetime.strptime(line[:23], time_format) | |
| def main(): | |
| ops = [] | |
| with open(sys.argv[1]) as f: | |
| for line in f.readlines(): | |
| ops.append(Op(line)) | |
| #ops.sort(key=lambda x: x.lat, reverse=True) | |
| print() | |
| # print('100 longest requests:') | |
| # for i in range(min(100, len(ops))): | |
| # print(i + 1, ops[i].lat, ops[i].line) | |
| for op in ops: | |
| print(op.time.timestamp(), ',', op.lat) | |
| if __name__ == '__main__': | |
| main() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: filter the osd log for latency, and then run this script on it: