diff --git a/.github/workflows/ci-it.yaml b/.github/workflows/ci-it.yaml index 976ed85cd30abd665f227de173d9d5f76fa22aee..8e137e8e92d6e8fb3b41613f1b60ea2f4f8eab18 100644 --- a/.github/workflows/ci-it.yaml +++ b/.github/workflows/ci-it.yaml @@ -18,9 +18,8 @@ name: CI AND IT on: pull_request: - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: MAVEN_OPTS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit diff --git a/.github/workflows/docker-ci.yaml b/.github/workflows/docker-ci.yaml index 60834cd198df54b5af9b96718dbca670175a4069..1d2bd248691cc2bad8a7b5e6288e074ad1b4aac6 100644 --- a/.github/workflows/docker-ci.yaml +++ b/.github/workflows/docker-ci.yaml @@ -21,6 +21,8 @@ on: paths: - '**' - '!**.md' + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.cluster.yaml b/.github/workflows/e2e.cluster.yaml index 0b895096f6351a8babaeb227126e62a148f10560..282ca2597142d36139c4d9c94908ea291be1cbbe 100644 --- a/.github/workflows/e2e.cluster.yaml +++ b/.github/workflows/e2e.cluster.yaml @@ -18,9 +18,8 @@ name: E2E on: pull_request: - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.compat.yaml b/.github/workflows/e2e.compat.yaml index 8ec01d1bbaf6e7ee61ec44561e0485a92dc1073c..76039eb86527d510a653b20069b38cfae0671fcc 100644 --- a/.github/workflows/e2e.compat.yaml +++ b/.github/workflows/e2e.compat.yaml @@ -18,9 +18,8 @@ name: E2E on: pull_request: - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.go.yaml b/.github/workflows/e2e.go.yaml index eee18dc7ff0adf6f1e284578c72952d8ba328c99..698c14afb5233bbd1c88ad8a2132b7d8f7ac79f0 100644 --- a/.github/workflows/e2e.go.yaml +++ b/.github/workflows/e2e.go.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml index effb0fb04800b8a881637028649f897c97529c2b..909a77848ff3f142087129f8136f61ba4eccfc9d 100644 --- a/.github/workflows/e2e.istio.yaml +++ b/.github/workflows/e2e.istio.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true @@ -69,8 +68,9 @@ jobs: run: | git clone https://github.com/apache/skywalking-kubernetes.git cd skywalking-kubernetes - git reset --hard dd749f25913830c47a97430618cefc4167612e75 + git reset --hard 2fdcdc3bb39496bf49626755e8f60c998be5f587 cd chart + mkdir -p skywalking/files/conf.d/oap/ && cp ../../test/e2e/e2e-test/src/test/resources/metadata-service-mapping.yaml skywalking/files/conf.d/oap/metadata-service-mapping.yaml helm dep up skywalking helm -n istio-system install skywalking skywalking \ --set fullnameOverride=skywalking \ @@ -78,6 +78,7 @@ jobs: --set elasticsearch.minimumMasterNodes=1 \ --set elasticsearch.imageTag=7.5.1 \ --set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=${{ matrix.analyzer }} \ + --set oap.env.K8S_SERVICE_NAME_RULE='e2e::${service.metadata.name}' \ --set oap.envoy.als.enabled=true \ --set oap.replicas=1 \ --set ui.image.repository=skywalking/ui \ diff --git a/.github/workflows/e2e.jdk-versions.yaml b/.github/workflows/e2e.jdk-versions.yaml index e29e4e98f822e37df0c7579a1ff93c18324716df..949d41dfd62fa695867ea057f9e2fc2f3f1fd179 100644 --- a/.github/workflows/e2e.jdk-versions.yaml +++ b/.github/workflows/e2e.jdk-versions.yaml @@ -18,9 +18,8 @@ name: E2E on: pull_request: - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.js.yaml b/.github/workflows/e2e.js.yaml index 5788a73640be85fe8f4c5dda15909f99962462e6..5d5b78fdffe4bd2c108bb89429fc2f95153488ec 100644 --- a/.github/workflows/e2e.js.yaml +++ b/.github/workflows/e2e.js.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.kafka.yaml b/.github/workflows/e2e.kafka.yaml index 53111b01cc71a2a89d7c0d8012fea4b9d5f58dd2..30e6a9a82fd5d3d00ca35d8616434bdff43f92e7 100644 --- a/.github/workflows/e2e.kafka.yaml +++ b/.github/workflows/e2e.kafka.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.nodejs.yaml b/.github/workflows/e2e.nodejs.yaml index ca859b5b49ca7a66b2a8741cd2656779c1a23829..a21af25023525c667e9edc8c4ef1f4ad5cf6d827 100644 --- a/.github/workflows/e2e.nodejs.yaml +++ b/.github/workflows/e2e.nodejs.yaml @@ -14,16 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: E2E-NodeJS +name: E2E on: pull_request: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.php.yaml b/.github/workflows/e2e.php.yaml index 69f45892a4dc93a2f48efcfdfbbd9ed3a7bc0674..452b12a8d2baf41f5d7ffdd25e048210d90122ce 100644 --- a/.github/workflows/e2e.php.yaml +++ b/.github/workflows/e2e.php.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.profiling.yaml b/.github/workflows/e2e.profiling.yaml index cae7aea50a392d365cbcad8e6db6936f8e574f42..380523375879ab1aa44a4dba739224b903943329 100644 --- a/.github/workflows/e2e.profiling.yaml +++ b/.github/workflows/e2e.profiling.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.python.yaml b/.github/workflows/e2e.python.yaml index 3382df5a5c3c5a0d64b671267cadb60015255a32..4e8cca612155cd9ff25d3f29aa0d5aeceb443a74 100644 --- a/.github/workflows/e2e.python.yaml +++ b/.github/workflows/e2e.python.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.so11y.yaml b/.github/workflows/e2e.so11y.yaml index da3f86f3217ec722924d33cb6c8ca1c65f0ee9a4..73fbed3ffc6c8a00ac73187dabd3fb3da541efd1 100644 --- a/.github/workflows/e2e.so11y.yaml +++ b/.github/workflows/e2e.so11y.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.storages.yaml b/.github/workflows/e2e.storages.yaml index ca835594470aa99db1068178f21a8dba5a43c34c..4822c588b7b6fbc05ca4d331be481da96e3e39b4 100644 --- a/.github/workflows/e2e.storages.yaml +++ b/.github/workflows/e2e.storages.yaml @@ -18,9 +18,8 @@ name: E2E on: pull_request: - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.ttl.yaml b/.github/workflows/e2e.ttl.yaml index 89c3b1cc9cac502b89ef1b8600e709f367c0dfd1..3b0f461323cb4bada65ceb0a645bcb9c243f69dc 100644 --- a/.github/workflows/e2e.ttl.yaml +++ b/.github/workflows/e2e.ttl.yaml @@ -21,9 +21,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index a37f27bfa90db68ee9242870077f9de58efd80f9..741d4774ca20f10e48d4f940a2615c5ad23b6d9f 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -22,9 +22,8 @@ on: paths: - '**' - '!**.md' - push: - branches: - - master + schedule: + - cron: '0 2 * * *' env: SKIP_TEST: true 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 c8ca1acd771d9f7a963299a34190cf2412405c30..099231d6bdc10b164949558e005cc7e43364260c 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 @@ -18,18 +18,22 @@ package org.apache.skywalking.oap.server.receiver.envoy.als.mx; +import com.google.common.base.Joiner; import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.protobuf.BytesValue; import com.google.protobuf.Struct; +import com.google.protobuf.Value; import java.nio.ByteBuffer; -import java.util.Optional; +import java.util.ArrayList; +import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo; import Wasm.Common.FlatNode; import Wasm.Common.KeyVal; +import static com.google.common.base.Strings.nullToEmpty; import static java.util.Objects.nonNull; import static java.util.Objects.requireNonNull; @@ -58,8 +62,8 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo { } } - setServiceName(Optional.ofNullable(flatNode.labelsByKey("app")).map(KeyVal::value).orElse("-")); - setServiceInstanceName(flatNode.name()); + final Struct metadata = requireNonNull(extractStructFromNodeFlatBuffer(flatNode)); + FieldsHelper.SINGLETON.inflate(metadata, this); } /** @@ -72,6 +76,47 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo { this(any.getValue()); } + /** + * This method does the reverse conversion of https://github.com/istio/proxy/blob/938a9485a4286f0ce824b76df221a9bb6c8a6989/extensions/common/proto_util.cc#L112. It extracts the metadata from the + * {@link FlatNode flat buffer node} so that we can reuse the logic of {@link FieldsHelper}. + * + * @param node the flat buffer node where to extract the metadata + * @return the metadata {@link Struct} + */ + protected Struct extractStructFromNodeFlatBuffer(final FlatNode node) { + final Struct.Builder builder = Struct.newBuilder(); + + builder.putFields("NAME", Value.newBuilder().setStringValue(nullToEmpty(node.name())).build()); + builder.putFields("NAMESPACE", Value.newBuilder().setStringValue(nullToEmpty(node.namespace())).build()); + builder.putFields("OWNER", Value.newBuilder().setStringValue(nullToEmpty(node.owner())).build()); + builder.putFields("WORKLOAD_NAME", Value.newBuilder().setStringValue(nullToEmpty(node.workloadName())).build()); + builder.putFields("ISTIO_VERSION", Value.newBuilder().setStringValue(nullToEmpty(node.istioVersion())).build()); + builder.putFields("MESH_ID", Value.newBuilder().setStringValue(nullToEmpty(node.meshId())).build()); + builder.putFields("CLUSTER_ID", Value.newBuilder().setStringValue(nullToEmpty(node.clusterId())).build()); + + final Struct.Builder labels = Struct.newBuilder(); + for (int i = 0; i < node.labelsLength(); i++) { + final KeyVal label = node.labels(i); + labels.putFields(nullToEmpty(label.key()), Value.newBuilder().setStringValue(nullToEmpty(label.value())).build()); + } + builder.putFields("LABELS", Value.newBuilder().setStructValue(labels).build()); + + final Struct.Builder platformMetadata = Struct.newBuilder(); + for (int i = 0; i < node.platformMetadataLength(); i++) { + final KeyVal platformMd = node.platformMetadata(i); + platformMetadata.putFields(nullToEmpty(platformMd.key()), Value.newBuilder().setStringValue(nullToEmpty(platformMd.value())).build()); + } + builder.putFields("PLATFORM_METADATA", Value.newBuilder().setStructValue(platformMetadata).build()); + + final List appContainers = new ArrayList<>(); + for (int i = 0; i < node.appContainersLength(); i++) { + appContainers.add(node.appContainers(i)); + } + builder.putFields("APP_CONTAINERS", Value.newBuilder().setStringValue(Joiner.on(",").join(appContainers)).build()); + + return builder.build(); + } + /** * The same functionality with {@link ServiceMetaInfoAdapter#ServiceMetaInfoAdapter(com.google.protobuf.ByteString)}. * diff --git a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/mesh/ALSE2E.java b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/mesh/ALSE2E.java index b989eb316811a234a848f29cd6535c9edcff3b6a..a3b89bcd711b01f60b0a55022f05d53e4060c460 100644 --- a/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/mesh/ALSE2E.java +++ b/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/mesh/ALSE2E.java @@ -76,10 +76,10 @@ public class ALSE2E extends SkyWalkingTestAdapter { private final Map, String> serviceEndpointExpectedDataFiles = ImmutableMap., String>builder() - .put(service -> service.getLabel().startsWith("ratings"), "expected/als/endpoints-ratings.yml") - .put(service -> service.getLabel().startsWith("details"), "expected/als/endpoints-details.yml") - .put(service -> service.getLabel().startsWith("reviews"), "expected/als/endpoints-reviews.yml") - .put(service -> service.getLabel().startsWith("productpage"), "expected/als/endpoints-productpage.yml") + .put(service -> service.getLabel().contains("ratings"), "expected/als/endpoints-ratings.yml") + .put(service -> service.getLabel().contains("details"), "expected/als/endpoints-details.yml") + .put(service -> service.getLabel().contains("reviews"), "expected/als/endpoints-reviews.yml") + .put(service -> service.getLabel().contains("productpage"), "expected/als/endpoints-productpage.yml") .build(); @BeforeAll @@ -154,7 +154,7 @@ public class ALSE2E extends SkyWalkingTestAdapter { LOGGER.info("instances: {}", instances); String file = "expected/als/instances.yml"; - if (service.getLabel().equals("reviews")) { + if (service.getLabel().equals("e2e::reviews")) { file = "expected/als/instances-reviews.yml"; } load(file).as(InstancesMatcher.class).verify(instances); diff --git a/test/e2e/e2e-test/src/test/resources/expected/als/services.yml b/test/e2e/e2e-test/src/test/resources/expected/als/services.yml index 006a060b0b45d9c36873c9ced51e14fb4e1b7d9b..37f76cfd7654be5985cee50a4a4f64af0554509e 100644 --- a/test/e2e/e2e-test/src/test/resources/expected/als/services.yml +++ b/test/e2e/e2e-test/src/test/resources/expected/als/services.yml @@ -15,12 +15,12 @@ services: - key: not null - label: re(ratings.*) + label: e2e::ratings - key: not null - label: re(reviews.*) + label: e2e::reviews - key: not null - label: re(productpage.*) + label: e2e::productpage - key: not null - label: re(details.*) + label: e2e::details - key: not null - label: re(istio-ingressgateway.*) + label: e2e::istio-ingressgateway diff --git a/test/e2e/e2e-test/src/test/resources/expected/als/topo.yml b/test/e2e/e2e-test/src/test/resources/expected/als/topo.yml index b60dcc055014b172c42cbb0fbcb13879ccb6bf18..48f855e49bde3e1d2ec25b98d3064b0038145a6b 100644 --- a/test/e2e/e2e-test/src/test/resources/expected/als/topo.yml +++ b/test/e2e/e2e-test/src/test/resources/expected/als/topo.yml @@ -15,22 +15,22 @@ nodes: - id: not null - name: ratings + name: e2e::ratings type: http isReal: true - id: not null - name: reviews + name: e2e::reviews type: http isReal: true - id: not null - name: productpage + name: e2e::productpage isReal: true - id: not null - name: details + name: e2e::details type: http isReal: true - id: not null - name: istio-ingressgateway + name: e2e::istio-ingressgateway type: http isReal: true - id: not null @@ -39,30 +39,30 @@ nodes: calls: - id: not null source: VU5LTk9XTg==.1 - target: aXN0aW8taW5ncmVzc2dhdGV3YXk=.1 + target: ZTJlOjppc3Rpby1pbmdyZXNzZ2F0ZXdheQ==.1 detectPoints: - SERVER - id: not null - source: aXN0aW8taW5ncmVzc2dhdGV3YXk=.1 - target: cHJvZHVjdHBhZ2U=.1 + source: ZTJlOjppc3Rpby1pbmdyZXNzZ2F0ZXdheQ==.1 + target: ZTJlOjpwcm9kdWN0cGFnZQ==.1 detectPoints: - CLIENT - SERVER - id: not null - source: cHJvZHVjdHBhZ2U=.1 - target: cmV2aWV3cw==.1 + source: ZTJlOjpwcm9kdWN0cGFnZQ==.1 + target: ZTJlOjpyZXZpZXdz.1 detectPoints: - CLIENT - SERVER - id: not null - source: cHJvZHVjdHBhZ2U=.1 - target: ZGV0YWlscw==.1 + source: ZTJlOjpwcm9kdWN0cGFnZQ==.1 + target: ZTJlOjpkZXRhaWxz.1 detectPoints: - CLIENT - SERVER - id: not null - source: cmV2aWV3cw==.1 - target: cmF0aW5ncw==.1 + source: ZTJlOjpyZXZpZXdz.1 + target: ZTJlOjpyYXRpbmdz.1 detectPoints: - CLIENT - SERVER diff --git a/test/e2e/e2e-test/src/test/resources/metadata-service-mapping.yaml b/test/e2e/e2e-test/src/test/resources/metadata-service-mapping.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0177de8196c0a742f4173c9f3ba561690d6e17cc --- /dev/null +++ b/test/e2e/e2e-test/src/test/resources/metadata-service-mapping.yaml @@ -0,0 +1,17 @@ +# 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. + +serviceName: e2e::${LABELS.app} +serviceInstanceName: ${NAME}