Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Add aggregated read/write queue size metric
Browse files Browse the repository at this point in the history
Summary: Reduce metric cardinality

Reviewers: psu, jbull, fcuny, drusek, sijieg, mpatidar, lstewart

Reviewed By: sijieg

Subscribers: #rb_ds-messaging

JIRA Issues: PUBSUB-18945

Differential Revision: https://phabricator.twitter.biz/D18693
  • Loading branch information
Yiming Zang authored and Sijie Guo committed Mar 17, 2017
1 parent 279933b commit 91c85ab
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ public Number getSample() {
});
}
// stats
statsLogger.registerGauge(String.format("%s-total-queue", name), new Gauge<Number>() {
@Override
public Number getDefaultValue() {
return 0;
}

@Override
public Number getSample() {
int totalSize = 0;
for (BlockingQueue<Runnable> queue : queues) {
totalSize += queue.size();
}
return totalSize;
}
});
this.taskExecutionStats = statsLogger.scope(name).getOpStatsLogger("task_execution");
this.taskPendingStats = statsLogger.scope(name).getOpStatsLogger("task_queued");
this.traceTaskExecution = traceTaskExecution;
Expand Down

0 comments on commit 91c85ab

Please sign in to comment.