You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/04/30 09:31:44 UTC
[skywalking] branch master updated: Add the support eBPF profiling field into the process entity (#8976)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 48a5b8cc59 Add the support eBPF profiling field into the process entity (#8976)
48a5b8cc59 is described below
commit 48a5b8cc5954c52154a1607370b6085573032e49
Author: mrproliu <74...@qq.com>
AuthorDate: Sat Apr 30 17:31:31 2022 +0800
Add the support eBPF profiling field into the process entity (#8976)
---
docs/en/changes/changes.md | 1 +
.../analysis/manual/process/ProcessDispatcher.java | 3 ++
.../analysis/manual/process/ProcessTraffic.java | 18 +++++--
.../profiling/ebpf/EBPFProfilingQueryService.java | 3 +-
.../server/core/query/MetadataQueryService.java | 6 ++-
.../query/enumeration/ProfilingSupportStatus.java | 58 ++++++++++++++++++++++
.../skywalking/oap/server/core/source/Process.java | 4 ++
.../core/storage/query/IMetadataQueryDAO.java | 8 ++-
.../handler/EBPFProcessServiceHandler.java | 17 +++++++
.../handler/EBPFProfilingServiceHandler.java | 4 +-
.../elasticsearch/query/MetadataQueryEsDAO.java | 17 +++++--
.../plugin/influxdb/query/MetadataQuery.java | 17 +++++--
.../plugin/iotdb/query/IoTDBMetadataQueryDAO.java | 22 ++++++--
.../plugin/jdbc/h2/dao/H2MetadataQueryDAO.java | 20 ++++++--
.../cases/profiling/ebpf/expected/process.yml | 2 +
.../cases/rover/process/istio/expected/process.yml | 50 +++++++++++++++++++
.../process/istio/expected/service-instance.yml | 2 +-
.../cases/rover/process/istio/expected/service.yml | 12 +++++
test/e2e-v2/script/env | 2 +-
19 files changed, 233 insertions(+), 33 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 10ec023410..2924c33367 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -32,6 +32,7 @@
* Fix the problem that es index(TimeSeriesTable, eg. endpoint_traffic, alarm_record) didn't create even after rerun with init-mode. This problem caused the OAP server to fail to start when the OAP server was down for more than a day.
* Support autocomplete tags in traces query.
* [Breaking Change] Replace all configurations `**_JETTY_**` to `**_REST_**`.
+* Add the support eBPF profiling field into the process entity.
#### UI
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessDispatcher.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessDispatcher.java
index 5ffb3c7a7b..cef6f0ebff 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessDispatcher.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessDispatcher.java
@@ -43,6 +43,9 @@ public class ProcessDispatcher implements SourceDispatcher<Process> {
traffic.setAgentId(source.getAgentId());
traffic.setProperties(source.getProperties());
+ if (source.getProfilingSupportStatus() != null) {
+ traffic.setProfilingSupportStatus(source.getProfilingSupportStatus().value());
+ }
if (source.getDetectType() != null) {
traffic.setDetectType(source.getDetectType().value());
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessTraffic.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessTraffic.java
index 51cc77aa58..5ab427e7c2 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessTraffic.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessTraffic.java
@@ -57,6 +57,7 @@ public class ProcessTraffic extends Metrics {
public static final String LAST_PING_TIME_BUCKET = "last_ping";
public static final String DETECT_TYPE = "detect_type";
public static final String LABELS_JSON = "labels_json";
+ public static final String PROFILING_SUPPORT_STATUS = "profiling_support_status";
private static final Gson GSON = new Gson();
@@ -109,6 +110,14 @@ public class ProcessTraffic extends Metrics {
@Column(columnName = LABELS_JSON, storageOnly = true, length = 500)
private String labelsJson;
+ /**
+ * Is Support eBPF Profiling, 1 means support, otherwise means not support
+ */
+ @Setter
+ @Getter
+ @Column(columnName = PROFILING_SUPPORT_STATUS)
+ private int profilingSupportStatus;
+
@Override
public boolean combine(Metrics metrics) {
final ProcessTraffic processTraffic = (ProcessTraffic) metrics;
@@ -147,6 +156,7 @@ public class ProcessTraffic extends Metrics {
setLabelsJson(remoteData.getDataStrings(5));
setLastPingTimestamp(remoteData.getDataLongs(0));
setDetectType(remoteData.getDataIntegers(1));
+ setProfilingSupportStatus(remoteData.getDataIntegers(2));
setTimeBucket(remoteData.getDataLongs(1));
}
@@ -166,6 +176,7 @@ public class ProcessTraffic extends Metrics {
builder.addDataStrings(labelsJson);
builder.addDataLongs(lastPingTimestamp);
builder.addDataIntegers(detectType);
+ builder.addDataIntegers(profilingSupportStatus);
builder.addDataLongs(getTimeBucket());
return builder;
}
@@ -194,6 +205,7 @@ public class ProcessTraffic extends Metrics {
processTraffic.setLabelsJson((String) converter.get(LABELS_JSON));
processTraffic.setLastPingTimestamp(((Number) converter.get(LAST_PING_TIME_BUCKET)).longValue());
processTraffic.setDetectType(((Number) converter.get(DETECT_TYPE)).intValue());
+ processTraffic.setProfilingSupportStatus(((Number) converter.get(PROFILING_SUPPORT_STATUS)).intValue());
processTraffic.setTimeBucket(((Number) converter.get(TIME_BUCKET)).longValue());
return processTraffic;
}
@@ -213,6 +225,7 @@ public class ProcessTraffic extends Metrics {
converter.accept(LABELS_JSON, storageData.getLabelsJson());
converter.accept(LAST_PING_TIME_BUCKET, storageData.getLastPingTimestamp());
converter.accept(DETECT_TYPE, storageData.getDetectType());
+ converter.accept(PROFILING_SUPPORT_STATUS, storageData.getProfilingSupportStatus());
converter.accept(TIME_BUCKET, storageData.getTimeBucket());
}
}
@@ -231,9 +244,4 @@ public class ProcessTraffic extends Metrics {
return null;
}
- public static class PropertyUtil {
- public static final String HOST_IP = "host_ip";
- public static final String PID = "pid";
- public static final String COMMAND_LINE = "command_line";
- }
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/ebpf/EBPFProfilingQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/ebpf/EBPFProfilingQueryService.java
index 05008f6005..c6825bf3ef 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/ebpf/EBPFProfilingQueryService.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/ebpf/EBPFProfilingQueryService.java
@@ -30,6 +30,7 @@ import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDete
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
import org.apache.skywalking.oap.server.core.profiling.ebpf.analyze.EBPFProfilingAnalyzer;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.input.Duration;
import org.apache.skywalking.oap.server.core.query.type.Attribute;
import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingAnalyzation;
@@ -154,7 +155,7 @@ public class EBPFProfilingQueryService implements Service {
final long endTimestamp = System.currentTimeMillis();
final long startTimestamp = endTimestamp - TimeUnit.MINUTES.toMillis(10);
final long processesCount = getMetadataQueryDAO().getProcessesCount(serviceId, null, null,
- TimeBucket.getTimeBucket(startTimestamp, DownSampling.Minute),
+ ProfilingSupportStatus.SUPPORT_EBPF_PROFILING, TimeBucket.getTimeBucket(startTimestamp, DownSampling.Minute),
TimeBucket.getTimeBucket(endTimestamp, DownSampling.Minute));
if (processesCount <= 0) {
prepare.setCouldProfiling(false);
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
index 50d95cef83..4ca6009fc6 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java
@@ -32,6 +32,7 @@ import org.apache.skywalking.oap.server.core.analysis.DownSampling;
import org.apache.skywalking.oap.server.core.analysis.IDManager;
import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.input.Duration;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.EndpointInfo;
@@ -103,7 +104,7 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li
}
public List<Process> listProcesses(final Duration duration, final String instanceId) throws IOException {
- return getMetadataQueryDAO().listProcesses(null, instanceId, null,
+ return getMetadataQueryDAO().listProcesses(null, instanceId, null, null,
duration.getStartTimeBucket(), duration.getEndTimeBucket());
}
@@ -121,7 +122,8 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li
final long endTimestamp = System.currentTimeMillis();
final long startTimestamp = endTimestamp - TimeUnit.MINUTES.toMillis(10);
final List<Process> processes = getMetadataQueryDAO().listProcesses(serviceId, null, null,
- TimeBucket.getTimeBucket(startTimestamp, DownSampling.Minute), TimeBucket.getTimeBucket(endTimestamp, DownSampling.Minute));
+ ProfilingSupportStatus.SUPPORT_EBPF_PROFILING, TimeBucket.getTimeBucket(startTimestamp, DownSampling.Minute),
+ TimeBucket.getTimeBucket(endTimestamp, DownSampling.Minute));
return CollectionUtils.isEmpty(processes) ?
0L :
processes.stream().filter(p -> p.getLabels().containsAll(labels)).count();
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/ProfilingSupportStatus.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/ProfilingSupportStatus.java
new file mode 100644
index 0000000000..0eac57e647
--- /dev/null
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/ProfilingSupportStatus.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.core.query.enumeration;
+
+import org.apache.skywalking.oap.server.core.UnexpectedException;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * The status of profiling support
+ */
+public enum ProfilingSupportStatus {
+
+ NOT_SUPPORT(0),
+ SUPPORT_EBPF_PROFILING(1);
+
+ private final int value;
+ private static final Map<Integer, ProfilingSupportStatus> DICTIONARY = new HashMap<>();
+
+ static {
+ Arrays.stream(ProfilingSupportStatus.values()).collect(Collectors.toMap(ProfilingSupportStatus::value, type -> type)).forEach(DICTIONARY::put);
+ }
+
+ ProfilingSupportStatus(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return value;
+ }
+
+ public static ProfilingSupportStatus valueOf(int value) {
+ ProfilingSupportStatus type = DICTIONARY.get(value);
+ if (type == null) {
+ throw new UnexpectedException("Unknown ProfilingSupportStatus value");
+ }
+ return type;
+ }
+}
\ No newline at end of file
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Process.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Process.java
index 4d4224deb0..342ba3d038 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Process.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Process.java
@@ -24,6 +24,7 @@ import lombok.Setter;
import org.apache.skywalking.oap.server.core.analysis.IDManager;
import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDetectType;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import java.util.List;
@@ -78,6 +79,9 @@ public class Process extends Source {
@Setter
@Getter
private List<String> labels;
+ @Setter
+ @Getter
+ private ProfilingSupportStatus profilingSupportStatus;
@Override
public void prepare() {
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
index c9f0a8eac3..1393d08b0a 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java
@@ -20,6 +20,8 @@ package org.apache.skywalking.oap.server.core.storage.query;
import java.io.IOException;
import java.util.List;
+
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.Process;
import org.apache.skywalking.oap.server.core.query.type.Service;
@@ -65,7 +67,8 @@ public interface IMetadataQueryDAO extends DAO {
* @return list of processes matching the given conditions.
*/
List<Process> listProcesses(final String serviceId, final String instanceId, final String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException;
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) throws IOException;
/**
* get the count of processes
@@ -75,7 +78,8 @@ public interface IMetadataQueryDAO extends DAO {
* @return the size of processes
*/
long getProcessesCount(final String serviceId, final String instanceId, final String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException;
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) throws IOException;
/**
* @param processId the id of the process.
diff --git a/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProcessServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProcessServiceHandler.java
index c4e9a96179..343ac8bb83 100644
--- a/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProcessServiceHandler.java
+++ b/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProcessServiceHandler.java
@@ -42,6 +42,7 @@ import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDetectType;
import org.apache.skywalking.oap.server.core.config.NamingControl;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.source.Process;
import org.apache.skywalking.oap.server.core.source.ServiceLabel;
import org.apache.skywalking.oap.server.core.source.ServiceInstanceUpdate;
@@ -53,6 +54,7 @@ import org.apache.skywalking.oap.server.library.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
public class EBPFProcessServiceHandler extends EBPFProcessServiceGrpc.EBPFProcessServiceImplBase implements GRPCHandler {
@@ -160,6 +162,7 @@ public class EBPFProcessServiceHandler extends EBPFProcessServiceGrpc.EBPFProces
}
process.setProperties(properties);
process.setLabels(hostProcess.getEntity().getLabelsList());
+ process.setProfilingSupportStatus(getProfilingSupportStatus(hostProcess.getPropertiesList()));
// timestamp
process.setTimeBucket(
@@ -195,6 +198,7 @@ public class EBPFProcessServiceHandler extends EBPFProcessServiceGrpc.EBPFProces
}
process.setProperties(properties);
process.setLabels(kubernetesProcessMetadata.getEntity().getLabelsList());
+ process.setProfilingSupportStatus(getProfilingSupportStatus(kubernetesProcessMetadata.getPropertiesList()));
// timestamp
process.setTimeBucket(
@@ -228,4 +232,17 @@ public class EBPFProcessServiceHandler extends EBPFProcessServiceGrpc.EBPFProces
sourceReceiver.receive(serviceLabel);
}
}
+
+ /**
+ * Validate the process is support the eBPF profiling
+ */
+ private ProfilingSupportStatus getProfilingSupportStatus(List<KeyStringValuePair> properties) {
+ for (KeyStringValuePair property : properties) {
+ if (Objects.equals(property.getKey(), "support_ebpf_profiling")
+ && Objects.equals(property.getValue(), "true")) {
+ return ProfilingSupportStatus.SUPPORT_EBPF_PROFILING;
+ }
+ }
+ return ProfilingSupportStatus.NOT_SUPPORT;
+ }
}
diff --git a/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProfilingServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProfilingServiceHandler.java
index 18dd278155..00a21043d2 100644
--- a/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProfilingServiceHandler.java
+++ b/oap-server/server-receiver-plugin/skywalking-ebpf-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/ebpf/provider/handler/EBPFProfilingServiceHandler.java
@@ -30,6 +30,7 @@ import org.apache.skywalking.apm.network.ebpf.profiling.v3.EBPFProfilingTaskQuer
import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.command.CommandService;
import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingStackType;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingTask;
import org.apache.skywalking.oap.server.core.query.type.Process;
import org.apache.skywalking.oap.server.core.source.EBPFProfilingData;
@@ -78,7 +79,8 @@ public class EBPFProfilingServiceHandler extends EBPFProfilingServiceGrpc.EBPFPr
final long latestUpdateTime = request.getLatestUpdateTime();
try {
// find exists process from agent
- final List<Process> processes = metadataQueryDAO.listProcesses(null, null, agentId, 0, 0);
+ final List<Process> processes = metadataQueryDAO.listProcesses(null, null, agentId,
+ ProfilingSupportStatus.SUPPORT_EBPF_PROFILING, 0, 0);
if (CollectionUtils.isEmpty(processes)) {
responseObserver.onNext(Commands.newBuilder().build());
responseObserver.onCompleted();
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
index d4d4c3aee6..354b5e8827 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java
@@ -45,6 +45,7 @@ import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDete
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
import org.apache.skywalking.oap.server.core.query.enumeration.Language;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.Attribute;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.Process;
@@ -203,35 +204,38 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
}
@Override
- public List<Process> listProcesses(String serviceId, String instanceId, String agentId,
+ public List<Process> listProcesses(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
final String index =
IndexController.LogicIndicesRegister.getPhysicalTableName(ProcessTraffic.INDEX_NAME);
final BoolQueryBuilder query = Query.bool();
final SearchBuilder search = Search.builder().query(query).size(queryMaxSize);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
final SearchResponse results = getClient().search(index, search.build());
return buildProcesses(results);
}
@Override
- public long getProcessesCount(String serviceId, String instanceId, String agentId,
+ public long getProcessesCount(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
final String index =
IndexController.LogicIndicesRegister.getPhysicalTableName(ProcessTraffic.INDEX_NAME);
final BoolQueryBuilder query = Query.bool();
final SearchBuilder search = Search.builder().query(query).size(0);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
final SearchResponse results = getClient().search(index, search.build());
return results.getHits().getTotal();
}
private void appendProcessWhereQuery(BoolQueryBuilder query, String serviceId, String instanceId, String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) {
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) {
if (StringUtil.isNotEmpty(serviceId)) {
query.must(Query.term(ProcessTraffic.SERVICE_ID, serviceId));
}
@@ -241,6 +245,9 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
if (StringUtil.isNotEmpty(agentId)) {
query.must(Query.term(ProcessTraffic.AGENT_ID, agentId));
}
+ if (profilingSupportStatus != null) {
+ query.must(Query.term(ProcessTraffic.PROFILING_SUPPORT_STATUS, profilingSupportStatus.value()));
+ }
final RangeQueryBuilder rangeQuery = Query.range(ProcessTraffic.LAST_PING_TIME_BUCKET);
if (lastPingStartTimeBucket > 0) {
rangeQuery.gte(lastPingStartTimeBucket);
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
index b90c241e99..3eddf43fd9 100644
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
+++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
@@ -35,6 +35,7 @@ import org.apache.skywalking.oap.server.core.analysis.IDManager;
import org.apache.skywalking.oap.server.core.analysis.Layer;
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDetectType;
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.Process;
import org.apache.skywalking.oap.server.library.util.StringUtil;
import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
@@ -159,22 +160,24 @@ public class MetadataQuery implements IMetadataQueryDAO {
}
@Override
- public List<Process> listProcesses(String serviceId, String instanceId, String agentId,
+ public List<Process> listProcesses(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
final SelectQueryImpl query = select(
ID_COLUMN, NAME, ProcessTraffic.SERVICE_ID, ProcessTraffic.INSTANCE_ID,
ProcessTraffic.LAYER, ProcessTraffic.AGENT_ID, ProcessTraffic.DETECT_TYPE, ProcessTraffic.PROPERTIES,
ProcessTraffic.LABELS_JSON)
.from(client.getDatabase(), ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
return buildProcesses(query);
}
@Override
- public long getProcessesCount(String serviceId, String instanceId, String agentId,
+ public long getProcessesCount(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
final SelectQueryImpl query = select().count(ProcessTraffic.PROPERTIES).from(client.getDatabase(), ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
List<QueryResult.Result> results = client.query(query);
if (log.isDebugEnabled()) {
@@ -186,7 +189,8 @@ public class MetadataQuery implements IMetadataQueryDAO {
}
private void appendProcessWhereQuery(SelectQueryImpl query, String serviceId, String instanceId, String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) {
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) {
final WhereQueryImpl<SelectQueryImpl> whereQuery = query.where();
if (StringUtil.isNotEmpty(serviceId)) {
whereQuery.and(eq(TagName.SERVICE_ID, serviceId));
@@ -203,6 +207,9 @@ public class MetadataQuery implements IMetadataQueryDAO {
if (lastPingEndTimeBucket > 0) {
whereQuery.and(lte(ProcessTraffic.LAST_PING_TIME_BUCKET, lastPingEndTimeBucket));
}
+ if (profilingSupportStatus != null) {
+ whereQuery.and(eq(ProcessTraffic.PROFILING_SUPPORT_STATUS, profilingSupportStatus.value()));
+ }
}
@Override
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java
index 24921211f9..a1ed057240 100644
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java
+++ b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java
@@ -39,6 +39,7 @@ import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDete
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
import org.apache.skywalking.oap.server.core.query.enumeration.Language;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.Attribute;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.Process;
@@ -160,11 +161,13 @@ public class IoTDBMetadataQueryDAO implements IMetadataQueryDAO {
@Override
public List<Process> listProcesses(String serviceId, String instanceId, String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket)
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket)
throws IOException {
StringBuilder query = new StringBuilder();
query.append("select * from ");
- appendProcessFromQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessFromQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
query.append(IoTDBClient.ALIGN_BY_DEVICE);
List<? super StorageData> storageDataList = client.filterQuery(ProcessTraffic.INDEX_NAME,
@@ -174,17 +177,20 @@ public class IoTDBMetadataQueryDAO implements IMetadataQueryDAO {
@Override
public long getProcessesCount(String serviceId, String instanceId, String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) throws IOException {
StringBuilder query = new StringBuilder();
query.append("select count(" + ProcessTraffic.PROPERTIES + ") from ");
- appendProcessFromQuery(query, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessFromQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
final List<Double> results = client.queryWithAgg(query.toString());
return results.size() > 0 ? results.get(0).longValue() : 0;
}
private void appendProcessFromQuery(StringBuilder query, String serviceId, String instanceId, String agentId,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) {
+ final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
+ final long lastPingEndTimeBucket) {
IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProcessTraffic.INDEX_NAME);
Map<String, String> indexAndValueMap = new HashMap<>();
if (StringUtil.isNotEmpty(serviceId)) {
@@ -208,6 +214,12 @@ public class IoTDBMetadataQueryDAO implements IMetadataQueryDAO {
}
where.append(ProcessTraffic.LAST_PING_TIME_BUCKET).append(" <= ").append(lastPingEndTimeBucket);
}
+ if (profilingSupportStatus != null) {
+ if (where.length() > 0) {
+ where.append(" and ");
+ }
+ where.append(ProcessTraffic.PROFILING_SUPPORT_STATUS).append(" = ").append(profilingSupportStatus.value());
+ }
if (where.length() > 0) {
query.append(" where ").append(where);
}
diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
index 1e7df61223..3772bcb58e 100644
--- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
+++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java
@@ -39,6 +39,7 @@ import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDete
import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
import org.apache.skywalking.oap.server.core.query.enumeration.Language;
+import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
import org.apache.skywalking.oap.server.core.query.type.Attribute;
import org.apache.skywalking.oap.server.core.query.type.Endpoint;
import org.apache.skywalking.oap.server.core.query.type.Process;
@@ -232,12 +233,13 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
}
@Override
- public List<Process> listProcesses(String serviceId, String instanceId, String agentId,
+ public List<Process> listProcesses(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
StringBuilder sql = new StringBuilder();
List<Object> condition = new ArrayList<>(3);
sql.append("select * from ").append(ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(sql, condition, serviceId, instanceId, agentId, lastPingStartTimeBucket, lastPingEndTimeBucket);
+ appendProcessWhereQuery(sql, condition, serviceId, instanceId, agentId, profilingSupportStatus,
+ lastPingStartTimeBucket, lastPingEndTimeBucket);
sql.append(" limit ").append(metadataQueryMaxSize);
try (Connection connection = h2Client.getConnection()) {
@@ -251,12 +253,12 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
}
@Override
- public long getProcessesCount(String serviceId, String instanceId, String agentId,
+ public long getProcessesCount(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
StringBuilder sql = new StringBuilder();
List<Object> condition = new ArrayList<>(3);
sql.append("select count(1) total from ").append(ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(sql, condition, serviceId, instanceId, agentId,
+ appendProcessWhereQuery(sql, condition, serviceId, instanceId, agentId, profilingSupportStatus,
lastPingStartTimeBucket, lastPingEndTimeBucket);
try (Connection connection = h2Client.getConnection()) {
@@ -273,7 +275,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
}
private void appendProcessWhereQuery(StringBuilder sql, List<Object> condition, String serviceId, String instanceId,
- String agentId, final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) {
+ String agentId, final ProfilingSupportStatus profilingSupportStatus,
+ final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) {
if (StringUtil.isNotEmpty(serviceId) || StringUtil.isNotEmpty(instanceId) || StringUtil.isNotEmpty(agentId)) {
sql.append(" where ");
}
@@ -296,6 +299,13 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
sql.append(ProcessTraffic.AGENT_ID).append("=?");
condition.add(agentId);
}
+ if (profilingSupportStatus != null) {
+ if (!condition.isEmpty()) {
+ sql.append(" and ");
+ }
+ sql.append(ProcessTraffic.PROFILING_SUPPORT_STATUS).append("=?");
+ condition.add(profilingSupportStatus.value());
+ }
if (lastPingStartTimeBucket > 0) {
if (!condition.isEmpty()) {
sql.append(" and ");
diff --git a/test/e2e-v2/cases/profiling/ebpf/expected/process.yml b/test/e2e-v2/cases/profiling/ebpf/expected/process.yml
index 31fac87881..ce0189bb3d 100644
--- a/test/e2e-v2/cases/profiling/ebpf/expected/process.yml
+++ b/test/e2e-v2/cases/profiling/ebpf/expected/process.yml
@@ -31,6 +31,8 @@
value: {{ notEmpty .value }}
- name: command_line
value: /sqrt
+ - name: support_ebpf_profiling
+ value: "true"
{{- end }}
labels:
{{- contains .labels }}
diff --git a/test/e2e-v2/cases/rover/process/istio/expected/process.yml b/test/e2e-v2/cases/rover/process/istio/expected/process.yml
index c86d7d2310..645b266a82 100644
--- a/test/e2e-v2/cases/rover/process/istio/expected/process.yml
+++ b/test/e2e-v2/cases/rover/process/istio/expected/process.yml
@@ -14,6 +14,30 @@
# limitations under the License.
{{- contains . }}
+- id: {{ notEmpty .id }}
+ name: python
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ instanceid: {{ notEmpty .instanceid }}
+ instancename: {{ notEmpty .instancename }}
+ layer: MESH
+ agentid: {{ notEmpty .agentid }}
+ detecttype: KUBERNETES
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: container_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: "false"
+ {{- end }}
+ labels:
+ - mesh-application
- id: {{ notEmpty .id }}
name: envoy
serviceid: {{ b64enc "default::productpage" }}.1
@@ -33,6 +57,32 @@
value: {{ notEmpty .value }}
- name: command_line
value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: true
+ {{- end }}
+ labels:
+ - mesh-envoy
+- id: {{ notEmpty .id }}
+ name: pilot-agent
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ instanceid: {{ notEmpty .instanceid }}
+ instancename: {{ notEmpty .instancename }}
+ layer: MESH_DP
+ agentid: {{ notEmpty .agentid }}
+ detecttype: KUBERNETES
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: container_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: "false"
{{- end }}
labels:
- mesh-envoy
diff --git a/test/e2e-v2/cases/rover/process/istio/expected/service-instance.yml b/test/e2e-v2/cases/rover/process/istio/expected/service-instance.yml
index b8e3c0f53e..1d6d6bcaf5 100644
--- a/test/e2e-v2/cases/rover/process/istio/expected/service-instance.yml
+++ b/test/e2e-v2/cases/rover/process/istio/expected/service-instance.yml
@@ -19,5 +19,5 @@
attributes: []
language: UNKNOWN
instanceuuid: {{ notEmpty .instanceuuid }}
- layer: MESH_DP
+ layer: {{ notEmpty .layer }}
{{- end }}
diff --git a/test/e2e-v2/cases/rover/process/istio/expected/service.yml b/test/e2e-v2/cases/rover/process/istio/expected/service.yml
index 5aa540b05a..40bbced17c 100644
--- a/test/e2e-v2/cases/rover/process/istio/expected/service.yml
+++ b/test/e2e-v2/cases/rover/process/istio/expected/service.yml
@@ -19,7 +19,10 @@
group: default
shortname: details
layers:
+ {{- contains .layers }}
- MESH_DP
+ - MESH
+ {{- end }}
normal: true
- id: {{ b64enc "istio-system::istio-ingressgateway" }}.1
name: istio-system::istio-ingressgateway
@@ -33,21 +36,30 @@
group: default
shortname: productpage
layers:
+ {{- contains .layers }}
- MESH_DP
+ - MESH
+ {{- end }}
normal: true
- id: {{ b64enc "default::ratings" }}.1
name: default::ratings
group: default
shortname: ratings
layers:
+ {{- contains .layers }}
- MESH_DP
+ - MESH
+ {{- end }}
normal: true
- id: {{ b64enc "default::reviews" }}.1
name: default::reviews
group: default
shortname: reviews
layers:
+ {{- contains .layers }}
- MESH_DP
+ - MESH
+ {{- end }}
normal: true
- id: {{ b64enc "istio-system::istio-egressgateway" }}.1
name: istio-system::istio-egressgateway
diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env
index d2868f37af..bf53f179d9 100644
--- a/test/e2e-v2/script/env
+++ b/test/e2e-v2/script/env
@@ -22,6 +22,6 @@ SW_AGENT_PYTHON_COMMIT=c76a6ec51a478ac91abb20ec8f22a99b8d4d6a58
SW_AGENT_CLIENT_JS_COMMIT=af0565a67d382b683c1dbd94c379b7080db61449
SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-SW_ROVER_COMMIT=de66f0e0d10ba4d40137ec4c5475ae97931b4056
+SW_ROVER_COMMIT=00b5150ec70197af13a9e5f1ffc203d433dc886b
SW_CTL_COMMIT=9ad35d097e8966ac9324f1d570b1a2d264b38ca1