Skip to content

Commit

Permalink
Fix 'genie.user.active-memory.gauge' metric to publish amounts of mem…
Browse files Browse the repository at this point in the history
…ory used

Previously, the metric was publishing the memory amount requested, which can be null.
The metric now publishes amount of memory used.
  • Loading branch information
mprimi committed Apr 16, 2019
1 parent 15fe590 commit faef67e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -105,7 +105,7 @@ Set<UserJobAmountAggregateProjection> getUsersJobCount(
* @param statuses the job statuses to filter by
* @return a set of {@link UserJobAmountAggregateProjection}
*/
@Query("SELECT j.user, SUM(j.memoryRequested) FROM JobEntity j WHERE j.status IN (:statuses) GROUP BY j.user")
@Query("SELECT j.user, SUM(j.memoryUsed) FROM JobEntity j WHERE j.status IN (:statuses) GROUP BY j.user")
Set<UserJobAmountAggregateProjection> getUsersJobsTotalMemory(
@Param("statuses") @NotEmpty final Set<JobStatus> statuses
);
Expand Down
Expand Up @@ -471,8 +471,8 @@ public void canGetActiveJobCountsPerUser() throws GenieException {
*/
@Test
public void canGetActiveJobMemoryPerUser() throws GenieException {
final List<UserMemoryAmount> jobCounts = this.service.getActiveJobMemoryPerUser();
Assert.assertThat(jobCounts.size(), Matchers.is(1));
Assert.assertThat(jobCounts.get(0), Matchers.equalTo(new UserMemoryAmount("tgianos", 4096)));
final List<UserMemoryAmount> memoyAmounts = this.service.getActiveJobMemoryPerUser();
Assert.assertThat(memoyAmounts.size(), Matchers.is(1));
Assert.assertThat(memoyAmounts.get(0), Matchers.equalTo(new UserMemoryAmount("tgianos", 4096)));
}
}
Expand Up @@ -399,6 +399,7 @@
command_criterion="0"
cpu_requested="1"
memory_requested="1560"
memory_used="1560"
disable_log_archival="true"
timeout_requested="608400"
num_attachments="2"
Expand Down Expand Up @@ -489,6 +490,7 @@
command_criterion="3"
cpu_requested="2"
memory_requested="2048"
memory_used="2048"
disable_log_archival="false"
timeout_requested="608400"
num_attachments="3"
Expand Down Expand Up @@ -569,6 +571,7 @@
command_criterion="6"
cpu_requested="2"
memory_requested="2048"
memory_used="2048"
disable_log_archival="true"
timeout_requested="608400"
num_attachments="1"
Expand Down

0 comments on commit faef67e

Please sign in to comment.