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

add StatsService.GetSysStats #1794

Merged
merged 2 commits into from
Jul 14, 2019
Merged

add StatsService.GetSysStats #1794

merged 2 commits into from
Jul 14, 2019

Conversation

vcptr
Copy link
Contributor

@vcptr vcptr commented Jul 8, 2019

  1. add StatsService.GetSysStats call to v2ctl to retrieve core running data, example:
$ /usr/bin/v2ray/v2ctl api --server=127.0.0.1:10085 StatsService.GetSysStats ''
NumGoroutine: 16
NumGC: 5
Alloc: 717048
TotalAlloc: 5185696
Sys: 71762168
Mallocs: 55768
Frees: 48457
LiveObjects: 7311
PauseTotalNs: 706772
Uptime: 589
  1. fixed bug running command v2ctl api without arguments, hangs forever with no output/error.

@kslr kslr requested a review from xiaokangwang July 8, 2019 06:23
Copy link
Contributor

@xiaokangwang xiaokangwang left a comment

Choose a reason for hiding this comment

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

I think this pull request is ready to be merged.

@xiaokangwang
Copy link
Contributor

This pull request have added a 3 second timeout to grpc request in v2ctl. I believe this behavior should be reflected in document to prevent confusion in the future.

@vcptr
Copy link
Contributor Author

vcptr commented Jul 10, 2019

Actually the previous behavior is more confusing, grpc dial have a infinite timeout, the command just hangs forever.

@xiaokangwang
Copy link
Contributor

Yes, however, we can't assume all commands can be completed in 3 seconds.

@vcptr
Copy link
Contributor Author

vcptr commented Jul 13, 2019

I think we can.

Any cli command does not response in a human bearable time and tells what happened, is bad design.

A three seconds waiting is suitable in this situation.

@xiaokangwang
Copy link
Contributor

Currently, this is the case, but I think this change should be documented nonetheless.

@vcptr
Copy link
Contributor Author

vcptr commented Jul 14, 2019

a notice line added, heres the help text:

$ ./v2ctl api --help
Usage of api:
  -server string
        Server address (default "127.0.0.1:8080")
v2ctl api [--server=127.0.0.1:8080] Service.Method Request
Call an API in an V2Ray process.
The following methods are currently supported:
        LoggerService.RestartLogger
        StatsService.GetStats
        StatsService.QueryStats
API calls in this command have a timeout to the server of 3 seconds.
Examples:
v2ctl api --server=127.0.0.1:8080 LoggerService.RestartLogger '' 
v2ctl api --server=127.0.0.1:8080 StatsService.QueryStats 'pattern: "" reset: false'
v2ctl api --server=127.0.0.1:8080 StatsService.GetStats 'name: "inbound>>>statin>>>traffic>>>downlink" reset: false'
v2ctl api --server=127.0.0.1:8080 StatsService.GetSysStats ''

@xiaokangwang
Copy link
Contributor

I believe this pull request is ready to be merged.

@xiaokangwang xiaokangwang merged commit 54c7483 into v2ray:master Jul 14, 2019
@vcptr vcptr deleted the sysstat branch August 9, 2019 07:13
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.

None yet

2 participants