Loading apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe public void parseEntry(SpanObject spanObject, int applicationId, int applicationInstanceId, String segmentId) { SegmentCostDataDefine.SegmentCost segmentCost = new SegmentCostDataDefine.SegmentCost(); segmentCost.setSegmentId(segmentId); segmentCost.setApplicationId(applicationId); segmentCost.setCost(spanObject.getEndTime() - spanObject.getStartTime()); segmentCost.setStartTime(spanObject.getStartTime()); segmentCost.setEndTime(spanObject.getEndTime()); Loading apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java +3 −2 Original line number Diff line number Diff line Loading @@ -4,11 +4,11 @@ import java.util.HashMap; import java.util.Map; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.update.UpdateRequestBuilder; import org.skywalking.apm.collector.core.stream.Data; import org.skywalking.apm.collector.storage.define.DataDefine; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; import org.skywalking.apm.collector.core.stream.Data; import org.skywalking.apm.collector.storage.define.DataDefine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; Loading @@ -31,6 +31,7 @@ public class SegmentCostEsDAO extends EsDAO implements ISegmentCostDAO, IPersist logger.debug("segment cost prepareBatchInsert, id: {}", data.getDataString(0)); Map<String, Object> source = new HashMap<>(); source.put(SegmentCostTable.COLUMN_SEGMENT_ID, data.getDataString(1)); source.put(SegmentCostTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); source.put(SegmentCostTable.COLUMN_SERVICE_NAME, data.getDataString(2)); source.put(SegmentCostTable.COLUMN_COST, data.getDataLong(0)); source.put(SegmentCostTable.COLUMN_START_TIME, data.getDataLong(1)); Loading apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public class SegmentCostEsTableDefine extends ElasticSearchTableDefine { @Override public void initialize() { addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, ElasticSearchColumnDefine.Type.Text.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_COST, ElasticSearchColumnDefine.Type.Long.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_START_TIME, ElasticSearchColumnDefine.Type.Long.name())); Loading apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java +2 −1 Original line number Diff line number Diff line package org.skywalking.apm.collector.agentstream.worker.segment.cost.define; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; import org.skywalking.apm.collector.storage.h2.define.H2ColumnDefine; import org.skywalking.apm.collector.storage.h2.define.H2TableDefine; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; /** * @author pengys5 Loading @@ -16,6 +16,7 @@ public class SegmentCostH2TableDefine extends H2TableDefine { @Override public void initialize() { addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_COST, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_START_TIME, H2ColumnDefine.Type.Bigint.name())); Loading apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java +18 −7 Original line number Diff line number Diff line Loading @@ -15,18 +15,19 @@ import org.skywalking.apm.collector.storage.define.DataDefine; public class SegmentCostDataDefine extends DataDefine { @Override protected int initialCapacity() { return 8; return 9; } @Override protected void attributeDefine() { addAttribute(0, new Attribute(SegmentCostTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); addAttribute(1, new Attribute(SegmentCostTable.COLUMN_SEGMENT_ID, AttributeType.STRING, new CoverOperation())); addAttribute(2, new Attribute(SegmentCostTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); addAttribute(3, new Attribute(SegmentCostTable.COLUMN_COST, AttributeType.LONG, new CoverOperation())); addAttribute(4, new Attribute(SegmentCostTable.COLUMN_START_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(5, new Attribute(SegmentCostTable.COLUMN_END_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(6, new Attribute(SegmentCostTable.COLUMN_IS_ERROR, AttributeType.BOOLEAN, new CoverOperation())); addAttribute(7, new Attribute(SegmentCostTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); addAttribute(2, new Attribute(SegmentCostTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); addAttribute(3, new Attribute(SegmentCostTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); addAttribute(4, new Attribute(SegmentCostTable.COLUMN_COST, AttributeType.LONG, new CoverOperation())); addAttribute(5, new Attribute(SegmentCostTable.COLUMN_START_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(6, new Attribute(SegmentCostTable.COLUMN_END_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(7, new Attribute(SegmentCostTable.COLUMN_IS_ERROR, AttributeType.BOOLEAN, new CoverOperation())); addAttribute(8, new Attribute(SegmentCostTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); } @Override public Object deserialize(RemoteData remoteData) { Loading @@ -39,6 +40,7 @@ public class SegmentCostDataDefine extends DataDefine { public static class SegmentCost implements Transform { private String id; private int applicationId; private String segmentId; private String serviceName; private Long cost; Loading @@ -56,6 +58,7 @@ public class SegmentCostDataDefine extends DataDefine { data.setDataString(0, this.id); data.setDataString(1, this.segmentId); data.setDataString(2, this.serviceName); data.setDataInteger(0, this.applicationId); data.setDataLong(0, this.cost); data.setDataLong(1, this.startTime); data.setDataLong(2, this.endTime); Loading Loading @@ -131,5 +134,13 @@ public class SegmentCostDataDefine extends DataDefine { public void setTimeBucket(long timeBucket) { this.timeBucket = timeBucket; } public int getApplicationId() { return applicationId; } public void setApplicationId(int applicationId) { this.applicationId = applicationId; } } } Loading
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe public void parseEntry(SpanObject spanObject, int applicationId, int applicationInstanceId, String segmentId) { SegmentCostDataDefine.SegmentCost segmentCost = new SegmentCostDataDefine.SegmentCost(); segmentCost.setSegmentId(segmentId); segmentCost.setApplicationId(applicationId); segmentCost.setCost(spanObject.getEndTime() - spanObject.getStartTime()); segmentCost.setStartTime(spanObject.getStartTime()); segmentCost.setEndTime(spanObject.getEndTime()); Loading
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java +3 −2 Original line number Diff line number Diff line Loading @@ -4,11 +4,11 @@ import java.util.HashMap; import java.util.Map; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.update.UpdateRequestBuilder; import org.skywalking.apm.collector.core.stream.Data; import org.skywalking.apm.collector.storage.define.DataDefine; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; import org.skywalking.apm.collector.core.stream.Data; import org.skywalking.apm.collector.storage.define.DataDefine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; Loading @@ -31,6 +31,7 @@ public class SegmentCostEsDAO extends EsDAO implements ISegmentCostDAO, IPersist logger.debug("segment cost prepareBatchInsert, id: {}", data.getDataString(0)); Map<String, Object> source = new HashMap<>(); source.put(SegmentCostTable.COLUMN_SEGMENT_ID, data.getDataString(1)); source.put(SegmentCostTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); source.put(SegmentCostTable.COLUMN_SERVICE_NAME, data.getDataString(2)); source.put(SegmentCostTable.COLUMN_COST, data.getDataLong(0)); source.put(SegmentCostTable.COLUMN_START_TIME, data.getDataLong(1)); Loading
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public class SegmentCostEsTableDefine extends ElasticSearchTableDefine { @Override public void initialize() { addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, ElasticSearchColumnDefine.Type.Text.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_COST, ElasticSearchColumnDefine.Type.Long.name())); addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_START_TIME, ElasticSearchColumnDefine.Type.Long.name())); Loading
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java +2 −1 Original line number Diff line number Diff line package org.skywalking.apm.collector.agentstream.worker.segment.cost.define; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; import org.skywalking.apm.collector.storage.h2.define.H2ColumnDefine; import org.skywalking.apm.collector.storage.h2.define.H2TableDefine; import org.skywalking.apm.collector.storage.define.segment.SegmentCostTable; /** * @author pengys5 Loading @@ -16,6 +16,7 @@ public class SegmentCostH2TableDefine extends H2TableDefine { @Override public void initialize() { addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_COST, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_START_TIME, H2ColumnDefine.Type.Bigint.name())); Loading
apm-collector/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java +18 −7 Original line number Diff line number Diff line Loading @@ -15,18 +15,19 @@ import org.skywalking.apm.collector.storage.define.DataDefine; public class SegmentCostDataDefine extends DataDefine { @Override protected int initialCapacity() { return 8; return 9; } @Override protected void attributeDefine() { addAttribute(0, new Attribute(SegmentCostTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); addAttribute(1, new Attribute(SegmentCostTable.COLUMN_SEGMENT_ID, AttributeType.STRING, new CoverOperation())); addAttribute(2, new Attribute(SegmentCostTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); addAttribute(3, new Attribute(SegmentCostTable.COLUMN_COST, AttributeType.LONG, new CoverOperation())); addAttribute(4, new Attribute(SegmentCostTable.COLUMN_START_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(5, new Attribute(SegmentCostTable.COLUMN_END_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(6, new Attribute(SegmentCostTable.COLUMN_IS_ERROR, AttributeType.BOOLEAN, new CoverOperation())); addAttribute(7, new Attribute(SegmentCostTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); addAttribute(2, new Attribute(SegmentCostTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); addAttribute(3, new Attribute(SegmentCostTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); addAttribute(4, new Attribute(SegmentCostTable.COLUMN_COST, AttributeType.LONG, new CoverOperation())); addAttribute(5, new Attribute(SegmentCostTable.COLUMN_START_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(6, new Attribute(SegmentCostTable.COLUMN_END_TIME, AttributeType.LONG, new CoverOperation())); addAttribute(7, new Attribute(SegmentCostTable.COLUMN_IS_ERROR, AttributeType.BOOLEAN, new CoverOperation())); addAttribute(8, new Attribute(SegmentCostTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); } @Override public Object deserialize(RemoteData remoteData) { Loading @@ -39,6 +40,7 @@ public class SegmentCostDataDefine extends DataDefine { public static class SegmentCost implements Transform { private String id; private int applicationId; private String segmentId; private String serviceName; private Long cost; Loading @@ -56,6 +58,7 @@ public class SegmentCostDataDefine extends DataDefine { data.setDataString(0, this.id); data.setDataString(1, this.segmentId); data.setDataString(2, this.serviceName); data.setDataInteger(0, this.applicationId); data.setDataLong(0, this.cost); data.setDataLong(1, this.startTime); data.setDataLong(2, this.endTime); Loading Loading @@ -131,5 +134,13 @@ public class SegmentCostDataDefine extends DataDefine { public void setTimeBucket(long timeBucket) { this.timeBucket = timeBucket; } public int getApplicationId() { return applicationId; } public void setApplicationId(int applicationId) { this.applicationId = applicationId; } } }