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

resource usage endpoint #1570

Merged
merged 35 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0095ddd
correctly convert bytes to mb
matush-v Jun 15, 2017
d4c932e
cluster utilization endpoint
matush-v Jun 19, 2017
086ba78
keep a larger duration of task usages
matush-v Jun 20, 2017
be11810
memRssBytes -> memTotalBytes
matush-v Jun 20, 2017
dc9ba52
fallback to deleting the oldest usage
matush-v Jun 20, 2017
8ac2c5a
simplify
matush-v Jun 20, 2017
ad61dcb
move clusterUtilization into SingularityClusterUtilization
matush-v Jun 20, 2017
e15bbf4
test task usage clearing
matush-v Jun 20, 2017
f7fc273
don't serialize averages
matush-v Jun 22, 2017
358a352
rename
matush-v Jun 22, 2017
4dbba4c
add tests and adjust logic
matush-v Jun 22, 2017
6c9e32c
fix tests
matush-v Jun 22, 2017
49b1357
remove usage filtering
matush-v Jun 22, 2017
fb04415
fix tests
matush-v Jun 23, 2017
5df329a
simplify method
matush-v Jun 23, 2017
af8e45a
Merge branch 'master' into use-it-or-lose-it
matush-v Jun 23, 2017
a45d59d
switch avg bytes to long
matush-v Jun 23, 2017
eb97445
track cpus properly
matush-v Jun 23, 2017
c3d5c47
use copied list
matush-v Jun 23, 2017
5995260
calculate cpu usage from oldest usage
matush-v Jun 24, 2017
11a0ed6
track requestIds associated with max utilizations
matush-v Jun 25, 2017
6f994b0
make fields private
matush-v Jun 25, 2017
98d5d38
sad
matush-v Jun 25, 2017
3234d43
track resources reserved in requestUtilization
matush-v Jun 27, 2017
afc0d92
correctly count resources reserved for requests with multiple tasks
matush-v Jun 28, 2017
4620878
Merge branch 'master' into use-it-or-lose-it
matush-v Jun 28, 2017
ce8cd1b
merge issues
matush-v Jun 28, 2017
5dc6b5c
merge conflicts
matush-v Jun 28, 2017
6f598b7
track max and min per request
matush-v Jul 10, 2017
0e3c306
use seconds consistently, update and simplfy tests
matush-v Jul 11, 2017
ff70d5e
use correct json property
matush-v Jul 11, 2017
1a14d3d
keep 1 day of usage data
matush-v Jul 11, 2017
77de0c1
get max and min from available history
matush-v Jul 11, 2017
b9faf54
typo
matush-v Jul 11, 2017
e748cca
clear usage based on path
matush-v Jul 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class MesosTaskStatisticsObject {
private final long memLimitBytes;
private final long memMappedFileBytes;
private final long memRssBytes;
private final double timestamp;
private final long memTotalBytes;
private final double timestampSeconds;

@JsonCreator
public MesosTaskStatisticsObject(@JsonProperty("cpus_limit") int cpusLimit,
Expand All @@ -29,7 +30,8 @@ public MesosTaskStatisticsObject(@JsonProperty("cpus_limit") int cpusLimit,
@JsonProperty("mem_limit_bytes") long memLimitBytes,
@JsonProperty("mem_mapped_file_bytes") long memMappedFileBytes,
@JsonProperty("mem_rss_bytes") long memRssBytes,
@JsonProperty("timestamp") double timestamp) {
@JsonProperty("mem_total_bytes") long memTotalBytes,
@JsonProperty("timestamp") double timestampSeconds) {
this.cpusLimit = cpusLimit;
this.cpusNrPeriods = cpusNrPeriods;
this.cpusNrThrottled = cpusNrThrottled;
Expand All @@ -41,7 +43,8 @@ public MesosTaskStatisticsObject(@JsonProperty("cpus_limit") int cpusLimit,
this.memLimitBytes = memLimitBytes;
this.memMappedFileBytes = memMappedFileBytes;
this.memRssBytes = memRssBytes;
this.timestamp = timestamp;
this.memTotalBytes = memTotalBytes;
this.timestampSeconds = timestampSeconds;
}

public int getCpusLimit() {
Expand Down Expand Up @@ -88,8 +91,12 @@ public long getMemRssBytes() {
return memRssBytes;
}

public double getTimestamp() {
return timestamp;
public long getMemTotalBytes() {
return memTotalBytes;
}

public double getTimestampSeconds() {
return timestampSeconds;
}

@Override
Expand All @@ -106,7 +113,8 @@ public String toString() {
", memLimitBytes=" + memLimitBytes +
", memMappedFileBytes=" + memMappedFileBytes +
", memRssBytes=" + memRssBytes +
", timestamp=" + timestamp +
", memTotalBytes=" + memTotalBytes +
", timestampSeconds=" + timestampSeconds +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.hubspot.singularity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

public class RequestUtilization {
private final String requestId;
private final String deployId;

private long memBytesUsed = 0;
private long memBytesReserved = 0;
private double cpuUsed = 0;
private double cpuReserved = 0;
private int numTasks = 0;

private long maxMemBytesUsed = 0;
private long minMemBytesUsed = Long.MAX_VALUE;
private double maxCpuUsed = 0;
private double minCpuUsed = Double.MAX_VALUE;

@JsonCreator
public RequestUtilization(@JsonProperty("requestId") String requestId,
@JsonProperty("deployId") String deployId) {
this.requestId = requestId;
this.deployId = deployId;
}

public RequestUtilization addMemBytesUsed(long memBytes) {
this.memBytesUsed += memBytes;
return this;
}

public RequestUtilization addMemBytesReserved(long memBytes) {
this.memBytesReserved += memBytes;
return this;
}

public RequestUtilization addCpuUsed(double cpu) {
this.cpuUsed += cpu;
return this;
}

public RequestUtilization addCpuReserved(double cpu) {
this.cpuReserved += cpu;
return this;
}

public RequestUtilization incrementTaskCount() {
this.numTasks++;
return this;
}

public long getMemBytesUsed() {
return memBytesUsed;
}

public long getMemBytesReserved() {
return memBytesReserved;
}

public double getCpuUsed() {
return cpuUsed;
}

public double getCpuReserved() {
return cpuReserved;
}

public int getNumTasks() {
return numTasks;
}

@JsonIgnore
public double getAvgMemBytesUsed() {
return memBytesUsed / (double) numTasks;
}

@JsonIgnore
public double getAvgCpuUsed() {
return cpuUsed / (double) numTasks;
}

public String getDeployId() {
return deployId;
}

public String getRequestId() {
return requestId;
}

public long getMaxMemBytesUsed() {
return maxMemBytesUsed;
}

public RequestUtilization setMaxMemBytesUsed(long maxMemBytesUsed) {
this.maxMemBytesUsed = maxMemBytesUsed;
return this;
}

public double getMaxCpuUsed() {
return maxCpuUsed;
}

public RequestUtilization setMaxCpuUsed(double maxCpuUsed) {
this.maxCpuUsed = maxCpuUsed;
return this;
}

public long getMinMemBytesUsed() {
return minMemBytesUsed;
}

public RequestUtilization setMinMemBytesUsed(long minMemBytesUsed) {
this.minMemBytesUsed = minMemBytesUsed;
return this;
}

public double getMinCpuUsed() {
return minCpuUsed;
}

public RequestUtilization setMinCpuUsed(double minCpuUsed) {
this.minCpuUsed = minCpuUsed;
return this;
}

@Override
public String toString() {
return "RequestUtilization{" +
"requestId=" + requestId +
", deployId=" + deployId +
", memBytesUsed=" + memBytesUsed +
", memBytesReserved=" + memBytesReserved +
", cpuUsed=" + cpuUsed +
", cpuReserved=" + cpuReserved +
", numTasks=" + numTasks +
'}';
}
}
Loading