summaryrefslogtreecommitdiffstats
path: root/qtip/collector/logfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'qtip/collector/logfile.py')
-rw-r--r--qtip/collector/logfile.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/qtip/collector/logfile.py b/qtip/collector/logfile.py
index 6528ea9f..19780aaa 100644
--- a/qtip/collector/logfile.py
+++ b/qtip/collector/logfile.py
@@ -9,6 +9,30 @@
from base import BaseCollector
+from qtip.base.constant import CollectorProp as CProp
+from qtip.loader.file import FileLoader
+
class LogfileCollector(BaseCollector):
"""collect performance metrics from log files"""
+
+ def __init__(self, config, paths=None):
+ super(LogfileCollector, self).__init__(config)
+ self.loader = FileLoader('.', paths)
+
+ def collect(self):
+ captured = {}
+ for item in self._config[CProp.LOGS]:
+ captured.update(self._parse_log(item))
+ return captured
+
+ def _parse_log(self, log_item):
+ captured = {}
+ # TODO(yujunz) select parser by name
+ if CProp.GREP in log_item:
+ for rule in log_item[CProp.GREP]:
+ captured.update(self._grep(log_item[CProp.FILENAME], rule))
+ return captured
+
+ def _grep(self, filename, rule):
+ return {}