Remove component_id from the instance topology (#10170)

This commit is contained in:
吴晟 Wu Sheng 2022-12-16 21:37:13 +08:00 committed by GitHub
parent 9986944119
commit 85be0bd568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 74 additions and 109 deletions

View File

@ -47,6 +47,7 @@
* Support `priority` definition in the `component-libraries.yml`.
* Enhance service topology query. When there are multiple components detected from the server side,
the component type of the node would be determined by the priority, which was random in the previous release.
* Remove `component_id` from `service_instance_relation_client_side` and `service_instance_relation_server_side`.
#### UI

View File

@ -43,7 +43,6 @@ public class ServiceInstanceCallRelationDispatcher implements SourceDispatcher<S
metrics.setSourceServiceInstanceId(source.getSourceServiceInstanceId());
metrics.setDestServiceId(source.getDestServiceId());
metrics.setDestServiceInstanceId(source.getDestServiceInstanceId());
metrics.setComponentId(source.getComponentId());
metrics.setEntityId(source.getEntityId());
MetricsStreamProcessor.getInstance().in(metrics);
}
@ -55,7 +54,6 @@ public class ServiceInstanceCallRelationDispatcher implements SourceDispatcher<S
metrics.setSourceServiceInstanceId(source.getSourceServiceInstanceId());
metrics.setDestServiceId(source.getDestServiceId());
metrics.setDestServiceInstanceId(source.getDestServiceInstanceId());
metrics.setComponentId(source.getComponentId());
metrics.setEntityId(source.getEntityId());
MetricsStreamProcessor.getInstance().in(metrics);
}

View File

@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.analysis.manual.relation.instance;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.core.analysis.MetricsExtension;
import org.apache.skywalking.oap.server.core.analysis.Stream;
import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProcessor;
@ -39,6 +40,7 @@ import static org.apache.skywalking.oap.server.core.analysis.metrics.Metrics.TIM
@Stream(name = ServiceInstanceRelationClientSideMetrics.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE_INSTANCE_RELATION,
builder = ServiceInstanceRelationClientSideMetrics.Builder.class, processor = MetricsStreamProcessor.class)
@MetricsExtension(supportDownSampling = true, supportUpdate = false, timeRelativeID = true)
@EqualsAndHashCode(of = {
"entityId"
}, callSuper = true)
@ -50,7 +52,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
public static final String SOURCE_SERVICE_INSTANCE_ID = "source_service_instance_id";
public static final String DEST_SERVICE_ID = "dest_service_id";
public static final String DEST_SERVICE_INSTANCE_ID = "dest_service_instance_id";
public static final String COMPONENT_ID = "component_id";
@Setter
@Getter
@ -70,10 +71,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
private String destServiceInstanceId;
@Setter
@Getter
@Column(columnName = COMPONENT_ID, storageOnly = true)
private int componentId;
@Setter
@Getter
@Column(columnName = ENTITY_ID, length = 512)
private String entityId;
@ -85,7 +82,7 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
@Override
public boolean combine(Metrics metrics) {
return true;
return false;
}
@Override
@ -101,7 +98,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId(getSourceServiceInstanceId());
metrics.setDestServiceId(getDestServiceId());
metrics.setDestServiceInstanceId(getDestServiceInstanceId());
metrics.setComponentId(getComponentId());
metrics.setEntityId(getEntityId());
return metrics;
}
@ -114,7 +110,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId(getSourceServiceInstanceId());
metrics.setDestServiceId(getDestServiceId());
metrics.setDestServiceInstanceId(getDestServiceInstanceId());
metrics.setComponentId(getComponentId());
metrics.setEntityId(getEntityId());
return metrics;
}
@ -134,8 +129,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
setDestServiceId(remoteData.getDataStrings(3));
setDestServiceInstanceId(remoteData.getDataStrings(4));
setComponentId(remoteData.getDataIntegers(0));
setTimeBucket(remoteData.getDataLongs(0));
}
@ -149,8 +142,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
remoteBuilder.addDataStrings(getDestServiceId());
remoteBuilder.addDataStrings(getDestServiceInstanceId());
remoteBuilder.addDataIntegers(getComponentId());
remoteBuilder.addDataLongs(getTimeBucket());
return remoteBuilder;
}
@ -164,7 +155,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId((String) converter.get(SOURCE_SERVICE_INSTANCE_ID));
metrics.setDestServiceId((String) converter.get(DEST_SERVICE_ID));
metrics.setDestServiceInstanceId((String) converter.get(DEST_SERVICE_INSTANCE_ID));
metrics.setComponentId(((Number) converter.get(COMPONENT_ID)).intValue());
metrics.setTimeBucket(((Number) converter.get(TIME_BUCKET)).longValue());
return metrics;
}
@ -177,7 +167,6 @@ public class ServiceInstanceRelationClientSideMetrics extends Metrics {
converter.accept(SOURCE_SERVICE_INSTANCE_ID, storageData.getSourceServiceInstanceId());
converter.accept(DEST_SERVICE_ID, storageData.getDestServiceId());
converter.accept(DEST_SERVICE_INSTANCE_ID, storageData.getDestServiceInstanceId());
converter.accept(COMPONENT_ID, storageData.getComponentId());
converter.accept(TIME_BUCKET, storageData.getTimeBucket());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.analysis.manual.relation.instance;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.core.analysis.MetricsExtension;
import org.apache.skywalking.oap.server.core.analysis.Stream;
import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProcessor;
@ -40,6 +41,7 @@ import static org.apache.skywalking.oap.server.core.analysis.metrics.Metrics.TIM
@Stream(name = ServiceInstanceRelationServerSideMetrics.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE_INSTANCE_RELATION,
builder = ServiceInstanceRelationServerSideMetrics.Builder.class, processor = MetricsStreamProcessor.class)
@MetricsExtension(supportDownSampling = true, supportUpdate = false, timeRelativeID = true)
@EqualsAndHashCode(of = {
"entityId"
}, callSuper = true)
@ -51,7 +53,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
public static final String SOURCE_SERVICE_INSTANCE_ID = "source_service_instance_id";
public static final String DEST_SERVICE_ID = "dest_service_id";
public static final String DEST_SERVICE_INSTANCE_ID = "dest_service_instance_id";
public static final String COMPONENT_ID = "component_id";
@Setter
@Getter
@ -71,10 +72,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
private String destServiceInstanceId;
@Setter
@Getter
@Column(columnName = COMPONENT_ID, storageOnly = true)
private int componentId;
@Setter
@Getter
@Column(columnName = ENTITY_ID, length = 512)
@BanyanDB.SeriesID(index = 0)
private String entityId;
@ -88,7 +85,7 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
@Override
public boolean combine(Metrics metrics) {
return true;
return false;
}
@Override
@ -104,7 +101,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId(getSourceServiceInstanceId());
metrics.setDestServiceId(getDestServiceId());
metrics.setDestServiceInstanceId(getDestServiceInstanceId());
metrics.setComponentId(getComponentId());
metrics.setEntityId(getEntityId());
return metrics;
}
@ -117,7 +113,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId(getSourceServiceInstanceId());
metrics.setDestServiceId(getDestServiceId());
metrics.setDestServiceInstanceId(getDestServiceInstanceId());
metrics.setComponentId(getComponentId());
metrics.setEntityId(getEntityId());
return metrics;
}
@ -137,8 +132,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
setDestServiceId(remoteData.getDataStrings(3));
setDestServiceInstanceId(remoteData.getDataStrings(4));
setComponentId(remoteData.getDataIntegers(0));
setTimeBucket(remoteData.getDataLongs(0));
}
@ -152,8 +145,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
remoteBuilder.addDataStrings(getDestServiceId());
remoteBuilder.addDataStrings(getDestServiceInstanceId());
remoteBuilder.addDataIntegers(getComponentId());
remoteBuilder.addDataLongs(getTimeBucket());
return remoteBuilder;
}
@ -167,7 +158,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
metrics.setSourceServiceInstanceId((String) converter.get(SOURCE_SERVICE_INSTANCE_ID));
metrics.setDestServiceId((String) converter.get(DEST_SERVICE_ID));
metrics.setDestServiceInstanceId((String) converter.get(DEST_SERVICE_INSTANCE_ID));
metrics.setComponentId(((Number) converter.get(COMPONENT_ID)).intValue());
metrics.setTimeBucket(((Number) converter.get(TIME_BUCKET)).longValue());
return metrics;
}
@ -180,7 +170,6 @@ public class ServiceInstanceRelationServerSideMetrics extends Metrics {
converter.accept(SOURCE_SERVICE_INSTANCE_ID, storageData.getSourceServiceInstanceId());
converter.accept(DEST_SERVICE_ID, storageData.getDestServiceId());
converter.accept(DEST_SERVICE_INSTANCE_ID, storageData.getDestServiceInstanceId());
converter.accept(COMPONENT_ID, storageData.getComponentId());
converter.accept(TIME_BUCKET, storageData.getTimeBucket());
}
}

View File

@ -43,7 +43,6 @@ public class TCPServiceInstanceCallRelationDispatcher implements SourceDispatche
metrics.setSourceServiceInstanceId(source.getSourceServiceInstanceId());
metrics.setDestServiceId(source.getDestServiceId());
metrics.setDestServiceInstanceId(source.getDestServiceInstanceId());
metrics.setComponentId(source.getComponentId());
metrics.setEntityId(source.getEntityId());
MetricsStreamProcessor.getInstance().in(metrics);
}
@ -55,7 +54,6 @@ public class TCPServiceInstanceCallRelationDispatcher implements SourceDispatche
metrics.setSourceServiceInstanceId(source.getSourceServiceInstanceId());
metrics.setDestServiceId(source.getDestServiceId());
metrics.setDestServiceInstanceId(source.getDestServiceInstanceId());
metrics.setComponentId(source.getComponentId());
metrics.setEntityId(source.getEntityId());
MetricsStreamProcessor.getInstance().in(metrics);
}

View File

@ -23,10 +23,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.oap.server.library.util.StringUtil;
import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.analysis.IDManager;
import org.apache.skywalking.oap.server.core.config.IComponentLibraryCatalogService;
import org.apache.skywalking.oap.server.core.query.type.Call;
import org.apache.skywalking.oap.server.core.query.type.ServiceInstanceNode;
import org.apache.skywalking.oap.server.core.query.type.ServiceInstanceTopology;
@ -36,12 +34,7 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager;
@Slf4j
public class ServiceInstanceTopologyBuilder {
private final IComponentLibraryCatalogService componentLibraryCatalogService;
public ServiceInstanceTopologyBuilder(ModuleManager moduleManager) {
this.componentLibraryCatalogService = moduleManager.find(CoreModule.NAME)
.provider()
.getService(IComponentLibraryCatalogService.class);
}
ServiceInstanceTopology build(List<Call.CallDetail> serviceInstanceRelationClientCalls,
@ -71,10 +64,6 @@ public class ServiceInstanceTopologyBuilder {
if (!nodes.containsKey(clientCall.getTarget())) {
final ServiceInstanceNode node = buildNode(destService, destServiceInstance);
nodes.put(clientCall.getTarget(), node);
if (!node.isReal() && StringUtil.isEmpty(node.getType())) {
node.setType(
componentLibraryCatalogService.getServerNameBasedOnComponent(clientCall.getComponentId()));
}
}
if (!callMap.containsKey(clientCall.getId())) {
@ -85,7 +74,6 @@ public class ServiceInstanceTopologyBuilder {
call.setTarget(clientCall.getTarget());
call.setId(clientCall.getId());
call.addDetectPoint(DetectPoint.CLIENT);
call.addSourceComponent(componentLibraryCatalogService.getComponentName(clientCall.getComponentId()));
calls.add(call);
}
}
@ -111,12 +99,6 @@ public class ServiceInstanceTopologyBuilder {
final ServiceInstanceNode node = buildNode(destService, destServiceInstance);
nodes.put(serverCall.getTarget(), node);
}
/*
* Service side component id has higher priority
*/
final ServiceInstanceNode serverSideNode = nodes.get(serverCall.getTarget());
serverSideNode.setType(
componentLibraryCatalogService.getServerNameBasedOnComponent(serverCall.getComponentId()));
if (!callMap.containsKey(serverCall.getId())) {
Call call = new Call();
@ -126,12 +108,10 @@ public class ServiceInstanceTopologyBuilder {
call.setTarget(serverCall.getTarget());
call.setId(serverCall.getId());
call.addDetectPoint(DetectPoint.SERVER);
call.addTargetComponent(componentLibraryCatalogService.getComponentName(serverCall.getComponentId()));
calls.add(call);
} else {
Call call = callMap.get(serverCall.getId());
call.addDetectPoint(DetectPoint.SERVER);
call.addTargetComponent(componentLibraryCatalogService.getComponentName(serverCall.getComponentId()));
}
}
@ -151,6 +131,7 @@ public class ServiceInstanceTopologyBuilder {
instanceNode.setServiceId(instanceIDDefinition.getServiceId());
instanceNode.setServiceName(serviceIDDefinition.getName());
instanceNode.setReal(serviceIDDefinition.isReal());
instanceNode.setType(Const.EMPTY_STRING); //Since 9.4.0, don't provide type for instance topology node.
return instanceNode;
}
}

View File

@ -31,7 +31,19 @@ import org.apache.skywalking.oap.server.core.source.DetectPoint;
public class Call {
private String source;
private String target;
/**
* Components are detected at the client-side in Service and Process topologies, and no value in instance topology
* and endpoint dependency.
*
* @since 9.4.0
*/
private List<String> sourceComponents;
/**
* Components are detected at the server-side in Service and Process topologies, and no value in instance topology
* and endpoint dependency.
*
* @since 9.4.0
*/
private List<String> targetComponents;
private String id;
private List<DetectPoint> detectPoints;
@ -88,14 +100,13 @@ public class Call {
this.setDetectPoint(detectPoint);
}
public void buildFromInstanceRelation(String entityId, int componentId, DetectPoint detectPoint) {
public void buildFromInstanceRelation(String entityId, DetectPoint detectPoint) {
final IDManager.ServiceInstanceID.ServiceInstanceRelationDefine serviceRelationDefine
= IDManager.ServiceInstanceID.analysisRelationId(entityId);
this.setId(entityId);
this.setSource(serviceRelationDefine.getSourceId());
this.setTarget(serviceRelationDefine.getDestId());
this.setComponentId(componentId);
this.setDetectPoint(detectPoint);
}
@ -122,7 +133,8 @@ public class Call {
public void buildProcessRelation(String entityId, int componentId, DetectPoint detectPoint) {
this.setId(entityId);
final IDManager.ProcessID.ProcessRelationDefine processRelationDefine = IDManager.ProcessID.analysisRelationId(entityId);
final IDManager.ProcessID.ProcessRelationDefine processRelationDefine = IDManager.ProcessID.analysisRelationId(
entityId);
this.setDetectPoint(detectPoint);
this.setSource(processRelationDefine.getSourceId());
this.setTarget(processRelationDefine.getDestId());

View File

@ -29,6 +29,10 @@ public class ServiceInstanceNode {
private String name;
private String serviceId;
private String serviceName;
/**
* @since 9.4.0 No type for service instance topology.
*/
@Deprecated
private String type = "";
private boolean isReal;
}

View File

@ -129,8 +129,6 @@ public class BanyanDBTopologyQueryDAO extends AbstractBanyanDBDAO implements ITo
MeasureQueryResponse resp = query(modelName,
ImmutableSet.of(
ServiceRelationClientSideMetrics.COMPONENT_IDS,
ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID,
ServiceRelationClientSideMetrics.DEST_SERVICE_ID,
Metrics.ENTITY_ID
),
Collections.emptySet(), timestampRange, q
@ -208,9 +206,6 @@ public class BanyanDBTopologyQueryDAO extends AbstractBanyanDBDAO implements ITo
for (final QueryBuilder<MeasureQuery> q : queryBuilderList) {
MeasureQueryResponse resp = query(modelName,
ImmutableSet.of(
ServiceInstanceRelationServerSideMetrics.COMPONENT_ID,
ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID,
ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID,
Metrics.ENTITY_ID
),
Collections.emptySet(), timestampRange, q
@ -220,11 +215,7 @@ public class BanyanDBTopologyQueryDAO extends AbstractBanyanDBDAO implements ITo
}
final Call.CallDetail call = new Call.CallDetail();
final String entityId = resp.getDataPoints().get(0).getTagValue(Metrics.ENTITY_ID);
final int componentId = ((Number) resp.getDataPoints()
.get(0)
.getTagValue(
ServiceInstanceRelationServerSideMetrics.COMPONENT_ID)).intValue();
call.buildFromInstanceRelation(entityId, componentId, detectPoint);
call.buildFromInstanceRelation(entityId, detectPoint);
callMap.putIfAbsent(entityId, call);
}
return new ArrayList<>(callMap.values());
@ -283,8 +274,6 @@ public class BanyanDBTopologyQueryDAO extends AbstractBanyanDBDAO implements ITo
for (final QueryBuilder<MeasureQuery> q : queryBuilderList) {
MeasureQueryResponse resp = query(EndpointRelationServerSideMetrics.INDEX_NAME,
ImmutableSet.of(
EndpointRelationServerSideMetrics.DEST_ENDPOINT,
EndpointRelationServerSideMetrics.SOURCE_ENDPOINT,
Metrics.ENTITY_ID
),
Collections.emptySet(), timestampRange, q

View File

@ -89,7 +89,9 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
.gte(duration.getStartTimeBucket())
.lte(duration.getEndTimeBucket()));
if (IndexController.LogicIndicesRegister.isMergedTable(ServiceRelationServerSideMetrics.INDEX_NAME)) {
query.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME, ServiceRelationServerSideMetrics.INDEX_NAME));
query.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME,
ServiceRelationServerSideMetrics.INDEX_NAME
));
}
sourceBuilder.query(query).size(0);
@ -105,7 +107,9 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
.gte(duration.getStartTimeBucket())
.lte(duration.getEndTimeBucket()));
if (IndexController.LogicIndicesRegister.isMergedTable(ServiceRelationClientSideMetrics.INDEX_NAME)) {
query.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME, ServiceRelationClientSideMetrics.INDEX_NAME));
query.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME,
ServiceRelationClientSideMetrics.INDEX_NAME
));
}
sourceBuilder.query(query).size(0);
@ -118,7 +122,8 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
String serverServiceId,
Duration duration) {
final SearchBuilder search = Search.builder().size(0);
setInstanceQueryCondition(search, duration, clientServiceId, serverServiceId, ServiceInstanceRelationServerSideMetrics.INDEX_NAME);
setInstanceQueryCondition(
search, duration, clientServiceId, serverServiceId, ServiceInstanceRelationServerSideMetrics.INDEX_NAME);
return buildInstanceRelation(
search, ServiceInstanceRelationServerSideMetrics.INDEX_NAME, DetectPoint.SERVER);
@ -129,7 +134,8 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
String serverServiceId,
Duration duration) {
final SearchBuilder search = Search.builder().size(0);
setInstanceQueryCondition(search, duration, clientServiceId, serverServiceId, ServiceInstanceRelationClientSideMetrics.INDEX_NAME);
setInstanceQueryCondition(
search, duration, clientServiceId, serverServiceId, ServiceInstanceRelationClientSideMetrics.INDEX_NAME);
return buildInstanceRelation(
search, ServiceInstanceRelationClientSideMetrics.INDEX_NAME, DetectPoint.CLIENT);
@ -201,7 +207,9 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId
));
if (IndexController.LogicIndicesRegister.isMergedTable(EndpointRelationServerSideMetrics.INDEX_NAME)) {
boolQuery.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME, EndpointRelationServerSideMetrics.INDEX_NAME));
boolQuery.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME,
EndpointRelationServerSideMetrics.INDEX_NAME
));
}
sourceBuilder.query(boolQuery);
@ -210,19 +218,25 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
}
@Override
public List<Call.CallDetail> loadProcessRelationDetectedAtClientSide(String serviceInstanceId, Duration duration) throws IOException {
public List<Call.CallDetail> loadProcessRelationDetectedAtClientSide(String serviceInstanceId,
Duration duration) throws IOException {
return buildProcessRelation(serviceInstanceId, duration, DetectPoint.CLIENT);
}
@Override
public List<Call.CallDetail> loadProcessRelationDetectedAtServerSide(String serviceInstanceId, Duration duration) throws IOException {
public List<Call.CallDetail> loadProcessRelationDetectedAtServerSide(String serviceInstanceId,
Duration duration) throws IOException {
return buildProcessRelation(serviceInstanceId, duration, DetectPoint.SERVER);
}
private List<Call.CallDetail> buildProcessRelation(String serviceInstanceId, Duration duration, DetectPoint detectPoint) throws IOException {
private List<Call.CallDetail> buildProcessRelation(String serviceInstanceId,
Duration duration,
DetectPoint detectPoint) throws IOException {
final SearchBuilder sourceBuilder = Search.builder().size(0);
final BoolQueryBuilder query = Query.bool()
.must(Query.term(ProcessRelationServerSideMetrics.SERVICE_INSTANCE_ID, serviceInstanceId))
.must(Query.term(ProcessRelationServerSideMetrics.SERVICE_INSTANCE_ID,
serviceInstanceId
))
.must(Query.range(EndpointRelationServerSideMetrics.TIME_BUCKET)
.gte(duration.getStartTimeBucket())
.lte(duration.getEndTimeBucket()));
@ -232,9 +246,9 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
.terms(Metrics.ENTITY_ID).field(Metrics.ENTITY_ID)
.subAggregation(
Aggregation.terms(ProcessRelationServerSideMetrics.COMPONENT_ID)
.field(ProcessRelationServerSideMetrics.COMPONENT_ID)
.executionHint(TermsAggregationBuilder.ExecutionHint.MAP)
.collectMode(TermsAggregationBuilder.CollectMode.BREADTH_FIRST))
.field(ProcessRelationServerSideMetrics.COMPONENT_ID)
.executionHint(TermsAggregationBuilder.ExecutionHint.MAP)
.collectMode(TermsAggregationBuilder.CollectMode.BREADTH_FIRST))
.executionHint(TermsAggregationBuilder.ExecutionHint.MAP)
.collectMode(TermsAggregationBuilder.CollectMode.BREADTH_FIRST)
.size(1000));
@ -317,11 +331,6 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
sourceBuilder.aggregation(
Aggregation
.terms(Metrics.ENTITY_ID).field(Metrics.ENTITY_ID)
.subAggregation(
Aggregation.terms(ServiceInstanceRelationServerSideMetrics.COMPONENT_ID)
.field(ServiceInstanceRelationServerSideMetrics.COMPONENT_ID)
.executionHint(TermsAggregationBuilder.ExecutionHint.MAP)
.collectMode(TermsAggregationBuilder.CollectMode.BREADTH_FIRST))
.executionHint(TermsAggregationBuilder.ExecutionHint.MAP)
.collectMode(TermsAggregationBuilder.CollectMode.BREADTH_FIRST)
.size(1000));
@ -333,18 +342,14 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO {
List<Call.CallDetail> calls = new ArrayList<>();
final Map<String, Object> entityTerms =
(Map<String, Object>) response.getAggregations().get(Metrics.ENTITY_ID);
final List<Map<String, Object>> buckets =
(List<Map<String, Object>>) entityTerms.get("buckets");
for (Map<String, Object> entityBucket : buckets) {
final String entityId = (String) entityBucket.get("key");
final Map<String, Object> componentTerms = (Map<String, Object>) entityBucket.get(
ServiceInstanceRelationServerSideMetrics.COMPONENT_ID);
final List<Map<String, Object>> subAgg =
(List<Map<String, Object>>) componentTerms.get("buckets");
final int componentId = ((Number) subAgg.iterator().next().get("key")).intValue();
for (final Map<String, Object> entityBucket : buckets) {
String entityId = (String) entityBucket.get("key");
Call.CallDetail call = new Call.CallDetail();
call.buildFromInstanceRelation(entityId, componentId, detectPoint);
call.buildFromInstanceRelation(entityId, detectPoint);
calls.add(call);
}
return calls;

View File

@ -201,9 +201,9 @@ public class JDBCTopologyQueryDAO implements ITopologyQueryDAO {
try (Connection connection = jdbcClient.getConnection()) {
try (ResultSet resultSet = jdbcClient.executeQuery(
connection,
"select " + Metrics.ENTITY_ID + ", " + ServiceInstanceRelationServerSideMetrics.COMPONENT_ID
"select " + Metrics.ENTITY_ID
+ " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? " + serviceIdMatchSql
.toString() + " group by " + Metrics.ENTITY_ID + ", " + ServiceInstanceRelationServerSideMetrics.COMPONENT_ID,
.toString() + " group by " + Metrics.ENTITY_ID,
conditions
)) {
buildInstanceCalls(resultSet, calls, detectPoint);
@ -287,8 +287,7 @@ public class JDBCTopologyQueryDAO implements ITopologyQueryDAO {
while (resultSet.next()) {
Call.CallDetail call = new Call.CallDetail();
String entityId = resultSet.getString(Metrics.ENTITY_ID);
final int componentId = resultSet.getInt(ServiceInstanceRelationServerSideMetrics.COMPONENT_ID);
call.buildFromInstanceRelation(entityId, componentId, detectPoint);
call.buildFromInstanceRelation(entityId, detectPoint);
calls.add(call);
}
}

View File

@ -25,13 +25,13 @@ nodes:
name: provider1
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: "Tomcat"
type: ""
isreal: true
- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider2" }}
name: provider2
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: "Tomcat"
type: ""
isreal: true
{{- end }}
calls:

View File

@ -25,7 +25,7 @@ nodes:
name: provider1
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: Tomcat
type: ""
isreal: true
{{- end }}
calls:

View File

@ -19,7 +19,7 @@ nodes:
name: {{ notEmpty .name }}
serviceid: {{ b64enc "e2e::reviews" }}.1
servicename: e2e::reviews
type: http
type: ""
isreal: true
- id: {{ notEmpty .id }}
name: {{ notEmpty .name }}

View File

@ -19,7 +19,7 @@ nodes:
name: User_Service_Instance_Name
serviceid: {{ b64enc "User_Service_Name" }}.1
servicename: User_Service_Name
type: Nginx
type: ""
isreal: true
- id: {{ b64enc "e2e-service-entry-provider" }}.1_{{ b64enc "provider1" }}
name: provider1

View File

@ -19,7 +19,7 @@ nodes:
name: consumer1
serviceid: {{ b64enc "e2e-service-consumer" }}.1
servicename: e2e-service-consumer
type: Tomcat
type: ""
isreal: true
- id: {{ b64enc "consumer" }}.1_{{ b64enc "consumer-instance" }}
name: consumer-instance

View File

@ -25,7 +25,7 @@ nodes:
name: provider1
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: Tomcat
type: ""
isreal: true
{{- end }}
calls:

View File

@ -19,7 +19,7 @@ nodes:
name: consumer1
serviceid: {{ b64enc "e2e-service-consumer" }}.1
servicename: e2e-service-consumer
type: Tomcat
type: ""
isreal: true
- id: {{ b64enc "consumer-py" }}.1_{{ b64enc "consumer-py-instance" }}
name: consumer-py-instance

View File

@ -19,7 +19,7 @@ nodes:
name: provider-py-kafka-instance
serviceid: {{ b64enc "provider-py-kafka" }}.1
servicename: provider-py-kafka
type: Python
type: ""
isreal: true
- id: {{ b64enc "consumer-py" }}.1_{{ b64enc "consumer-py-instance" }}
name: consumer-py-instance

View File

@ -25,7 +25,7 @@ nodes:
name: provider-py-instance
serviceid: {{ b64enc "provider-py" }}.1
servicename: provider-py
type: Python
type: ""
isreal: true
{{- end }}
calls:

View File

@ -25,7 +25,7 @@ nodes:
name: provider1
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: "Tomcat"
type: ""
isreal: true
{{- end }}
calls:

View File

@ -25,7 +25,7 @@ nodes:
name: provider1
serviceid: {{ b64enc "e2e-service-provider" }}.1
servicename: e2e-service-provider
type: "Tomcat"
type: ""
isreal: true
{{- end }}
calls: