mrproliu commented on a change in pull request #8716:
URL: https://github.com/apache/skywalking/pull/8716#discussion_r831808876
##########
File path:
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/ebpf/EBPFProfilingQueryService.java
##########
@@ -83,10 +128,47 @@ private EBPFProfilingAnalyzer getProfilingAnalyzer() {
}
public List<EBPFProfilingSchedule> queryEBPFProfilingSchedules(String
taskId, Duration duration) throws IOException {
- return getScheduleDAO().querySchedules(taskId,
duration.getStartTimeBucket(), duration.getEndTimeBucket());
+ final List<EBPFProfilingSchedule> schedules =
getScheduleDAO().querySchedules(taskId, duration.getStartTimeBucket(),
duration.getEndTimeBucket());
+ if (CollectionUtils.isNotEmpty(schedules)) {
+ final Model processModel = getProcessModel();
+ final List<Metrics> processMetrics = schedules.stream()
+
.map(EBPFProfilingSchedule::getProcessId).distinct().map(processId -> {
+ final ProcessTraffic p = new ProcessTraffic();
+ p.setProcessId(processId);
+ return p;
+ }).collect(Collectors.toList());
+ final List<Metrics> processes =
getProcessMetricsDAO().multiGet(processModel, processMetrics);
+
+ final Map<String, Process> processMap = processes.stream()
+ .map(t -> (ProcessTraffic) t)
+ .collect(Collectors.toMap(Metrics::id,
this::convertProcess));
+ schedules.forEach(p ->
p.setProcess(processMap.get(p.getProcessId())));
+ }
+ return schedules;
}
public EBPFProfilingAnalyzation getEBPFProfilingAnalyzation(String taskId,
List<EBPFProfilingAnalyzeTimeRange> timeRanges) throws IOException {
return getProfilingAnalyzer().analyze(taskId, timeRanges);
}
+
+ private Process convertProcess(ProcessTraffic traffic) {
+ final Process process = new Process();
+ process.setId(traffic.id());
+ process.setName(traffic.getName());
+ final String serviceId = traffic.getServiceId();
+ process.setServiceId(serviceId);
+
process.setServiceName(IDManager.ServiceID.analysisId(serviceId).getName());
+ final String instanceId = traffic.getInstanceId();
+ process.setInstanceId(instanceId);
+
process.setInstanceName(IDManager.ServiceInstanceID.analysisId(instanceId).getName());
+ process.setLayer(Layer.valueOf(traffic.getLayer()).name());
+ process.setAgentId(traffic.getAgentId());
+
process.setDetectType(ProcessDetectType.valueOf(traffic.getDetectType()).name());
+ if (traffic.getProperties() != null) {
+ for (String key : traffic.getProperties().keySet()) {
+ process.getAttributes().add(new Attribute(key,
traffic.getProperties().get(key).getAsString()));
Review comment:
ignore
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]