|
22 | 22 | import java.util.ArrayList; |
23 | 23 | import java.util.Collections; |
24 | 24 | import java.util.List; |
| 25 | +import org.apache.skywalking.oap.server.core.query.type.Owner; |
25 | 26 | import org.apache.skywalking.oap.server.core.query.type.debugging.DebuggingSpan; |
26 | 27 | import org.apache.skywalking.oap.server.core.query.type.debugging.DebuggingTraceContext; |
27 | 28 | import org.apache.skywalking.oap.server.library.util.StringUtil; |
@@ -72,38 +73,56 @@ private List<SelectedRecord> invokeSortMetrics(TopNCondition condition, Duration |
72 | 73 | final List<SelectedRecord> selectedRecords = getAggregationQueryDAO().sortMetricsDebuggable( |
73 | 74 | condition, valueCName, duration, additionalConditions); |
74 | 75 | selectedRecords.forEach(selectedRecord -> { |
| 76 | + Owner owner = new Owner(); |
| 77 | + owner.setScope(condition.getScope()); |
| 78 | + selectedRecord.setOwner(owner); |
75 | 79 | switch (condition.getScope()) { |
76 | 80 | case Service: |
77 | | - selectedRecord.setName(IDManager.ServiceID.analysisId(selectedRecord.getId()).getName()); |
| 81 | + final IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition |
| 82 | + = IDManager.ServiceID.analysisId(selectedRecord.getId()); |
| 83 | + selectedRecord.setName(serviceIDDefinition.getName()); |
| 84 | + owner.setServiceID(selectedRecord.getId()); |
| 85 | + owner.setServiceName(serviceIDDefinition.getName()); |
| 86 | + owner.setNormal(serviceIDDefinition.isReal()); |
78 | 87 | break; |
79 | 88 | case ServiceInstance: |
80 | 89 | final IDManager.ServiceInstanceID.InstanceIDDefinition instanceIDDefinition |
81 | 90 | = IDManager.ServiceInstanceID.analysisId(selectedRecord.getId()); |
| 91 | + final IDManager.ServiceID.ServiceIDDefinition instanceServiceIDDefinition = |
| 92 | + IDManager.ServiceID.analysisId(instanceIDDefinition.getServiceId()); |
82 | 93 | /* |
83 | 94 | * Add the service name into the name if this is global top N. |
84 | 95 | */ |
85 | 96 | if (StringUtil.isEmpty(condition.getParentService())) { |
86 | | - IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition = |
87 | | - IDManager.ServiceID.analysisId(instanceIDDefinition.getServiceId()); |
88 | | - selectedRecord.setName(serviceIDDefinition.getName() + " - " + instanceIDDefinition.getName()); |
| 97 | + selectedRecord.setName(instanceServiceIDDefinition.getName() + " - " + instanceIDDefinition.getName()); |
89 | 98 | } else { |
90 | 99 | selectedRecord.setName(instanceIDDefinition.getName()); |
91 | 100 | } |
| 101 | + owner.setServiceID(instanceIDDefinition.getServiceId()); |
| 102 | + owner.setServiceName(instanceServiceIDDefinition.getName()); |
| 103 | + owner.setNormal(instanceServiceIDDefinition.isReal()); |
| 104 | + owner.setServiceInstanceID(selectedRecord.getId()); |
| 105 | + owner.setServiceInstanceName(instanceIDDefinition.getName()); |
92 | 106 | break; |
93 | 107 | case Endpoint: |
94 | 108 | final IDManager.EndpointID.EndpointIDDefinition endpointIDDefinition |
95 | 109 | = IDManager.EndpointID.analysisId(selectedRecord.getId()); |
| 110 | + final IDManager.ServiceID.ServiceIDDefinition endpointServiceIDDefinition = |
| 111 | + IDManager.ServiceID.analysisId(endpointIDDefinition.getServiceId()); |
96 | 112 | /* |
97 | 113 | * Add the service name into the name if this is global top N. |
98 | 114 | */ |
99 | 115 | if (StringUtil.isEmpty(condition.getParentService())) { |
100 | | - IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition = |
101 | | - IDManager.ServiceID.analysisId(endpointIDDefinition.getServiceId()); |
102 | | - selectedRecord.setName(serviceIDDefinition.getName() |
| 116 | + selectedRecord.setName(endpointServiceIDDefinition.getName() |
103 | 117 | + " - " + endpointIDDefinition.getEndpointName()); |
104 | 118 | } else { |
105 | 119 | selectedRecord.setName(endpointIDDefinition.getEndpointName()); |
106 | 120 | } |
| 121 | + owner.setServiceID(endpointIDDefinition.getServiceId()); |
| 122 | + owner.setServiceName(endpointServiceIDDefinition.getName()); |
| 123 | + owner.setNormal(endpointServiceIDDefinition.isReal()); |
| 124 | + owner.setEndpointID(selectedRecord.getId()); |
| 125 | + owner.setEndpointName(endpointIDDefinition.getEndpointName()); |
107 | 126 | break; |
108 | 127 | default: |
109 | 128 | selectedRecord.setName(Const.UNKNOWN); |
|
0 commit comments