You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/03/22 03:40:43 UTC
[GitHub] [skywalking] sonatype-lift[bot] commented on a change in pull request #8716: Update the eBPF profiling schedule entity
sonatype-lift[bot] commented on a change in pull request #8716:
URL: https://github.com/apache/skywalking/pull/8716#discussion_r831742228
##########
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:
*NULL_DEREFERENCE:* object returned by `getAttributes(process)` could be null and is dereferenced at line 169.
(at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org