Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archery 慢查日志报错-未知错误,请联系管理员处理! #2468

Closed
xueanguo opened this issue Dec 26, 2023 · 3 comments · Fixed by #2471
Closed

Archery 慢查日志报错-未知错误,请联系管理员处理! #2468

xueanguo opened this issue Dec 26, 2023 · 3 comments · Fixed by #2471

Comments

@xueanguo
Copy link
Contributor

xueanguo commented Dec 26, 2023

重现步骤

1、版本master
2、docker logs -f archery
File "/opt/archery/sql/slowlog.py", line 135, in slowquery_review_history
query_engine = get_engine(instance=instance_info)
^^^^^^^^^^
NameError: name 'get_engine' is not defined
3、添加sed -i '1i from sql.engines import get_engine' /opt/archery/sql/slowlog.py
报错:

  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/slowlog.py", line 48, in slowquery_review
    self, start_time, end_time, db_name, limit, offset
    ^^^^
NameError: name 'self' is not defined

预期外的结果

2023-12-26 15:45:10,253 - django.request - ERROR - Internal Server Error: /slowquery/review/
Traceback (most recent call last):
File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/archery/sql/slowlog.py", line 48, in slowquery_review
self, start_time, end_time, db_name, limit, offset
^^^^
NameError: name 'self' is not defined

日志文本

No response

版本

master

部署方式

Docker

是否还有其他可以辅助定位问题的信息?比如数据库版本等

No response

@LeoQuote
Copy link
Collaborator

#2087 这里实现的时候忘记import 了, 麻烦import 一下, 测试下提个 pr 吧, 我这边没有相关资源提不了

@xueanguo
Copy link
Contributor Author

get_engine

导入进去self也报错

@LeoQuote
Copy link
Collaborator

@xueanguo 把 self 删掉即可, 方便的话验证一下提个 pr 谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants