8000 Add command for task metrics by philipnrmn · Pull Request #923 · dcos/dcos-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add command for task metrics #923

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

Merged
merged 14 commits into from
Mar 28, 2017
Merged

Conversation

philipnrmn
Copy link
Contributor
@philipnrmn philipnrmn commented Mar 4, 2017

This PR adds the dcos task metrics command.

Components:

Example usage:

$ dcos task metrics details app-name.abc123-456789
NAME                       VALUE        
cpus.user.time             0.14         
cpus.system.time           0.21         
cpus.limit                 0.10         
cpus.throttled.time        471.89       
mem.total                  0.01GiB      
mem.limit                  0.16GiB      
disk.limit                 0.00GiB      
disk.used                  0.00GiB      
net.rx.packets             0            
net.rx.bytes               0.00GiB      
net.rx.errors              0            
net.rx.dropped             0            
net.tx.packets             0            
net.tx.bytes               0.00GiB      
net.tx.errors              0            
net.tx.dropped             0            
statsd_tester.time.uptime  11632203.00
$ dcos task metrics details app-name.abc123-456789 --json
[
  {
    "name": "cpus.user.time",
    "tags": {...},
    "timestamp": "2017-03-15T21:01:46.188487097Z",
    "unit": "seconds",
    "value": 0.14
  },
  ...
  {
    "name": "statsd_tester.time.uptime",
    "timestamp": "2017-03-15T21:02:40Z",
    "unit": "",
    "value": 11672303.0
  }
]
$ dcos task metrics summary app-name.abc123-456789
CPU           MEM              DISK             
0.35 (0.07%)  0.01GiB (5.41%)  0.00GiB (0.00%)  
$ dcos task metrics summary app-name.abc123-456789 --json
[
  {
    "timestamp": "2017-03-15T21:03:46.221983351Z",
    "unit": "seconds",
    "value": 0.14,
    "name": "cpus.user.time",
    "tags": {...}
 
8000
 },
  {
    "timestamp": "2017-03-15T21:03:46.221983351Z",
    "unit": "bytes",
    "value": 9080832,
    "name": "mem.total",
    "tags": {...}
  },
  {
    "timestamp": "2017-03-15T21:03:46.221983351Z",
    "unit": "bytes",
    "value": 0,
    "name": "disk.used",
    "tags": {...}
  }
]

@tamarrow-zz tamarrow-zz added the wip label Mar 6, 2017
@philipnrmn philipnrmn force-pushed the task-metrics branch 2 times, most recently from 62f5e9e to e24d82a Compare March 15, 2017 21:01
@philipnrmn
Copy link
Contributor Author

@tamarrow and @malnick, may I have a review when you get a moment?

@tamarrow-zz tamarrow-zz removed the wip label Mar 16, 2017
"""

master = mesos.get_master()
slave_id = master.task(task_id)['slave_id']
Copy link
Contributor

Choose a reason for hiding this comment

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

what if there are no slaves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a guard for this, but I don't think a Mesos task object can ever not have a slave_id field.

@tamarrow-zz
Copy link
Contributor

Looks great. Is there a structure to the tags or can they be anything?

@malnick
Copy link
malnick commented Mar 16, 2017

Tags are arbitrary stringified key, value pairs.

@philipnrmn philipnrmn force-pushed the task-metrics branch 2 times, most recently from 1d5b4d2 to cdcbf82 Compare March 16, 2017 20:28
@philipnrmn philipnrmn force-pushed the task-metrics branch 2 times, most recently from be34148 to ee237b8 Compare March 27, 2017 22:36
The task metrics collector runs every minute, meaning that it did not
reliably provide data to the integration tests. This could be fixed by
adding a force-collection endpoint to tasks, but in the meantime these
tests have been replaced with unit test.
@tamarrow-zz tamarrow-zz merged commit 8971ccd into dcos:master Mar 28, 2017
@philipnrmn philipnrmn deleted the task-metrics branch March 28, 2017 20:49
klueska pushed a commit that referenced this pull request Jul 20, 2017
klueska pushed a commit that referenced this pull request Jul 20, 2017
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
0