WorkQueue.Executor#buildMetrics: Remove MetricMaker parameter

It's not necessary to pass a MetricMaker; the member variable
can be used.

Change-Id: I466ac5e9a6d18d14f91d6bb81448755b1dfdf7fc
This commit is contained in:
David Pursehouse
2018-05-18 19:58:48 +09:00
parent 65a1ae50eb
commit fe270ddd54

View File

@@ -208,7 +208,7 @@ public class WorkQueue {
); );
queueName = prefix; queueName = prefix;
try { try {
buildMetrics(queueName, metrics); buildMetrics(queueName);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
if (e.getMessage().contains("already")) { if (e.getMessage().contains("already")) {
log.warn("Not creating metrics for queue '{}': already exists", queueName); log.warn("Not creating metrics for queue '{}': already exists", queueName);
@@ -218,8 +218,8 @@ public class WorkQueue {
} }
} }
private void buildMetrics(String queueName, MetricMaker metric) { private void buildMetrics(String queueName) {
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "max_pool_size"), getMetricName(queueName, "max_pool_size"),
Long.class, Long.class,
new Description("Maximum allowed number of threads in the pool") new Description("Maximum allowed number of threads in the pool")
@@ -231,7 +231,7 @@ public class WorkQueue {
return (long) getMaximumPoolSize(); return (long) getMaximumPoolSize();
} }
}); });
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "pool_size"), getMetricName(queueName, "pool_size"),
Long.class, Long.class,
new Description("Current number of threads in the pool").setGauge().setUnit("threads"), new Description("Current number of threads in the pool").setGauge().setUnit("threads"),
@@ -241,7 +241,7 @@ public class WorkQueue {
return (long) getPoolSize(); return (long) getPoolSize();
} }
}); });
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "active_threads"), getMetricName(queueName, "active_threads"),
Long.class, Long.class,
new Description("Number number of threads that are actively executing tasks") new Description("Number number of threads that are actively executing tasks")
@@ -253,7 +253,7 @@ public class WorkQueue {
return (long) getActiveCount(); return (long) getActiveCount();
} }
}); });
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "scheduled_tasks"), getMetricName(queueName, "scheduled_tasks"),
Integer.class, Integer.class,
new Description("Number of scheduled tasks in the queue").setGauge().setUnit("tasks"), new Description("Number of scheduled tasks in the queue").setGauge().setUnit("tasks"),
@@ -263,7 +263,7 @@ public class WorkQueue {
return getQueue().size(); return getQueue().size();
} }
}); });
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "total_scheduled_tasks_count"), getMetricName(queueName, "total_scheduled_tasks_count"),
Long.class, Long.class,
new Description("Total number of tasks that have been scheduled for execution") new Description("Total number of tasks that have been scheduled for execution")
@@ -275,7 +275,7 @@ public class WorkQueue {
return (long) getTaskCount(); return (long) getTaskCount();
} }
}); });
metric.newCallbackMetric( metrics.newCallbackMetric(
getMetricName(queueName, "total_completed_tasks_count"), getMetricName(queueName, "total_completed_tasks_count"),
Long.class, Long.class,
new Description("Total number of tasks that have completed execution") new Description("Total number of tasks that have completed execution")