未验证 提交 afc44d4a 编写于 作者: Z Zhenxu Ke 提交者: GitHub

Unify the service name rule in `metadata-service-mapping.yml` of `mx-… (#6131)

上级 4ae4f0e7
...@@ -18,9 +18,8 @@ name: CI AND IT ...@@ -18,9 +18,8 @@ name: CI AND IT
on: on:
pull_request: pull_request:
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
MAVEN_OPTS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit MAVEN_OPTS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit
......
...@@ -21,6 +21,8 @@ on: ...@@ -21,6 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
schedule:
- cron: '0 2 * * *'
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -18,9 +18,8 @@ name: E2E ...@@ -18,9 +18,8 @@ name: E2E
on: on:
pull_request: pull_request:
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -18,9 +18,8 @@ name: E2E ...@@ -18,9 +18,8 @@ name: E2E
on: on:
pull_request: pull_request:
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
...@@ -69,8 +68,9 @@ jobs: ...@@ -69,8 +68,9 @@ jobs:
run: | run: |
git clone https://github.com/apache/skywalking-kubernetes.git git clone https://github.com/apache/skywalking-kubernetes.git
cd skywalking-kubernetes cd skywalking-kubernetes
git reset --hard dd749f25913830c47a97430618cefc4167612e75 git reset --hard 2fdcdc3bb39496bf49626755e8f60c998be5f587
cd chart 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 dep up skywalking
helm -n istio-system install skywalking skywalking \ helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \ --set fullnameOverride=skywalking \
...@@ -78,6 +78,7 @@ jobs: ...@@ -78,6 +78,7 @@ jobs:
--set elasticsearch.minimumMasterNodes=1 \ --set elasticsearch.minimumMasterNodes=1 \
--set elasticsearch.imageTag=7.5.1 \ --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=${{ matrix.analyzer }} \ --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.envoy.als.enabled=true \
--set oap.replicas=1 \ --set oap.replicas=1 \
--set ui.image.repository=skywalking/ui \ --set ui.image.repository=skywalking/ui \
......
...@@ -18,9 +18,8 @@ name: E2E ...@@ -18,9 +18,8 @@ name: E2E
on: on:
pull_request: pull_request:
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -14,16 +14,15 @@ ...@@ -14,16 +14,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: E2E-NodeJS name: E2E
on: on:
pull_request: pull_request:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -18,9 +18,8 @@ name: E2E ...@@ -18,9 +18,8 @@ name: E2E
on: on:
pull_request: pull_request:
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -21,9 +21,8 @@ on: ...@@ -21,9 +21,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -22,9 +22,8 @@ on: ...@@ -22,9 +22,8 @@ on:
paths: paths:
- '**' - '**'
- '!**.md' - '!**.md'
push: schedule:
branches: - cron: '0 2 * * *'
- master
env: env:
SKIP_TEST: true SKIP_TEST: true
......
...@@ -18,18 +18,22 @@ ...@@ -18,18 +18,22 @@
package org.apache.skywalking.oap.server.receiver.envoy.als.mx; 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.Any;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.BytesValue; import com.google.protobuf.BytesValue;
import com.google.protobuf.Struct; import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Optional; import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo; import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo;
import Wasm.Common.FlatNode; import Wasm.Common.FlatNode;
import Wasm.Common.KeyVal; import Wasm.Common.KeyVal;
import static com.google.common.base.Strings.nullToEmpty;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
...@@ -58,8 +62,8 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo { ...@@ -58,8 +62,8 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo {
} }
} }
setServiceName(Optional.ofNullable(flatNode.labelsByKey("app")).map(KeyVal::value).orElse("-")); final Struct metadata = requireNonNull(extractStructFromNodeFlatBuffer(flatNode));
setServiceInstanceName(flatNode.name()); FieldsHelper.SINGLETON.inflate(metadata, this);
} }
/** /**
...@@ -72,6 +76,47 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo { ...@@ -72,6 +76,47 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo {
this(any.getValue()); 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<String> 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)}. * The same functionality with {@link ServiceMetaInfoAdapter#ServiceMetaInfoAdapter(com.google.protobuf.ByteString)}.
* *
......
...@@ -76,10 +76,10 @@ public class ALSE2E extends SkyWalkingTestAdapter { ...@@ -76,10 +76,10 @@ public class ALSE2E extends SkyWalkingTestAdapter {
private final Map<Predicate<Service>, String> serviceEndpointExpectedDataFiles = private final Map<Predicate<Service>, String> serviceEndpointExpectedDataFiles =
ImmutableMap.<Predicate<Service>, String>builder() ImmutableMap.<Predicate<Service>, String>builder()
.put(service -> service.getLabel().startsWith("ratings"), "expected/als/endpoints-ratings.yml") .put(service -> service.getLabel().contains("ratings"), "expected/als/endpoints-ratings.yml")
.put(service -> service.getLabel().startsWith("details"), "expected/als/endpoints-details.yml") .put(service -> service.getLabel().contains("details"), "expected/als/endpoints-details.yml")
.put(service -> service.getLabel().startsWith("reviews"), "expected/als/endpoints-reviews.yml") .put(service -> service.getLabel().contains("reviews"), "expected/als/endpoints-reviews.yml")
.put(service -> service.getLabel().startsWith("productpage"), "expected/als/endpoints-productpage.yml") .put(service -> service.getLabel().contains("productpage"), "expected/als/endpoints-productpage.yml")
.build(); .build();
@BeforeAll @BeforeAll
...@@ -154,7 +154,7 @@ public class ALSE2E extends SkyWalkingTestAdapter { ...@@ -154,7 +154,7 @@ public class ALSE2E extends SkyWalkingTestAdapter {
LOGGER.info("instances: {}", instances); LOGGER.info("instances: {}", instances);
String file = "expected/als/instances.yml"; String file = "expected/als/instances.yml";
if (service.getLabel().equals("reviews")) { if (service.getLabel().equals("e2e::reviews")) {
file = "expected/als/instances-reviews.yml"; file = "expected/als/instances-reviews.yml";
} }
load(file).as(InstancesMatcher.class).verify(instances); load(file).as(InstancesMatcher.class).verify(instances);
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
services: services:
- key: not null - key: not null
label: re(ratings.*) label: e2e::ratings
- key: not null - key: not null
label: re(reviews.*) label: e2e::reviews
- key: not null - key: not null
label: re(productpage.*) label: e2e::productpage
- key: not null - key: not null
label: re(details.*) label: e2e::details
- key: not null - key: not null
label: re(istio-ingressgateway.*) label: e2e::istio-ingressgateway
...@@ -15,22 +15,22 @@ ...@@ -15,22 +15,22 @@
nodes: nodes:
- id: not null - id: not null
name: ratings name: e2e::ratings
type: http type: http
isReal: true isReal: true
- id: not null - id: not null
name: reviews name: e2e::reviews
type: http type: http
isReal: true isReal: true
- id: not null - id: not null
name: productpage name: e2e::productpage
isReal: true isReal: true
- id: not null - id: not null
name: details name: e2e::details
type: http type: http
isReal: true isReal: true
- id: not null - id: not null
name: istio-ingressgateway name: e2e::istio-ingressgateway
type: http type: http
isReal: true isReal: true
- id: not null - id: not null
...@@ -39,30 +39,30 @@ nodes: ...@@ -39,30 +39,30 @@ nodes:
calls: calls:
- id: not null - id: not null
source: VU5LTk9XTg==.1 source: VU5LTk9XTg==.1
target: aXN0aW8taW5ncmVzc2dhdGV3YXk=.1 target: ZTJlOjppc3Rpby1pbmdyZXNzZ2F0ZXdheQ==.1
detectPoints: detectPoints:
- SERVER - SERVER
- id: not null - id: not null
source: aXN0aW8taW5ncmVzc2dhdGV3YXk=.1 source: ZTJlOjppc3Rpby1pbmdyZXNzZ2F0ZXdheQ==.1
target: cHJvZHVjdHBhZ2U=.1 target: ZTJlOjpwcm9kdWN0cGFnZQ==.1
detectPoints: detectPoints:
- CLIENT - CLIENT
- SERVER - SERVER
- id: not null - id: not null
source: cHJvZHVjdHBhZ2U=.1 source: ZTJlOjpwcm9kdWN0cGFnZQ==.1
target: cmV2aWV3cw==.1 target: ZTJlOjpyZXZpZXdz.1
detectPoints: detectPoints:
- CLIENT - CLIENT
- SERVER - SERVER
- id: not null - id: not null
source: cHJvZHVjdHBhZ2U=.1 source: ZTJlOjpwcm9kdWN0cGFnZQ==.1
target: ZGV0YWlscw==.1 target: ZTJlOjpkZXRhaWxz.1
detectPoints: detectPoints:
- CLIENT - CLIENT
- SERVER - SERVER
- id: not null - id: not null
source: cmV2aWV3cw==.1 source: ZTJlOjpyZXZpZXdz.1
target: cmF0aW5ncw==.1 target: ZTJlOjpyYXRpbmdz.1
detectPoints: detectPoints:
- CLIENT - CLIENT
- SERVER - SERVER
# 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}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册