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 committed Jan 24, 2017
1 parent f3226c6 commit ab16e73
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 ab16e73

Please sign in to comment.