Search in sources :

Example 11 with DtpProperties

use of com.dtp.common.config.DtpProperties in project dynamic-tp by lyh200.

the class DtpWebCollectListener method onApplicationEvent.

@Override
public void onApplicationEvent(CollectEvent event) {
    DtpProperties dtpProperties = event.getDtpProperties();
    if (!dtpProperties.isEnabledCollect()) {
        return;
    }
    try {
        WebServerTpHandler webServerTpHandler = ApplicationContextHolder.getBean(WebServerTpHandler.class);
        ThreadPoolStats poolStats = webServerTpHandler.getPoolStats();
        if (poolStats == null) {
            return;
        }
        CollectorHandler.getInstance().collect(poolStats, dtpProperties.getCollectorType());
    } catch (Exception e) {
        log.error("DynamicTp monitor, collect web server thread pool metrics failed.", e);
    }
}
Also used : ThreadPoolStats(com.dtp.common.dto.ThreadPoolStats) DtpProperties(com.dtp.common.config.DtpProperties) WebServerTpHandler(com.dtp.adapter.web.handler.WebServerTpHandler)

Aggregations

DtpProperties (com.dtp.common.config.DtpProperties)11 NotifyItem (com.dtp.common.dto.NotifyItem)2 DtpContext (com.dtp.core.context.DtpContext)2 Slf4j (lombok.extern.slf4j.Slf4j)2 lombok.val (lombok.val)2 CuratorFramework (org.apache.curator.framework.CuratorFramework)2 ConnectionState (org.apache.curator.framework.state.ConnectionState)2 ConnectionStateListener (org.apache.curator.framework.state.ConnectionStateListener)2 WebServerTpHandler (com.dtp.adapter.web.handler.WebServerTpHandler)1 AlarmInfo (com.dtp.common.dto.AlarmInfo)1 ThreadPoolStats (com.dtp.common.dto.ThreadPoolStats)1 JSON (com.dtp.common.em.ConfigFileTypeEnum.JSON)1 PROPERTIES (com.dtp.common.em.ConfigFileTypeEnum.PROPERTIES)1 ConfigHandler (com.dtp.core.handler.ConfigHandler)1 AbstractRefresher (com.dtp.core.refresh.AbstractRefresher)1 ZK_PROPERTY_SOURCE_NAME (com.dtp.starter.zookeeper.autoconfigure.ZkConfigEnvironmentProcessor.ZK_PROPERTY_SOURCE_NAME)1 CuratorUtil (com.dtp.starter.zookeeper.util.CuratorUtil)1 Maps (com.google.common.collect.Maps)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Collections (java.util.Collections)1