Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
fdab7f06
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fdab7f06
编写于
3月 22, 2021
作者:
静夜思朝颜
提交者:
GitHub
3月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add go2sky correlation context E2E test (#6590)
上级
9b4766e4
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
59 addition
and
15 deletion
+59
-15
test/e2e/e2e-service-consumer/pom.xml
test/e2e/e2e-service-consumer/pom.xml
+8
-0
test/e2e/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/UserController.java
.../org/apache/skywalking/e2e/controller/UserController.java
+16
-4
test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java
.../org/apache/skywalking/e2e/controller/UserController.java
+10
-0
test/e2e/e2e-test/docker/go/Dockerfile.go
test/e2e/e2e-test/docker/go/Dockerfile.go
+1
-1
test/e2e/e2e-test/docker/go/docker-compose.yml
test/e2e/e2e-test/docker/go/docker-compose.yml
+1
-1
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/GOE2E.java
...e-test/src/test/java/org/apache/skywalking/e2e/GOE2E.java
+16
-2
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-consumer.yml
...est/src/test/resources/expected/go/endpoints-consumer.yml
+2
-2
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-go2sky.yml
...-test/src/test/resources/expected/go/endpoints-go2sky.yml
+2
-2
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-provider.yml
...est/src/test/resources/expected/go/endpoints-provider.yml
+2
-2
test/e2e/e2e-test/src/test/resources/expected/go/traces.yml
test/e2e/e2e-test/src/test/resources/expected/go/traces.yml
+1
-1
未找到文件。
test/e2e/e2e-service-consumer/pom.xml
浏览文件 @
fdab7f06
...
...
@@ -33,6 +33,14 @@
<artifactId>
e2e-service-consumer
</artifactId>
<dependencies>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-trace
</artifactId>
<version>
${sw.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
...
...
test/e2e/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/UserController.java
浏览文件 @
fdab7f06
...
...
@@ -19,11 +19,8 @@
package
org.apache.skywalking.e2e.controller
;
import
com.google.common.base.Strings
;
import
java.util.Optional
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.skywalking.apm.toolkit.trace.TraceContext
;
import
org.apache.skywalking.e2e.E2EConfiguration
;
import
org.apache.skywalking.e2e.User
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -32,6 +29,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Optional
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@RestController
@RequiredArgsConstructor
public
class
UserController
{
...
...
@@ -67,6 +69,16 @@ public class UserController {
.
collect
(
Collectors
.
toList
());
}
@PostMapping
(
"/correlation"
)
public
String
correlation
()
throws
InterruptedException
{
Thread
.
sleep
(
randomSleepLong
(
sleepMin
,
sleepMax
));
TraceContext
.
putCorrelation
(
"CONSUMER_KEY"
,
"consumer"
);
String
baseUrl
=
configuration
.
getProviderBaseUrl
();
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
baseUrl
+
"/correlation"
,
null
,
String
.
class
);
return
resp
.
getBody
();
}
private
long
randomSleepLong
(
int
min
,
int
max
)
{
Random
rand
=
new
Random
();
int
randomNumber
=
rand
.
nextInt
((
max
-
min
)
+
1
)
+
min
;
...
...
test/e2e/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java
浏览文件 @
fdab7f06
...
...
@@ -19,6 +19,7 @@
package
org.apache.skywalking.e2e.controller
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.skywalking.apm.toolkit.trace.TraceContext
;
import
org.apache.skywalking.e2e.User
;
import
org.apache.skywalking.e2e.UserRepo
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -47,6 +48,15 @@ public class UserController {
return
userRepo
.
save
(
user
);
}
@PostMapping
(
"/correlation"
)
public
String
correlation
()
throws
InterruptedException
{
Thread
.
sleep
(
randomSleepLong
(
sleepMin
,
sleepMax
));
TraceContext
.
putCorrelation
(
"PROVIDER_KEY"
,
"provider"
);
return
TraceContext
.
getCorrelation
(
"CONSUMER_KEY"
).
orElse
(
""
)
+
"_"
+
TraceContext
.
getCorrelation
(
"MIDDLE_KEY"
).
orElse
(
""
)
+
"_"
+
TraceContext
.
getCorrelation
(
"PROVIDER_KEY"
).
orElse
(
""
);
}
private
long
randomSleepLong
(
int
min
,
int
max
)
{
Random
rand
=
new
Random
();
int
randomNumber
=
rand
.
nextInt
((
max
-
min
)
+
1
)
+
min
;
...
...
test/e2e/e2e-test/docker/go/Dockerfile.go
浏览文件 @
fdab7f06
...
...
@@ -15,7 +15,7 @@
FROM
golang
:
1.12
AS
builder
ARG
COMMIT_HASH
=
38
c3b84741dd6c0609965e9df0fcc633915d3ea5
ARG
COMMIT_HASH
=
9094186
ac3782482a85dbca47978651bec268e97
ARG
GO2SKY_CODE
=
$
{
COMMIT_HASH
}
.
tar
.
gz
ARG
GO2SKY_CODE_URL
=
https
:
//github.com/SkyAPM/go2sky/archive/${GO2SKY_CODE}
...
...
test/e2e/e2e-test/docker/go/docker-compose.yml
浏览文件 @
fdab7f06
...
...
@@ -52,7 +52,7 @@ services:
condition
:
service_healthy
java-provider
:
condition
:
service_healthy
command
:
[
'
--grpc'
,
'
--oap-server'
,
'
oap:11800'
,
'
--upstream-url'
,
'
http://java-provider:9090/
info
'
]
command
:
[
'
--grpc'
,
'
--oap-server'
,
'
oap:11800'
,
'
--upstream-url'
,
'
http://java-provider:9090/
correlation
'
]
healthcheck
:
test
:
[
"
CMD"
,
"
sh"
,
"
-c"
,
"
nc
-z
127.0.0.1
8080"
]
interval
:
5s
...
...
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/GOE2E.java
浏览文件 @
fdab7f06
...
...
@@ -17,7 +17,6 @@
package
org.apache.skywalking.e2e
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.skywalking.e2e.annotation.ContainerHostAndPort
;
import
org.apache.skywalking.e2e.annotation.DockerCompose
;
...
...
@@ -50,10 +49,15 @@ import org.apache.skywalking.e2e.topo.Topology;
import
org.apache.skywalking.e2e.trace.Trace
;
import
org.apache.skywalking.e2e.trace.TracesMatcher
;
import
org.apache.skywalking.e2e.trace.TracesQuery
;
import
org.junit.Assert
;
import
org.junit.jupiter.api.AfterAll
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.springframework.http.ResponseEntity
;
import
org.testcontainers.containers.DockerComposeContainer
;
import
java.net.URL
;
import
java.util.List
;
import
static
org
.
apache
.
skywalking
.
e2e
.
metrics
.
MetricsMatcher
.
verifyMetrics
;
import
static
org
.
apache
.
skywalking
.
e2e
.
metrics
.
MetricsMatcher
.
verifyPercentileMetrics
;
import
static
org
.
apache
.
skywalking
.
e2e
.
metrics
.
MetricsQuery
.
ALL_ENDPOINT_METRICS
;
...
...
@@ -93,7 +97,7 @@ public class GOE2E extends SkyWalkingTestAdapter {
@BeforeAll
public
void
setUp
()
throws
Exception
{
queryClient
(
swWebappHostPort
);
trafficController
(
javaConsumerHostPort
,
"/
info
"
);
trafficController
(
javaConsumerHostPort
,
"/
correlation
"
);
}
@AfterAll
...
...
@@ -159,6 +163,16 @@ public class GOE2E extends SkyWalkingTestAdapter {
verifyServiceInstanceRelationMetrics
(
topology
.
getCalls
());
}
@RetryableTest
void
correlation
()
throws
Exception
{
final
URL
url
=
new
URL
(
"http"
,
javaConsumerHostPort
.
host
(),
javaConsumerHostPort
.
port
(),
"/correlation"
);
ResponseEntity
<
String
>
resp
=
restTemplate
.
postForEntity
(
url
.
toURI
(),
trafficData
,
String
.
class
);
LOGGER
.
info
(
"verifying correlation: {}"
,
resp
);
Assert
.
assertEquals
(
"consumer_go2sky_provider"
,
resp
.
getBody
());
}
private
Instances
verifyServiceInstances
(
final
Service
service
)
throws
Exception
{
final
Instances
instances
=
graphql
.
instances
(
new
InstancesQuery
().
serviceId
(
service
.
getKey
()).
start
(
startTime
).
end
(
now
())
...
...
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-consumer.yml
浏览文件 @
fdab7f06
...
...
@@ -14,5 +14,5 @@
# limitations under the License.
endpoints
:
-
key
:
ZTJlLXNlcnZpY2UtamF2YS1jb25zdW1lcg==.1_L2luZm8=
label
:
/info
\ No newline at end of file
-
key
:
ZTJlLXNlcnZpY2UtamF2YS1jb25zdW1lcg==.1_L2NvcnJlbGF0aW9u
label
:
/correlation
\ No newline at end of file
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-go2sky.yml
浏览文件 @
fdab7f06
...
...
@@ -14,5 +14,5 @@
# limitations under the License.
endpoints
:
-
key
:
Z28yc2t5.1_L1BPU1QvaW5mbw==
label
:
/POST/info
\ No newline at end of file
-
key
:
Z28yc2t5.1_L1BPU1QvY29ycmVsYXRpb24=
label
:
/POST/correlation
\ No newline at end of file
test/e2e/e2e-test/src/test/resources/expected/go/endpoints-provider.yml
浏览文件 @
fdab7f06
...
...
@@ -14,5 +14,5 @@
# limitations under the License.
endpoints
:
-
key
:
ZTJlLXNlcnZpY2UtamF2YS1wcm92aWRlcg==.1_L2luZm8=
label
:
/info
\ No newline at end of file
-
key
:
ZTJlLXNlcnZpY2UtamF2YS1wcm92aWRlcg==.1_L2NvcnJlbGF0aW9u
label
:
/correlation
\ No newline at end of file
test/e2e/e2e-test/src/test/resources/expected/go/traces.yml
浏览文件 @
fdab7f06
...
...
@@ -16,7 +16,7 @@
traces
:
-
key
:
not
null
endpointNames
:
-
/
info
-
/
correlation
duration
:
ge
0
start
:
gt
0
isError
:
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录