Skip to content

Commit

Permalink
Merge pull request jly8866#87 from hhyo/github
Browse files Browse the repository at this point in the history
慢日志也支持同时管理rds和本地实例
  • Loading branch information
Mr.July authored Jul 17, 2018
2 parents 29ab8e4 + 200ae04 commit 2ebf3d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
20 changes: 13 additions & 7 deletions sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .const import WorkflowDict
from .inception import InceptionDao
from .models import users, master_config, slave_config, QueryPrivilegesApply, QueryPrivileges, QueryLog, SlowQuery, \
SlowQueryHistory
SlowQueryHistory, AliyunRdsConfig
from .data_masking import Masking
from .workflow import Workflow
from .permission import role_required, superuser_required
Expand Down Expand Up @@ -818,9 +818,12 @@ def slowquery_review(request):

# 判断是RDS还是其他实例
cluster_info = master_config.objects.get(cluster_name=cluster_name)
if settings.ALIYUN_RDS_MANAGE:
# 调用阿里云慢日志接口
result = aliyun_rds_slowquery_review(request)
if len(AliyunRdsConfig.objects.filter(cluster_name=cluster_name)) > 0:
if settings.ALIYUN_RDS_MANAGE:
# 调用阿里云慢日志接口
result = aliyun_rds_slowquery_review(request)
else:
raise Exception('未开启rds管理,无法查看rds数据!')
else:
StartTime = request.POST.get('StartTime')
EndTime = request.POST.get('EndTime')
Expand Down Expand Up @@ -920,9 +923,12 @@ def slowquery_review_history(request):

# 判断是RDS还是其他实例
cluster_info = master_config.objects.get(cluster_name=cluster_name)
if settings.ALIYUN_RDS_MANAGE:
# 调用阿里云慢日志接口
result = aliyun_rds_slowquery_review_history(request)
if len(AliyunRdsConfig.objects.filter(cluster_name=cluster_name)) > 0:
if settings.ALIYUN_RDS_MANAGE:
# 调用阿里云慢日志接口
result = aliyun_rds_slowquery_review_history(request)
else:
raise Exception('未开启rds管理,无法查看rds数据!')
else:
StartTime = request.POST.get('StartTime')
EndTime = request.POST.get('EndTime')
Expand Down
8 changes: 0 additions & 8 deletions sql/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,5 @@
url(r'^kill_session/$', views_ajax.kill_session, name='kill_session'),
url(r'^sapce_status/$', views_ajax.tablesapce, name='tablesapce'),
url(r'^del_sqlcronjob/$', jobs.del_sqlcronjob, name='del_sqlcronjob'),

]

if settings.ALIYUN_RDS_MANAGE:
from . import aliyun_function

aliyun_function_url = [
url(r'^sapce_status/$', aliyun_function.sapce_status, name='sapce_status'),
]
urlpatterns.extend(aliyun_function_url)

0 comments on commit 2ebf3d1

Please sign in to comment.