mirror of https://github.com/apache/druid.git
Make JvmThreadsMonitor injectable (#6369)
This commit is contained in:
parent
99428e20d2
commit
d08c2c5eba
|
@ -35,10 +35,15 @@ public class JvmThreadsMonitor extends FeedDefiningMonitor
|
|||
private int lastLiveThreads = 0;
|
||||
private long lastStartedThreads = 0;
|
||||
|
||||
public JvmThreadsMonitor(Map<String, String[]> dimensions)
|
||||
{
|
||||
this(dimensions, DEFAULT_METRICS_FEED);
|
||||
}
|
||||
|
||||
public JvmThreadsMonitor(Map<String, String[]> dimensions, String feed)
|
||||
{
|
||||
super(feed);
|
||||
Preconditions.checkNotNull(dimensions);
|
||||
Preconditions.checkNotNull(dimensions, "dimensions");
|
||||
this.dimensions = ImmutableMap.copyOf(dimensions);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.google.inject.name.Names;
|
|||
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
|
||||
import org.apache.druid.java.util.metrics.JvmCpuMonitor;
|
||||
import org.apache.druid.java.util.metrics.JvmMonitor;
|
||||
import org.apache.druid.java.util.metrics.JvmThreadsMonitor;
|
||||
import org.apache.druid.java.util.metrics.Monitor;
|
||||
import org.apache.druid.java.util.metrics.MonitorScheduler;
|
||||
import org.apache.druid.java.util.metrics.SysMonitor;
|
||||
|
@ -129,6 +130,18 @@ public class MetricsModule implements Module
|
|||
));
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ManageLifecycle
|
||||
public JvmThreadsMonitor getJvmThreadsMonitor(DataSourceTaskIdHolder dataSourceTaskIdHolder)
|
||||
{
|
||||
return new JvmThreadsMonitor(
|
||||
MonitorsConfig.mapOfDatasourceAndTaskID(
|
||||
dataSourceTaskIdHolder.getDataSource(),
|
||||
dataSourceTaskIdHolder.getTaskId()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ManageLifecycle
|
||||
public SysMonitor getSysMonitor(
|
||||
|
|
Loading…
Reference in New Issue