Polish metrics logic, fix service traffic bug (#4754)
1. Service Traffic should serialize and deserialize the time bucket, otherwise, there is a chance service_traffic-0 generated. 2. Make top N results more clear about the owner. Previously, the same endpoint names of different services look the same. 3. Sync UI. 4. Fix service traffic equal and hashcode method. The time bucket is not a part of the entity attribute.
This commit is contained in:
parent
d19ba41678
commit
07cc984d73
|
|
@ -38,7 +38,10 @@ import org.apache.skywalking.oap.server.core.storage.annotation.Column;
|
|||
@Stream(name = ServiceTraffic.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE,
|
||||
builder = ServiceTraffic.Builder.class, processor = MetricsStreamProcessor.class)
|
||||
@MetricsExtension(supportDownSampling = false, supportUpdate = false)
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(of = {
|
||||
"name",
|
||||
"nodeType"
|
||||
})
|
||||
public class ServiceTraffic extends Metrics {
|
||||
public static final String INDEX_NAME = "service_traffic";
|
||||
|
||||
|
|
@ -69,6 +72,8 @@ public class ServiceTraffic extends Metrics {
|
|||
public void deserialize(final RemoteData remoteData) {
|
||||
setName(remoteData.getDataStrings(0));
|
||||
setNodeType(NodeType.valueOf(remoteData.getDataIntegers(0)));
|
||||
// Time bucket is not a part of persistent, but still is required in the first time insert.
|
||||
setTimeBucket(remoteData.getDataLongs(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -76,6 +81,8 @@ public class ServiceTraffic extends Metrics {
|
|||
final RemoteData.Builder builder = RemoteData.newBuilder();
|
||||
builder.addDataStrings(name);
|
||||
builder.addDataIntegers(nodeType.value());
|
||||
// Time bucket is not a part of persistent, but still is required in the first time insert.
|
||||
builder.addDataLongs(getTimeBucket());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,10 +68,33 @@ public class AggregationQueryService implements Service {
|
|||
selectedRecord.setName(IDManager.ServiceID.analysisId(selectedRecord.getId()).getName());
|
||||
break;
|
||||
case ServiceInstance:
|
||||
selectedRecord.setName(IDManager.ServiceInstanceID.analysisId(selectedRecord.getId()).getName());
|
||||
final IDManager.ServiceInstanceID.InstanceIDDefinition instanceIDDefinition
|
||||
= IDManager.ServiceInstanceID.analysisId(selectedRecord.getId());
|
||||
/**
|
||||
* Add the service name into the name if this is global top N.
|
||||
*/
|
||||
if (StringUtil.isEmpty(condition.getParentService())) {
|
||||
IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition =
|
||||
IDManager.ServiceID.analysisId(instanceIDDefinition.getServiceId());
|
||||
selectedRecord.setName(serviceIDDefinition.getName() + " - " + instanceIDDefinition.getName());
|
||||
} else {
|
||||
selectedRecord.setName(instanceIDDefinition.getName());
|
||||
}
|
||||
break;
|
||||
case Endpoint:
|
||||
selectedRecord.setName(IDManager.EndpointID.analysisId(selectedRecord.getId()).getEndpointName());
|
||||
final IDManager.EndpointID.EndpointIDDefinition endpointIDDefinition
|
||||
= IDManager.EndpointID.analysisId(selectedRecord.getId());
|
||||
/**
|
||||
* Add the service name into the name if this is global top N.
|
||||
*/
|
||||
if (StringUtil.isEmpty(condition.getParentService())) {
|
||||
IDManager.ServiceID.ServiceIDDefinition serviceIDDefinition =
|
||||
IDManager.ServiceID.analysisId(endpointIDDefinition.getServiceId());
|
||||
selectedRecord.setName(serviceIDDefinition.getName()
|
||||
+ " - " + endpointIDDefinition.getEndpointName());
|
||||
} else {
|
||||
selectedRecord.setName(endpointIDDefinition.getEndpointName());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
selectedRecord.setName(Const.UNKNOWN);
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ public class MultiScopesAnalysisListener implements EntryAnalysisListener, ExitA
|
|||
});
|
||||
|
||||
exitSourceBuilders.forEach(exitSourceBuilder -> {
|
||||
sourceReceiver.receive(exitSourceBuilder.toService());
|
||||
sourceReceiver.receive(exitSourceBuilder.toServiceRelation());
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 86ed033a6f976a87b666df10bc103f7249fda2b5
|
||||
Subproject commit 0416d325243be661142fba415717ddc926127016
|
||||
Loading…
Reference in New Issue