Skip to content

Commit

Permalink
update0902
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyd66 committed Sep 2, 2024
1 parent 84770e8 commit 880a148
Show file tree
Hide file tree
Showing 4 changed files with 552 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches:
- master

- jingyd6_obdiag240
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

Expand Down
5 changes: 5 additions & 0 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from err import CheckStatus, SUG_SSH_FAILED
from handler.analyzer.analyze_flt_trace import AnalyzeFltTraceHandler
from handler.analyzer.analyze_log import AnalyzeLogHandler
from handler.analyzer.analyze_quene import AnalyzeQueneHandler
from handler.analyzer.analyze_sql import AnalyzeSQLHandler
from handler.analyzer.analyze_sql_review import AnalyzeSQLReviewHandler
from handler.analyzer.analyze_parameter import AnalyzeParameterHandler
Expand Down Expand Up @@ -279,6 +280,10 @@ def analyze_fuction(self, function_type, opt):
self.set_context_skip_cluster_conn(function_type, 'analyze', config)
handler = AnalyzeLogHandler(self.context)
handler.handle()
elif function_type == 'analyze_quene':
self.set_context(function_type, 'analyze', config)
handler = AnalyzeQueneHandler(self.context)
handler.handle()
elif function_type == 'analyze_flt_trace':
self.set_context(function_type, 'analyze', config)
handler = AnalyzeFltTraceHandler(self.context)
Expand Down
26 changes: 26 additions & 0 deletions diag_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,32 @@ def _do_command(self, obdiag):
return obdiag.analyze_fuction('analyze_log', self.opts)


class ObdiagAnalyzeQueneCommand(ObdiagOriginCommand):

def __init__(self):
super(ObdiagAnalyzeQueneCommand, self).__init__('quenue', 'Analyze oceanbase log from online observer machines to registration quenue')
self.parser.add_option('--from', type='string', help="specify the start of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--to', type='string', help="specify the end of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--files', action="append", type='string', help="specify files")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--tenant', type='string', help="Specify tenantname ")
self.parser.add_option('--quenue', type='int', help="quene size ", default=50)

def init(self, cmd, args):
super(ObdiagAnalyzeQueneCommand, self).init(cmd, args)
self.parser.set_usage('%s [options]' % self.prev_cmd)
return self

def _do_command(self, obdiag):
offline_args_sign = '--files'
if self.args and (offline_args_sign in self.args):
return obdiag.analyze_fuction('analyze_log_offline', self.opts)
else:
return obdiag.analyze_fuction('analyze_log', self.opts)


class ObdiagAnalyzeFltTraceCommand(ObdiagOriginCommand):

def __init__(self):
Expand Down
Loading

0 comments on commit 880a148

Please sign in to comment.