提交 ebde02c5 编写于 作者: Y youyong205

fix the heartbeat bug

上级 205dbbc3
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.status.model" enable-sax-parser="true" enable-xml-schema="true"
enable-merger="true" enable-model-test="true" enable-base-visitor="true">
<entity name="status" class-name="StatusInfo" dynamic-attributes="true">
<entity name="status" class-name="StatusInfo">
<attribute name="timestamp" value-type="Date" format="yyyy-MM-dd HH:mm:ss.SSS" />
<entity-ref name="runtime" />
<entity-ref name="os" />
......@@ -61,7 +61,7 @@
<attribute name="overflowed" value-type="long" primitive="true" />
<attribute name="bytes" value-type="long" primitive="true" />
</entity>
<entity name="extension">
<entity name="extension" dynamic-attributes="true">
<attribute name="id" value-type="String" key="true"/>
<element name="description" value-type="String" escape="false"/>
<entity-ref name="extensionDetail" names ="details" type="map" method-find-or-create="true"/>
......
package com.dianping.cat.consumer.heartbeat;
import java.io.File;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
......@@ -7,6 +8,7 @@ import java.util.Map.Entry;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.unidal.helper.Files;
import org.unidal.lookup.annotation.Inject;
import com.dianping.cat.Cat;
......@@ -120,16 +122,18 @@ public class HeartbeatAnalyzer extends AbstractMessageAnalyzer<HeartbeatReport>
disk.findOrCreateExtensionDetail(vinfo.getId() + " Free").setValue(vinfo.getFree());
}
}
Map<String, String> propertis = info.getDynamicAttributes();
for (Entry<String, String> entry : propertis.entrySet()) {
try {
double value = Double.parseDouble(entry.getValue());
Extension item = info.findOrCreateExtension("dal");
for (Extension ex : info.getExtensions().values()) {
Map<String, String> propertis = ex.getDynamicAttributes();
for (Entry<String, String> entry : propertis.entrySet()) {
try {
double value = Double.parseDouble(entry.getValue());
Extension item = info.findOrCreateExtension("dal");
item.findOrCreateExtensionDetail(entry.getKey()).setValue(value);
} catch (Exception e) {
Cat.logError("StatusExtension can only be double type", e);
item.findOrCreateExtensionDetail(entry.getKey()).setValue(value);
} catch (Exception e) {
Cat.logError("StatusExtension can only be double type", e);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册