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

修改debug api,完善部分系统信息 #396

Merged
merged 3 commits into from
Aug 25, 2019
Merged

Conversation

hhyo
Copy link
Owner

@hhyo hhyo commented Aug 24, 2019

相关PR:#385

补全inception、django_q、运行环境、系统配置、依赖包信息,最终结构如下

访问地址:http://139.199.0.191/api/info
http://139.199.0.191/api/debug?full=true

system_info = {
        'archery': {
            'version': archery.display_version
        },
        'inception': {
            'enable_goinception': sys_config.get('go_inception'),
            'inception_info': inception_info,
            'goinception_info': goinception_info,
            'backup_info': backup_info
        },
        'runtime_info': {
            'python_version': platform.python_build(),
            'mysql_info': mysql_info,
            'redis_info': redis_info,
            'sys_argv': sys.argv,
            'platform': platform.uname()
        },
        'sys_config': sys_config,
        'packages': installed_packages_list
    }

@hhyo hhyo requested a review from LeoQuote August 24, 2019 16:58
@codecov
Copy link

codecov bot commented Aug 24, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@1b1b1e5). Click here to learn what that means.
The diff coverage is 70.68%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #396   +/-   ##
=========================================
  Coverage          ?   84.91%           
=========================================
  Files             ?       70           
  Lines             ?     9075           
  Branches          ?        0           
=========================================
  Hits              ?     7706           
  Misses            ?     1369           
  Partials          ?        0
Impacted Files Coverage Δ
sql_api/views.py 72.58% <70.68%> (ø)

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 1b1b1e5...71c59b8. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 24, 2019

Codecov Report

Merging #396 into master will decrease coverage by 0.11%.
The diff coverage is 72.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #396      +/-   ##
==========================================
- Coverage   85.01%   84.89%   -0.12%     
==========================================
  Files          70       70              
  Lines        9020     9102      +82     
==========================================
+ Hits         7668     7727      +59     
- Misses       1352     1375      +23
Impacted Files Coverage Δ
sql_api/urls.py 100% <ø> (ø) ⬆️
sql_api/tests.py 100% <100%> (ø) ⬆️
sql_api/views.py 72.94% <70.88%> (-27.06%) ⬇️

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 4504c03...2916634. Read the comment docs.

Copy link
Collaborator

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

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

那你这个info,可能要管理员权限了,不然登录用户就能看到这个也是不太好。

或者info可以普通用户看到,就是一些静态信息,渲染也很快。

debug只有管理员可以看到,可能要取一些资源。

django Q有些api可以拿状态,但是感觉不好调试,我在Windows上就老出问题,蛋疼

@hhyo
Copy link
Owner Author

hhyo commented Aug 25, 2019

感觉这个接口就是给管理员排查问题用,普通用户也没必要看这些,是不是限制管理员访问更合理,虽然里面把密码连接信息都隐藏了,还有现在问题是sysconfig和packages信息比较多,不确定全都是有效信息

@hhyo hhyo added this to In Progress in 需求汇总 Aug 25, 2019
@LeoQuote
Copy link
Collaborator

嗯管理员权限好

或者看一下我上面的评论,debug多一点,info少一点

@LeoQuote
Copy link
Collaborator

管他有效没效都先写到debug里😂

也可以考虑输出yaml?yaml人和机器都能读

@hhyo
Copy link
Owner Author

hhyo commented Aug 25, 2019

咋输出yaml,没用过,你有时间的话可以按你的想法调整下,或者等下版也行,准备这个合了发一版

@LeoQuote
Copy link
Collaborator

那你把管理员权限加上,普通用户有权限看到这个不合适

@hhyo hhyo force-pushed the feat/update-info-debug-api branch from fa53f95 to 2916634 Compare August 25, 2019 06:44
@hhyo
Copy link
Owner Author

hhyo commented Aug 25, 2019

增加了django_q的信息,分为debug和info,

'django_q': {
            'version': django_q_version,
            'conf': django_q.conf.Conf.conf,
            'q_cluster_stats': q_cluster_stats,
            'q_broker_stats': q_broker_stats
        },

@hhyo hhyo merged commit 7f1f359 into master Aug 25, 2019
需求汇总 automation moved this from In Progress to Done Aug 25, 2019
@hhyo hhyo deleted the feat/update-info-debug-api branch August 31, 2019 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
需求汇总
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants