Issue #1350: Fix ingestGrib and ingestDat posting of stats
Change-Id: I74154680ff6b4e8f5b5e4b2b3440e2b99a16b6df Former-commit-id:cffbf1da06
[formerly98297abdd0
] [formerlycffbf1da06
[formerly98297abdd0
] [formerly6c81be8499
[formerly e9afcf3d12599fc3bace2b140deb0d85ee303c6c]]] Former-commit-id:6c81be8499
Former-commit-id:7e93b3d90d
[formerly251cc3764d
] Former-commit-id:e139125e89
This commit is contained in:
parent
8c6ea90652
commit
38829d92c3
7 changed files with 36 additions and 32 deletions
|
@ -55,6 +55,8 @@ public class ProcessUtil {
|
||||||
protected static final IUFStatusHandler handler = UFStatus
|
protected static final IUFStatusHandler handler = UFStatus
|
||||||
.getNamedHandler("Ingest");
|
.getNamedHandler("Ingest");
|
||||||
|
|
||||||
|
protected static final EventBus eventBus = EventBus.getInstance();
|
||||||
|
|
||||||
protected transient final static ThreadLocal<DecimalFormat> FORMAT = new ThreadLocal<DecimalFormat>() {
|
protected transient final static ThreadLocal<DecimalFormat> FORMAT = new ThreadLocal<DecimalFormat>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -164,7 +166,7 @@ public class ProcessUtil {
|
||||||
// error occurred and statement logged incorrectly
|
// error occurred and statement logged incorrectly
|
||||||
if ((processEvent.getProcessingLatency() > 0)
|
if ((processEvent.getProcessingLatency() > 0)
|
||||||
&& (processEvent.getProcessingTime() > 0)) {
|
&& (processEvent.getProcessingTime() > 0)) {
|
||||||
EventBus.getInstance().publish(processEvent);
|
eventBus.publish(processEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we have something to log.
|
// Make sure we have something to log.
|
||||||
|
|
|
@ -5,11 +5,5 @@
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||||
|
|
||||||
<bean id="eventBusThreadCount" class="java.lang.String">
|
|
||||||
<constructor-arg type="java.lang.String" value="15" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="logHandler" class="com.raytheon.uf.edex.event.handler.LogHandler"/>
|
<bean id="logHandler" class="com.raytheon.uf.edex.event.handler.LogHandler"/>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Number of threads for async event bus
|
||||||
|
eventBusThreadCount=15
|
|
@ -6,7 +6,6 @@ import com.google.common.eventbus.AsyncEventBus;
|
||||||
import com.raytheon.uf.common.event.Event;
|
import com.raytheon.uf.common.event.Event;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -36,11 +35,11 @@ public class EventBus {
|
||||||
static {
|
static {
|
||||||
int threadCount = 15;
|
int threadCount = 15;
|
||||||
try {
|
try {
|
||||||
threadCount = Integer.parseInt((String) EDEXUtil
|
threadCount = Integer.parseInt(System.getProperty(
|
||||||
.getESBComponent("eventBusThreadCount"));
|
"eventBusThreadCount", "15"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler.error(
|
statusHandler
|
||||||
"Unable to set thread pool size from spring; defaulting size to "
|
.error("Unable to set thread pool size from property eventBusThreadCount; defaulting size to "
|
||||||
+ threadCount + ".", e);
|
+ threadCount + ".", e);
|
||||||
}
|
}
|
||||||
asyncEventBus = new AsyncEventBus("EventBus",
|
asyncEventBus = new AsyncEventBus("EventBus",
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.raytheon.uf.edex.registry.feature</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -16,6 +16,5 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="statsHandler"
|
<bean id="statsHandler"
|
||||||
class="com.raytheon.uf.edex.stats.handler.StatsHandler"
|
class="com.raytheon.uf.edex.stats.handler.StatsHandler"/>
|
||||||
depends-on="eventBusThreadCount"/>
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.edex.stats.handler;
|
package com.raytheon.uf.edex.stats.handler;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -36,6 +37,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||||
import com.raytheon.uf.edex.event.EventBus;
|
import com.raytheon.uf.edex.event.EventBus;
|
||||||
|
import com.raytheon.uf.edex.stats.util.ConfigLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribes to the event bus and stores them in the appropriate stats table
|
* Subscribes to the event bus and stores them in the appropriate stats table
|
||||||
|
@ -81,10 +83,33 @@ public class StatsHandler {
|
||||||
/**
|
/**
|
||||||
* Registers StatsHandler with the event bus
|
* Registers StatsHandler with the event bus
|
||||||
*/
|
*/
|
||||||
public StatsHandler() {
|
public StatsHandler() throws Exception {
|
||||||
|
loadEventValidTypes();
|
||||||
EventBus.getInstance().register(this);
|
EventBus.getInstance().register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the stats configuration to determine the events to track.
|
||||||
|
*
|
||||||
|
* TODO: Update ConfigLoader to be instance and have file time checking to
|
||||||
|
* know if config needs to be reloaded.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected void loadEventValidTypes() throws Exception {
|
||||||
|
ConfigLoader configLoader = new ConfigLoader();
|
||||||
|
configLoader.load();
|
||||||
|
HashSet<String> myValidEventTypes = new HashSet<String>();
|
||||||
|
|
||||||
|
for (StatisticsConfig config : configLoader.getConfigurations()) {
|
||||||
|
for (StatisticsEvent event : config.getEvents()) {
|
||||||
|
myValidEventTypes.add(event.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validEventTypes = Collections.unmodifiableSet(myValidEventTypes);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@AllowConcurrentEvents
|
@AllowConcurrentEvents
|
||||||
public void eventListener(Event event) {
|
public void eventListener(Event event) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue