Trace dag ui with h2 storage provider test success.
This commit is contained in:
parent
779638bea0
commit
bc4f1830eb
|
|
@ -19,6 +19,7 @@
|
|||
package org.skywalking.apm.collector.storage.h2.dao;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.skywalking.apm.collector.client.h2.H2Client;
|
||||
|
|
@ -27,7 +28,6 @@ import org.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
|||
import org.skywalking.apm.collector.storage.dao.INodeComponentUIDAO;
|
||||
import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.skywalking.apm.collector.storage.table.node.NodeComponentTable;
|
||||
import org.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class NodeComponentH2UIDAO extends H2DAO implements INodeComponentUIDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NodeComponentH2UIDAO.class);
|
||||
private static final String AGGREGATE_COMPONENT_SQL = "select {0}, {1}, {2} from {3} where {4} >= ? and {4} <= ? group by {0}, {1}, {2} limit 100";
|
||||
private static final String AGGREGATE_COMPONENT_SQL = "select {0}, {1} from {2} where {3} >= ? and {3} <= ? group by {0}, {1} limit 100";
|
||||
|
||||
public NodeComponentH2UIDAO(H2Client client) {
|
||||
super(client);
|
||||
|
|
@ -53,19 +53,17 @@ public class NodeComponentH2UIDAO extends H2DAO implements INodeComponentUIDAO {
|
|||
H2Client client = getClient();
|
||||
|
||||
JsonArray nodeComponentArray = new JsonArray();
|
||||
String sql = SqlBuilder.buildSql(AGGREGATE_COMPONENT_SQL, NodeComponentTable.COLUMN_COMPONENT_ID,
|
||||
String sql = SqlBuilder.buildSql(AGGREGATE_COMPONENT_SQL, NodeComponentTable.COLUMN_COMPONENT_ID, NodeComponentTable.COLUMN_PEER_ID,
|
||||
NodeComponentTable.TABLE, NodeComponentTable.COLUMN_TIME_BUCKET);
|
||||
Object[] params = new Object[] {startTime, endTime};
|
||||
try (ResultSet rs = client.executeQuery(sql, params)) {
|
||||
while (rs.next()) {
|
||||
int peerId = rs.getInt(NodeComponentTable.COLUMN_PEER_ID);
|
||||
int componentId = rs.getInt(NodeComponentTable.COLUMN_COMPONENT_ID);
|
||||
String componentName = ComponentsDefine.getInstance().getComponentName(componentId);
|
||||
if (peerId != 0) {
|
||||
//TODO ApplicationCache
|
||||
// String peer = ApplicationCache.get(peerId);
|
||||
// nodeComponentArray.add(buildNodeComponent(peer, componentName));
|
||||
}
|
||||
JsonObject nodeComponentObj = new JsonObject();
|
||||
nodeComponentObj.addProperty(NodeComponentTable.COLUMN_COMPONENT_ID, componentId);
|
||||
nodeComponentObj.addProperty(NodeComponentTable.COLUMN_PEER_ID, peerId);
|
||||
nodeComponentArray.add(nodeComponentObj);
|
||||
}
|
||||
} catch (SQLException | H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class NodeMappingH2UIDAO extends H2DAO implements INodeMappingUIDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NodeMappingH2UIDAO.class);
|
||||
private static final String NODE_MAPPING_SQL = "select {0}, {1}, {2} from {3} where {4} >= ? and {4} <= ? group by {0}, {1}, {2} limit 100";
|
||||
private static final String NODE_MAPPING_SQL = "select {0}, {1} from {2} where {3} >= ? and {3} <= ? group by {0}, {1} limit 100";
|
||||
|
||||
public NodeMappingH2UIDAO(H2Client client) {
|
||||
super(client);
|
||||
|
|
@ -53,13 +53,10 @@ public class NodeMappingH2UIDAO extends H2DAO implements INodeMappingUIDAO {
|
|||
try (ResultSet rs = client.executeQuery(sql, params)) {
|
||||
while (rs.next()) {
|
||||
int applicationId = rs.getInt(NodeMappingTable.COLUMN_APPLICATION_ID);
|
||||
//TODO ApplicationCache
|
||||
// String applicationCode = ApplicationCache.get(applicationId);
|
||||
int addressId = rs.getInt(NodeMappingTable.COLUMN_ADDRESS_ID);
|
||||
// String address = ApplicationCache.get(addressId);
|
||||
JsonObject nodeMappingObj = new JsonObject();
|
||||
// nodeMappingObj.addProperty("applicationCode", applicationCode);
|
||||
// nodeMappingObj.addProperty("address", address);
|
||||
nodeMappingObj.addProperty(NodeMappingTable.COLUMN_APPLICATION_ID, applicationId);
|
||||
nodeMappingObj.addProperty(NodeMappingTable.COLUMN_ADDRESS_ID, addressId);
|
||||
nodeMappingArray.add(nodeMappingObj);
|
||||
}
|
||||
} catch (SQLException | H2ClientException e) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import org.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.skywalking.apm.collector.core.util.ColumnNameUtils;
|
||||
import org.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.skywalking.apm.collector.storage.dao.INodeReferenceUIDAO;
|
||||
import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
|
|
@ -37,8 +38,8 @@ import org.slf4j.LoggerFactory;
|
|||
public class NodeReferenceH2UIDAO extends H2DAO implements INodeReferenceUIDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NodeReferenceH2UIDAO.class);
|
||||
private static final String NODE_REFERENCE_SQL = "select {8}, {9}, {10}, sum({0}) as {0}, sum({1}) as {1}, sum({2}) as {2}, " +
|
||||
"sum({3}) as {3}, sum({4}) as {4}, sum({5}) as {5} from {6} where {7} >= ? and {7} <= ? group by {8}, {9}, {10} limit 100";
|
||||
private static final String NODE_REFERENCE_SQL = "select {8}, {9}, sum({0}) as {0}, sum({1}) as {1}, sum({2}) as {2}, " +
|
||||
"sum({3}) as {3}, sum({4}) as {4}, sum({5}) as {5} from {6} where {7} >= ? and {7} <= ? group by {8}, {9} limit 100";
|
||||
|
||||
public NodeReferenceH2UIDAO(H2Client client) {
|
||||
super(client);
|
||||
|
|
@ -56,24 +57,18 @@ public class NodeReferenceH2UIDAO extends H2DAO implements INodeReferenceUIDAO {
|
|||
Object[] params = new Object[] {startTime, endTime};
|
||||
try (ResultSet rs = client.executeQuery(sql, params)) {
|
||||
while (rs.next()) {
|
||||
int applicationId = rs.getInt(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID);
|
||||
//TODO ApplicationCache
|
||||
// String applicationCode = ApplicationCache.get(applicationId);
|
||||
int frontApplicationId = rs.getInt(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID);
|
||||
int behindApplicationId = rs.getInt(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID);
|
||||
if (behindApplicationId != 0) {
|
||||
// String behindApplicationCode = ApplicationCache.get(behindApplicationId);
|
||||
|
||||
JsonObject nodeRefResSumObj = new JsonObject();
|
||||
// nodeRefResSumObj.addProperty("front", applicationCode);
|
||||
// nodeRefResSumObj.addProperty("behind", behindApplicationCode);
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S1_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S1_LTE));
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S3_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S3_LTE));
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S5_LTE));
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_GT, rs.getDouble(NodeReferenceTable.COLUMN_S5_GT));
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_ERROR, rs.getDouble(NodeReferenceTable.COLUMN_ERROR));
|
||||
nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_SUMMARY, rs.getDouble(NodeReferenceTable.COLUMN_SUMMARY));
|
||||
nodeRefResSumArray.add(nodeRefResSumObj);
|
||||
}
|
||||
JsonObject nodeRefResSumObj = new JsonObject();
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID), frontApplicationId);
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID), behindApplicationId);
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_S1_LTE), rs.getDouble(NodeReferenceTable.COLUMN_S1_LTE));
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_S3_LTE), rs.getDouble(NodeReferenceTable.COLUMN_S3_LTE));
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_S5_LTE), rs.getDouble(NodeReferenceTable.COLUMN_S5_LTE));
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_S5_GT), rs.getDouble(NodeReferenceTable.COLUMN_S5_GT));
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_ERROR), rs.getDouble(NodeReferenceTable.COLUMN_ERROR));
|
||||
nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(NodeReferenceTable.COLUMN_SUMMARY), rs.getDouble(NodeReferenceTable.COLUMN_SUMMARY));
|
||||
nodeRefResSumArray.add(nodeRefResSumObj);
|
||||
}
|
||||
} catch (SQLException | H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue