Skip to content

Commit

Permalink
租户队积压分析 (#431)
Browse files Browse the repository at this point in the history
* update_jingyd6_2.5_queue

* test_queue

* update_new

* update0924

* update0925

* update0926

---------

Co-authored-by: jingyd66 <[email protected]>
  • Loading branch information
jingyd66 and jingyd66 authored Sep 26, 2024
1 parent b2b29c9 commit 35ab570
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from update.update import UpdateHandler
from colorama import Fore, Style
from common.config_helper import ConfigHelper
from handler.analyzer.analyze_queue import AnalyzeQueueHandler

from common.tool import TimeUtils, Util
from common.command import get_observer_version_by_sql
Expand Down Expand Up @@ -331,6 +332,10 @@ def analyze_fuction(self, function_type, opt):
self.set_context_skip_cluster_conn(function_type, 'analyze', config)
handler = AnalyzeLogHandler(self.context)
return handler.handle()
elif function_type == 'analyze_queue':
self.set_context(function_type, 'analyze', config)
handler = AnalyzeQueueHandler(self.context)
return handler.handle()
elif function_type == 'analyze_flt_trace':
self.update_obcluster_nodes(config)
self.set_context(function_type, 'analyze', config)
Expand Down
23 changes: 23 additions & 0 deletions diag_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,28 @@ def _do_command(self, obdiag):
return obdiag.analyze_fuction('analyze_log', self.opts)


class ObdiagAnalyzeQueueCommand(ObdiagOriginCommand):

def __init__(self):
super(ObdiagAnalyzeQueueCommand, self).__init__('queue', 'Analyze oceanbase log from online observer machines to registration queue')
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('--queue', type='int', help="quene size ", default=50)

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

def _do_command(self, obdiag):
return obdiag.analyze_fuction('analyze_queue', self.opts)


class ObdiagAnalyzeFltTraceCommand(ObdiagOriginCommand):

def __init__(self):
Expand Down Expand Up @@ -1109,6 +1131,7 @@ def __init__(self):
self.register_command(ObdiagAnalyzeFltTraceCommand())
self.register_command(ObdiagAnalyzeParameterCommand())
self.register_command(ObdiagAnalyzeVariableCommand())
self.register_command(ObdiagAnalyzeQueueCommand())
self.register_command(ObdiagAnalyzeIndexSpaceCommand())
# self.register_command(ObdiagAnalyzeSQLCommand())
# self.register_command(ObdiagAnalyzeSQLReviewCommand())
Expand Down
Loading

0 comments on commit 35ab570

Please sign in to comment.