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

支持mongodb进程状态查看 #1563

Merged
merged 7 commits into from
Jun 10, 2022
Merged

支持mongodb进程状态查看 #1563

merged 7 commits into from
Jun 10, 2022

Conversation

weideguo
Copy link
Collaborator

@weideguo weideguo commented Jun 2, 2022

会话管理 -> 进程状态 可以查看mongodb的连接信息。
因为依赖库pymongo版本的原因,只支持mongodb3.6及以上版本。

@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #1563 (8b7bbf9) into master (ba1fdb6) will decrease coverage by 0.35%.
The diff coverage is 11.62%.

❗ Current head 8b7bbf9 differs from pull request most recent head 3ab2291. Consider uploading reports for the commit 3ab2291 to get more accurate results

@@            Coverage Diff             @@
##           master    #1563      +/-   ##
==========================================
- Coverage   76.81%   76.46%   -0.36%     
==========================================
  Files          92       91       -1     
  Lines       14325    14398      +73     
==========================================
+ Hits        11004    11009       +5     
- Misses       3321     3389      +68     
Impacted Files Coverage Δ
sql/db_diagnostic.py 12.24% <4.67%> (-4.04%) ⬇️
common/utils/extend_json_encoder.py 61.11% <45.45%> (-6.89%) ⬇️
sql/views.py 67.01% <0.00%> (-0.69%) ⬇️
sql/engines/goinception.py 80.76% <0.00%> (-0.19%) ⬇️
sql/engines/mssql.py 69.89% <0.00%> (-0.16%) ⬇️
sql_api/urls.py 100.00% <0.00%> (ø)
sql/data_dictionary.py 100.00% <0.00%> (ø)
sql_api/apps.py
sql/engines/mongo.py 48.23% <0.00%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba1fdb6...3ab2291. Read the comment docs.

kill_sql = kill_sql + row[0]
result['data'] = kill_sql
result = {'status': 1, 'msg': '暂时不支持%s类型数据库通过进程id构建请求' % instance.db_type , 'data': []}
return HttpResponse(json.dumps(result), content_type='application/json')
# 返回查询结果
return HttpResponse(json.dumps(result, cls=ExtendJSONEncoder, bigint_as_string=True),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面已经移除了simplejson,这个序列化包含bigint_as_string,是否会报错?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> from common.utils.extend_json_encoder import ExtendJSONEncoder, ExtendJSONEncoderBytes
>>> import json
>>> result={"a":11111111111111111111111111111111111111111111111111111111111}
>>> json.dumps(result, cls=ExtendJSONEncoder, bigint_as_string=True)
'{"a": "11111111111111111111111111111111111111111111111111111111111"}'

使用ExtendJSONEncoder这个类就没有问题

Copy link
Owner

@hhyo hhyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议把相关方法放到到对应的engine中,后续其他engine扩充可能会更方便
参考: #1402

Copy link
Owner

@hhyo hhyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql的要不也给统一挪到engine

@weideguo
Copy link
Collaborator Author

这样改动有点多,再单独开一个pr搞吧?

@hhyo hhyo merged commit d1ce601 into hhyo:master Jun 10, 2022
@hhyo
Copy link
Owner

hhyo commented Jun 11, 2022

看起来ci没过,case需要mock一下

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 this pull request may close these issues.

3 participants