This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 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 c9a959e50e Adapt the new metadata standardization in Istio 1.24 
(#12768)
c9a959e50e is described below

commit c9a959e50e27f0c22e8366994e6940376386bb9e
Author: kezhenxu94 <[email protected]>
AuthorDate: Wed Nov 13 14:41:51 2024 +0800

    Adapt the new metadata standardization in Istio 1.24 (#12768)
---
 .github/workflows/skywalking.yaml                  |  47 ++++++----
 docker/oap/log4j2.xml                              |   2 +-
 docs/en/changes/changes.md                         |   1 +
 .../oap/server/library/util/FieldsHelper.java      |   7 +-
 .../envoy/als/mx/MetaExchangeALSHTTPAnalyzer.java  | 103 ++++++++++++++++++---
 .../envoy/als/mx/ServiceMetaInfoAdapter.java       |  16 +++-
 .../tcp/mx/MetaExchangeTCPAccessLogAnalyzer.java   |  77 +++++++++++++--
 .../test/resources/metadata-service-mapping.yaml   |   2 +-
 .../cilium-rules/metadata-service-mapping.yaml     |   2 +-
 .../main/resources/metadata-service-mapping.yaml   |   2 +-
 test/e2e-v2/cases/cilium/traffic-gen.yaml          |  13 ++-
 .../e2e-v2/cases/istio/kind.k28.yaml               |   7 +-
 test/e2e-v2/cases/istio/log4j2.xml                 |   2 +-
 test/e2e-v2/cases/istio/traffic-gen.yaml           |  13 ++-
 test/e2e-v2/cases/istio/values.yaml                |   2 +-
 .../profiling/ebpf/access_log/traffic-gen.yaml     |  12 ++-
 16 files changed, 247 insertions(+), 61 deletions(-)

diff --git a/.github/workflows/skywalking.yaml 
b/.github/workflows/skywalking.yaml
index 855a3e3c17..8edb000dc0 100644
--- a/.github/workflows/skywalking.yaml
+++ b/.github/workflows/skywalking.yaml
@@ -555,26 +555,31 @@ jobs:
           - name: Kafka Log
             config: test/e2e-v2/cases/kafka/log/e2e.yaml
 
-          - name: Istio Metrics Service 1.15.0
+          - name: Istio Metrics Service 1.20.0
             config: test/e2e-v2/cases/istio/metrics/e2e.yaml
             env: |
-              ISTIO_VERSION=1.15.0
-              KUBERNETES_VERSION=25
-          - name: Istio Metrics Service 1.16.0
+              ISTIO_VERSION=1.20.0
+              KUBERNETES_VERSION=28
+          - name: Istio Metrics Service 1.21.0
             config: test/e2e-v2/cases/istio/metrics/e2e.yaml
             env: |
-              ISTIO_VERSION=1.16.0
-              KUBERNETES_VERSION=25
-          - name: Istio Metrics Service 1.17.0
+              ISTIO_VERSION=1.21.0
+              KUBERNETES_VERSION=28
+          - name: Istio Metrics Service 1.22.0
             config: test/e2e-v2/cases/istio/metrics/e2e.yaml
             env: |
-              ISTIO_VERSION=1.17.0
-              KUBERNETES_VERSION=25
-          - name: Istio Metrics Service 1.18.0
+              ISTIO_VERSION=1.22.0
+              KUBERNETES_VERSION=28
+          - name: Istio Metrics Service 1.23.0
             config: test/e2e-v2/cases/istio/metrics/e2e.yaml
             env: |
-              ISTIO_VERSION=1.18.0
-              KUBERNETES_VERSION=25
+              ISTIO_VERSION=1.23.0
+              KUBERNETES_VERSION=28
+          - name: Istio Metrics Service 1.24.0
+            config: test/e2e-v2/cases/istio/metrics/e2e.yaml
+            env: |
+              ISTIO_VERSION=1.24.0
+              KUBERNETES_VERSION=28
 
           - name: Rover with Istio Process 1.15.0
             config: test/e2e-v2/cases/rover/process/istio/e2e.yaml
@@ -769,14 +774,16 @@ jobs:
       matrix:
         analyzer: [k8s-mesh, mx-mesh]
         versions:
-          - istio: 1.15.0
-            kubernetes: 25
-          - istio: 1.16.0
-            kubernetes: 25
-          - istio: 1.17.0
-            kubernetes: 25
-          - istio: 1.18.0
-            kubernetes: 25
+          - istio: 1.20.0
+            kubernetes: 28
+          - istio: 1.21.0
+            kubernetes: 28
+          - istio: 1.22.0
+            kubernetes: 28
+          - istio: 1.23.0
+            kubernetes: 28
+          - istio: 1.24.0
+            kubernetes: 28
 
     steps:
       - uses: actions/checkout@v3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index 6152fc75c2..e5869e2914 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -28,7 +28,7 @@
         </Console>
     </Appenders>
     <Loggers>
-        <Root level="INFO">
+        <Root level="DEBUG">
             <AppenderRef ref="Console"/>
         </Root>
     </Loggers>
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 0617ec035e..77b1ffb9dc 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -19,6 +19,7 @@
 * Add max query size settings to BanyanDB.
 * Fix "BanyanDBTraceQueryDAO.queryBasicTraces" doesn't support querying by 
"trace_id".
 * Polish mesh data dispatcher: don't generate Instance/Endpoint metrics if 
they are empty.
+* Adapt the new metadata standardization in Istio 1.24.
 
 #### UI
 
diff --git 
a/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/FieldsHelper.java
 
b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/FieldsHelper.java
index d5dcf38252..48fd9aabbf 100644
--- 
a/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/FieldsHelper.java
+++ 
b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/FieldsHelper.java
@@ -38,6 +38,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.BiConsumer;
 import java.util.regex.Matcher;
@@ -166,7 +167,7 @@ public class FieldsHelper {
     public void inflate(final Struct metadata, final Object target) {
         final Value empty = Value.newBuilder().setStringValue("-").build();
         final Value root = Value.newBuilder().setStructValue(metadata).build();
-        for (final Map.Entry<String, FieldFormat> entry : 
fieldNameMapping.entrySet()) {
+        for (final var entry : fieldNameMapping.entrySet()) {
             final FieldFormat fieldFormat = entry.getValue();
             final Object[] values = new String[fieldFormat.properties.size()];
             for (int i = 0; i < fieldFormat.properties.size(); i++) {
@@ -175,7 +176,9 @@ public class FieldsHelper {
                 for (final Field field : property) {
                     Value value = root;
                     for (final String segment : field.dsvSegments) {
-                        value = 
value.getStructValue().getFieldsOrDefault(segment, empty);
+                        final var fieldMaps = new TreeMap<String, 
Value>(String.CASE_INSENSITIVE_ORDER);
+                        
fieldMaps.putAll(value.getStructValue().getFieldsMap());
+                        value = fieldMaps.getOrDefault(segment, empty);
                     }
                     if (Strings.isNullOrEmpty(value.getStringValue()) || 
"-".equals(value.getStringValue())) {
                         continue;
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/MetaExchangeALSHTTPAnalyzer.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/MetaExchangeALSHTTPAnalyzer.java
index c8b03e112e..e8ad193c65 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/MetaExchangeALSHTTPAnalyzer.java
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/MetaExchangeALSHTTPAnalyzer.java
@@ -18,24 +18,30 @@
 
 package org.apache.skywalking.oap.server.receiver.envoy.als.mx;
 
-import com.google.protobuf.Any;
-import com.google.protobuf.TextFormat;
-import io.envoyproxy.envoy.data.accesslog.v3.HTTPAccessLogEntry;
-import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsMessage;
-import lombok.extern.slf4j.Slf4j;
+import static org.apache.skywalking.oap.server.core.Const.TLS_MODE.NON_TLS;
+
+import java.util.Base64;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.skywalking.apm.network.servicemesh.v3.HTTPServiceMeshMetric;
+import 
org.apache.skywalking.apm.network.servicemesh.v3.HTTPServiceMeshMetrics.Builder;
 import org.apache.skywalking.oap.server.library.module.ModuleManager;
 import org.apache.skywalking.oap.server.library.module.ModuleStartException;
 import org.apache.skywalking.oap.server.library.util.FieldsHelper;
 import 
org.apache.skywalking.oap.server.receiver.envoy.EnvoyMetricReceiverConfig;
 import org.apache.skywalking.oap.server.receiver.envoy.als.AbstractALSAnalyzer;
+import 
org.apache.skywalking.oap.server.receiver.envoy.als.AccessLogAnalyzer.Result.ResultBuilder;
 import org.apache.skywalking.oap.server.receiver.envoy.als.Role;
 import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo;
 
-import java.util.Base64;
-import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.protobuf.Any;
+import com.google.protobuf.Struct;
+import com.google.protobuf.TextFormat;
 
-import static org.apache.skywalking.oap.server.core.Const.TLS_MODE.NON_TLS;
+import io.envoyproxy.envoy.data.accesslog.v3.HTTPAccessLogEntry;
+import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsMessage;
+import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class MetaExchangeALSHTTPAnalyzer extends AbstractALSAnalyzer {
@@ -44,6 +50,10 @@ public class MetaExchangeALSHTTPAnalyzer extends 
AbstractALSAnalyzer {
 
     public static final String DOWNSTREAM_KEY = "wasm.downstream_peer";
 
+    public static final String UPSTREAM_PEER = "upstream_peer";
+
+    public static final String DOWNSTREAM_PEER = "downstream_peer";
+
     protected String fieldMappingFile = "metadata-service-mapping.yaml";
 
     protected EnvoyMetricReceiverConfig config;
@@ -86,6 +96,9 @@ public class MetaExchangeALSHTTPAnalyzer extends 
AbstractALSAnalyzer {
         final var properties = entry.getCommonProperties();
         final var stateMap = properties.getFilterStateObjectsMap();
         final var result = previousResult.toBuilder();
+        if (log.isDebugEnabled()) {
+            log.debug("Filter state object map: {}", stateMap);
+        }
         if (stateMap.isEmpty()) {
             return result.service(currSvc).build();
         }
@@ -93,6 +106,24 @@ public class MetaExchangeALSHTTPAnalyzer extends 
AbstractALSAnalyzer {
         final var previousMetrics = previousResult.getMetrics();
         final var httpMetrics = previousMetrics.getHttpMetricsBuilder();
         final var downstreamExists = new AtomicBoolean();
+        parseFilterObject(previousResult, entry, role, currSvc, stateMap, 
result, httpMetrics, downstreamExists);
+        parseFilterObjectPrior124(previousResult, entry, role, currSvc, 
stateMap, result, httpMetrics, downstreamExists);
+        if (role.equals(Role.PROXY) && !downstreamExists.get()) {
+            final var metric = newAdapter(entry, 
config.serviceMetaInfoFactory().unknown(), currSvc).adaptToDownstreamMetrics();
+            if (log.isDebugEnabled()) {
+                log.debug("Transformed a {} inbound mesh metric {}", role, 
TextFormat.shortDebugString(metric));
+            }
+            httpMetrics.addMetrics(metric);
+            result.hasDownstreamMetrics(true);
+        }
+        return 
result.metrics(previousMetrics.setHttpMetrics(httpMetrics)).service(currSvc).build();
+    }
+
+    // TODO: remove this when 1.24.0 is our minimum supported version.
+    @Deprecated(forRemoval = true)
+    private void parseFilterObjectPrior124(final Result previousResult, final 
HTTPAccessLogEntry entry, final Role role,
+            final ServiceMetaInfo currSvc, final Map<String, Any> stateMap, 
final ResultBuilder result,
+            final Builder httpMetrics, final AtomicBoolean downstreamExists) {
         stateMap.forEach((key, value) -> {
             if (!key.equals(UPSTREAM_KEY) && !key.equals(DOWNSTREAM_KEY)) {
                 return;
@@ -131,21 +162,63 @@ public class MetaExchangeALSHTTPAnalyzer extends 
AbstractALSAnalyzer {
                     break;
             }
         });
-        if (role.equals(Role.PROXY) && !downstreamExists.get()) {
-            final var metric = newAdapter(entry, 
config.serviceMetaInfoFactory().unknown(), currSvc).adaptToDownstreamMetrics();
+    }
+
+    private void parseFilterObject(final Result previousResult, final 
HTTPAccessLogEntry entry, final Role role,
+            final ServiceMetaInfo currSvc, final Map<String, Any> stateMap, 
final ResultBuilder result,
+            final Builder httpMetrics, final AtomicBoolean downstreamExists) {
+        stateMap.forEach((key, value) -> {
+            if (!key.equals(UPSTREAM_PEER) && !key.equals(DOWNSTREAM_PEER)) {
+                return;
+            }
             if (log.isDebugEnabled()) {
-                log.debug("Transformed a {} inbound mesh metric {}", role, 
TextFormat.shortDebugString(metric));
+                log.debug("Filter state object key: {}, value: {}", key, 
value);
             }
-            httpMetrics.addMetrics(metric);
-            result.hasDownstreamMetrics(true);
-        }
-        return 
result.metrics(previousMetrics.setHttpMetrics(httpMetrics)).service(currSvc).build();
+            final ServiceMetaInfo svc;
+            try {
+                log.debug("Filter state object value map: {}", 
value.unpack(Struct.class).getFieldsMap());
+                svc = adaptToServiceMetaInfo(value.unpack(Struct.class));
+            } catch (Exception e) {
+                log.error("Fail to parse metadata {} to FlatNode", 
Base64.getEncoder().encode(value.toByteArray()));
+                return;
+            }
+            final HTTPServiceMeshMetric.Builder metrics;
+            switch (key) {
+                case UPSTREAM_PEER:
+                    if (previousResult.hasUpstreamMetrics()) {
+                        break;
+                    }
+                    metrics = newAdapter(entry, currSvc, 
svc).adaptToUpstreamMetrics().setTlsMode(NON_TLS);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Transformed a {} outbound mesh metrics {}", 
role, TextFormat.shortDebugString(metrics));
+                    }
+                    httpMetrics.addMetrics(metrics);
+                    result.hasUpstreamMetrics(true);
+                    break;
+                case DOWNSTREAM_PEER:
+                    if (previousResult.hasDownstreamMetrics()) {
+                        break;
+                    }
+                    metrics = newAdapter(entry, svc, 
currSvc).adaptToDownstreamMetrics();
+                    if (log.isDebugEnabled()) {
+                        log.debug("Transformed a {} inbound mesh metrics {}", 
role, TextFormat.shortDebugString(metrics));
+                    }
+                    httpMetrics.addMetrics(metrics);
+                    downstreamExists.set(true);
+                    result.hasDownstreamMetrics(true);
+                    break;
+            }
+        });
     }
 
     protected ServiceMetaInfo adaptToServiceMetaInfo(final Any value) throws 
Exception {
         return new ServiceMetaInfoAdapter(value);
     }
 
+    protected ServiceMetaInfo adaptToServiceMetaInfo(final Struct struct) 
throws Exception {
+        return config.serviceMetaInfoFactory().fromStruct(struct);
+    }
+
     protected ServiceMetaInfo adaptToServiceMetaInfo(final 
StreamAccessLogsMessage.Identifier identifier) throws Exception {
         return 
config.serviceMetaInfoFactory().fromStruct(identifier.getNode().getMetadata());
     }
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/ServiceMetaInfoAdapter.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/ServiceMetaInfoAdapter.java
index 902b78a6ca..c3d4184daf 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/ServiceMetaInfoAdapter.java
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/mx/ServiceMetaInfoAdapter.java
@@ -29,6 +29,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -65,6 +66,9 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo {
         }
 
         final Struct metadata = 
requireNonNull(extractStructFromNodeFlatBuffer(flatNode));
+        if (log.isDebugEnabled()) {
+            log.debug("Node metadata: {}", metadata);
+        }
         
FieldsHelper.forClass(this.getClass().getSuperclass()).inflate(metadata, this);
         appendTags(metadata);
     }
@@ -111,10 +115,17 @@ public class ServiceMetaInfoAdapter extends 
ServiceMetaInfo {
     public ServiceMetaInfoAdapter(final Struct metadata) {
         
FieldsHelper.forClass(this.getClass().getSuperclass()).inflate(requireNonNull(metadata),
 this);
         appendTags(requireNonNull(metadata));
+        if (log.isDebugEnabled()) {
+            log.info("Metadata is converted to: {}", this);
+        }
     }
 
     private void appendTags(Struct metadata) {
-        final Map<String, Value> fieldsMap = metadata.getFieldsMap();
+        final Map<String, Value> fieldsMap = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+        fieldsMap.putAll(metadata.getFieldsMap());
+        if (log.isDebugEnabled()) {
+            log.debug("Metadata field map: {}", fieldsMap);
+        }
         final List<KeyValue> tags = new ArrayList<>();
         if (fieldsMap.containsKey("NAME")) {
             tags.add(new KeyValue("pod", 
fieldsMap.get("NAME").getStringValue()));
@@ -122,6 +133,9 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo 
{
         if (fieldsMap.containsKey("NAMESPACE")) {
             tags.add(new KeyValue("namespace", 
fieldsMap.get("NAMESPACE").getStringValue()));
         }
+        if (log.isDebugEnabled()) {
+            log.debug("Converted tags: {}", tags);
+        }
         if (!tags.isEmpty()) {
             this.setTags(tags);
         }
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/tcp/mx/MetaExchangeTCPAccessLogAnalyzer.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/tcp/mx/MetaExchangeTCPAccessLogAnalyzer.java
index 5d2e678352..469f49e507 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/tcp/mx/MetaExchangeTCPAccessLogAnalyzer.java
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/tcp/mx/MetaExchangeTCPAccessLogAnalyzer.java
@@ -19,16 +19,19 @@
 package org.apache.skywalking.oap.server.receiver.envoy.als.tcp.mx;
 
 import com.google.protobuf.Any;
+import com.google.protobuf.Struct;
 import com.google.protobuf.TextFormat;
 import io.envoyproxy.envoy.data.accesslog.v3.AccessLogCommon;
 import io.envoyproxy.envoy.data.accesslog.v3.TCPAccessLogEntry;
 import io.envoyproxy.envoy.service.accesslog.v3.StreamAccessLogsMessage;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.skywalking.apm.network.servicemesh.v3.TCPServiceMeshMetric;
+import 
org.apache.skywalking.apm.network.servicemesh.v3.TCPServiceMeshMetrics.Builder;
 import org.apache.skywalking.oap.server.library.module.ModuleManager;
 import org.apache.skywalking.oap.server.library.module.ModuleStartException;
 import org.apache.skywalking.oap.server.library.util.FieldsHelper;
 import 
org.apache.skywalking.oap.server.receiver.envoy.EnvoyMetricReceiverConfig;
+import 
org.apache.skywalking.oap.server.receiver.envoy.als.AccessLogAnalyzer.Result.ResultBuilder;
 import org.apache.skywalking.oap.server.receiver.envoy.als.Role;
 import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo;
 import 
org.apache.skywalking.oap.server.receiver.envoy.als.mx.ServiceMetaInfoAdapter;
@@ -40,7 +43,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import static org.apache.skywalking.oap.server.core.Const.TLS_MODE.NON_TLS;
 import static 
org.apache.skywalking.oap.server.receiver.envoy.als.mx.MetaExchangeALSHTTPAnalyzer.DOWNSTREAM_KEY;
+import static 
org.apache.skywalking.oap.server.receiver.envoy.als.mx.MetaExchangeALSHTTPAnalyzer.DOWNSTREAM_PEER;
 import static 
org.apache.skywalking.oap.server.receiver.envoy.als.mx.MetaExchangeALSHTTPAnalyzer.UPSTREAM_KEY;
+import static 
org.apache.skywalking.oap.server.receiver.envoy.als.mx.MetaExchangeALSHTTPAnalyzer.UPSTREAM_PEER;
 
 @Slf4j
 public class MetaExchangeTCPAccessLogAnalyzer extends 
AbstractTCPAccessLogAnalyzer {
@@ -93,6 +98,23 @@ public class MetaExchangeTCPAccessLogAnalyzer extends 
AbstractTCPAccessLogAnalyz
 
         final var tcpMetrics = previousMetrics.getTcpMetricsBuilder();
         final var downstreamExists = new AtomicBoolean();
+        parseFilterObject(previousResult, entry, role, currSvc, stateMap, 
newResult, tcpMetrics, downstreamExists);
+        parseFilterObjectPrior124(previousResult, entry, role, currSvc, 
stateMap, newResult, tcpMetrics, downstreamExists);
+        if (role.equals(Role.PROXY) && !downstreamExists.get()) {
+            final TCPServiceMeshMetric.Builder metric = newAdapter(entry, 
config.serviceMetaInfoFactory().unknown(), currSvc).adaptToDownstreamMetrics();
+            if (log.isDebugEnabled()) {
+                log.debug("Transformed a {} inbound mesh metric {}", role, 
TextFormat.shortDebugString(metric));
+            }
+            tcpMetrics.addMetrics(metric);
+        }
+        return 
newResult.metrics(previousMetrics.setTcpMetrics(tcpMetrics)).service(currSvc).build();
+    }
+
+    // TODO: remove this when 1.24.0 is our minimum supported version.
+    @Deprecated(forRemoval = true)
+    private void parseFilterObjectPrior124(final Result previousResult, final 
TCPAccessLogEntry entry, final Role role,
+            final ServiceMetaInfo currSvc, final Map<String, Any> stateMap, 
final ResultBuilder newResult,
+            final Builder tcpMetrics, final AtomicBoolean downstreamExists) {
         stateMap.forEach((key, value) -> {
             if (!key.equals(UPSTREAM_KEY) && !key.equals(DOWNSTREAM_KEY)) {
                 return;
@@ -131,20 +153,63 @@ public class MetaExchangeTCPAccessLogAnalyzer extends 
AbstractTCPAccessLogAnalyz
                     break;
             }
         });
-        if (role.equals(Role.PROXY) && !downstreamExists.get()) {
-            final TCPServiceMeshMetric.Builder metric = newAdapter(entry, 
config.serviceMetaInfoFactory().unknown(), currSvc).adaptToDownstreamMetrics();
+    }
+
+    private void parseFilterObject(final Result previousResult, final 
TCPAccessLogEntry entry, final Role role,
+            final ServiceMetaInfo currSvc, final Map<String, Any> stateMap, 
final ResultBuilder newResult,
+            final Builder tcpMetrics, final AtomicBoolean downstreamExists) {
+        stateMap.forEach((key, value) -> {
+            if (!key.equals(UPSTREAM_PEER) && !key.equals(DOWNSTREAM_PEER)) {
+                return;
+            }
             if (log.isDebugEnabled()) {
-                log.debug("Transformed a {} inbound mesh metric {}", role, 
TextFormat.shortDebugString(metric));
+                log.debug("Filter state object key: {}, value: {}", key, 
value);
             }
-            tcpMetrics.addMetrics(metric);
-        }
-        return 
newResult.metrics(previousMetrics.setTcpMetrics(tcpMetrics)).service(currSvc).build();
+            final ServiceMetaInfo svc;
+            try {
+                log.debug("Filter state object value map: {}", 
value.unpack(Struct.class).getFieldsMap());
+                svc = adaptToServiceMetaInfo(value.unpack(Struct.class));
+            } catch (Exception e) {
+                log.error("Fail to parse metadata {} to FlatNode", 
Base64.getEncoder().encode(value.toByteArray()));
+                return;
+            }
+            final TCPServiceMeshMetric.Builder metrics;
+            switch (key) {
+                case UPSTREAM_PEER:
+                    if (previousResult.hasUpstreamMetrics()) {
+                        break;
+                    }
+                    metrics = newAdapter(entry, currSvc, 
svc).adaptToUpstreamMetrics().setTlsMode(NON_TLS);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Transformed a {} outbound mesh metrics {}", 
role, TextFormat.shortDebugString(metrics));
+                    }
+                    tcpMetrics.addMetrics(metrics);
+                    newResult.hasUpstreamMetrics(true);
+                    break;
+                case DOWNSTREAM_PEER:
+                    if (previousResult.hasDownstreamMetrics()) {
+                        break;
+                    }
+                    metrics = newAdapter(entry, svc, 
currSvc).adaptToDownstreamMetrics();
+                    if (log.isDebugEnabled()) {
+                        log.debug("Transformed a {} inbound mesh metrics {}", 
role, TextFormat.shortDebugString(metrics));
+                    }
+                    tcpMetrics.addMetrics(metrics);
+                    downstreamExists.set(true);
+                    newResult.hasDownstreamMetrics(true);
+                    break;
+            }
+        });
     }
 
     protected ServiceMetaInfo adaptToServiceMetaInfo(final Any value) throws 
Exception {
         return new ServiceMetaInfoAdapter(value);
     }
 
+    protected ServiceMetaInfo adaptToServiceMetaInfo(final Struct struct) 
throws Exception {
+        return config.serviceMetaInfoFactory().fromStruct(struct);
+    }
+
     protected ServiceMetaInfo adaptToServiceMetaInfo(final 
StreamAccessLogsMessage.Identifier identifier) throws Exception {
         return 
config.serviceMetaInfoFactory().fromStruct(identifier.getNode().getMetadata());
     }
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/resources/metadata-service-mapping.yaml
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/resources/metadata-service-mapping.yaml
index acb4d430a3..40461718dd 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/resources/metadata-service-mapping.yaml
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/resources/metadata-service-mapping.yaml
@@ -13,5 +13,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-serviceName: 
${LABELS."service.istio.io/canonical-revision"}.${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.app}.${NAMESPACE}
+serviceName: 
${LABELS."service.istio.io/canonical-revision",REVISION}.${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.app,SERVICE}.${NAMESPACE}
 serviceInstanceName: ${NAME}
diff --git 
a/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
 
b/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
index 6246e987fc..a201089f37 100644
--- 
a/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
+++ 
b/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
@@ -13,5 +13,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-serviceName: 
${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.component,LABELS.app,LABELS.k8s-app}.${NAMESPACE}
+serviceName: 
${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.component,LABELS.app,LABELS.k8s-app,SERVICE}.${NAMESPACE}
 serviceInstanceName: ${NAME}
diff --git 
a/oap-server/server-starter/src/main/resources/metadata-service-mapping.yaml 
b/oap-server/server-starter/src/main/resources/metadata-service-mapping.yaml
index cf9522b150..93b324948e 100644
--- a/oap-server/server-starter/src/main/resources/metadata-service-mapping.yaml
+++ b/oap-server/server-starter/src/main/resources/metadata-service-mapping.yaml
@@ -13,5 +13,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-serviceName: 
${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.app,LABELS.k8s-app}.${NAMESPACE}
+serviceName: 
${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.app,LABELS.k8s-app,SERVICE}.${NAMESPACE}
 serviceInstanceName: ${NAME}
diff --git a/test/e2e-v2/cases/cilium/traffic-gen.yaml 
b/test/e2e-v2/cases/cilium/traffic-gen.yaml
index 4e3b050216..590ff4d98f 100644
--- a/test/e2e-v2/cases/cilium/traffic-gen.yaml
+++ b/test/e2e-v2/cases/cilium/traffic-gen.yaml
@@ -33,8 +33,15 @@ spec:
     spec:
       containers:
         - name: trafficgenerator
-          image: elswork/wrk
-          command: ["wrk", "-t1", "-c1", "-d20m", 
"http://productpage:9080/productpage";]
+          image: alpine/curl:8.9.1
+          command: ["/bin/sh", "-c", "--"]
+          args:
+            - |
+              while true; do
+                curl -s -o /dev/null -w "%{http_code}\n" 
http://productpage:9080/productpage
+                sleep 1
+              done
           resources:
             requests:
-              cpu: 0.1
\ No newline at end of file
+              cpu: 0.1
+
diff --git 
a/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
 b/test/e2e-v2/cases/istio/kind.k28.yaml
similarity index 80%
copy from 
oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
copy to test/e2e-v2/cases/istio/kind.k28.yaml
index 6246e987fc..6bb82dfce8 100644
--- 
a/oap-server/server-starter/src/main/resources/cilium-rules/metadata-service-mapping.yaml
+++ b/test/e2e-v2/cases/istio/kind.k28.yaml
@@ -13,5 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-serviceName: 
${LABELS."service.istio.io/canonical-name",LABELS."app.kubernetes.io/name",LABELS.component,LABELS.app,LABELS.k8s-app}.${NAMESPACE}
-serviceInstanceName: ${NAME}
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+  - role: control-plane
+    image: 
kindest/node:v1.28.15@sha256:a7c05c7ae043a0b8c818f5a06188bc2c4098f6cb59ca7d1856df00375d839251
diff --git a/test/e2e-v2/cases/istio/log4j2.xml 
b/test/e2e-v2/cases/istio/log4j2.xml
index 9e132a8d8b..2565d7f70a 100644
--- a/test/e2e-v2/cases/istio/log4j2.xml
+++ b/test/e2e-v2/cases/istio/log4j2.xml
@@ -34,7 +34,7 @@
         <logger 
name="org.apache.skywalking.oap.server.storage.plugin.elasticsearch" 
level="DEBUG"/>
         <logger name="org.apache.skywalking.oap.server.core.storage.ttl" 
level="DEBUG"/>
         <logger name="org.apache.skywalking.library.elasticsearch" 
level="DEBUG"/>
-        <Root level="INFO">
+        <Root level="DEBUG">
             <AppenderRef ref="Console"/>
         </Root>
     </Loggers>
diff --git a/test/e2e-v2/cases/istio/traffic-gen.yaml 
b/test/e2e-v2/cases/istio/traffic-gen.yaml
index 549bcfde65..0b365ce2eb 100644
--- a/test/e2e-v2/cases/istio/traffic-gen.yaml
+++ b/test/e2e-v2/cases/istio/traffic-gen.yaml
@@ -33,8 +33,15 @@ spec:
     spec:
       containers:
         - name: trafficgenerator
-          image: williamyeh/wrk
-          command: ["wrk", "-t1", "-c1", "-d20m", 
"http://istio-ingressgateway.istio-system:80/productpage";]
+          image: alpine/curl:8.9.1
+          command: ["/bin/sh", "-c", "--"]
+          args:
+            - |
+              while true; do
+                curl -s -o /dev/null -w "%{http_code}\n" 
http://istio-ingressgateway.istio-system:80/productpage
+                sleep 1
+              done
           resources:
             requests:
-              cpu: 0.1
\ No newline at end of file
+              cpu: 0.1
+
diff --git a/test/e2e-v2/cases/istio/values.yaml 
b/test/e2e-v2/cases/istio/values.yaml
index 8b42ad4765..27426bbd75 100644
--- a/test/e2e-v2/cases/istio/values.yaml
+++ b/test/e2e-v2/cases/istio/values.yaml
@@ -16,7 +16,7 @@
 oap:
   config:
     metadata-service-mapping.yaml: |
-      serviceName: e2e::${LABELS."service.istio.io/canonical-name"}
+      serviceName: e2e::${LABELS."service.istio.io/canonical-name",SERVICE}
       serviceInstanceName: ${NAME}
 
 elasticsearch:
diff --git a/test/e2e-v2/cases/profiling/ebpf/access_log/traffic-gen.yaml 
b/test/e2e-v2/cases/profiling/ebpf/access_log/traffic-gen.yaml
index 4e3b050216..a1d08fef93 100644
--- a/test/e2e-v2/cases/profiling/ebpf/access_log/traffic-gen.yaml
+++ b/test/e2e-v2/cases/profiling/ebpf/access_log/traffic-gen.yaml
@@ -33,8 +33,14 @@ spec:
     spec:
       containers:
         - name: trafficgenerator
-          image: elswork/wrk
-          command: ["wrk", "-t1", "-c1", "-d20m", 
"http://productpage:9080/productpage";]
+          image: alpine/curl:8.9.1
+          command: ["/bin/sh", "-c", "--"]
+          args:
+            - |
+              while true; do
+                curl -s -o /dev/null -w "%{http_code}\n" 
http://productpage:9080/productpage
+                sleep 1
+              done
           resources:
             requests:
-              cpu: 0.1
\ No newline at end of file
+              cpu: 0.1

Reply via email to