Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
80a534b1
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
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,发现更多精彩内容 >>
未验证
提交
80a534b1
编写于
7月 05, 2020
作者:
C
caoyixiong
提交者:
GitHub
7月 05, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support Graphql Logic endpoint (#5030)
上级
e59ba49c
变更
54
隐藏空白更改
内联
并排
Showing
54 changed file
with
2372 addition
and
23 deletion
+2372
-23
.github/workflows/plugins-test.3.yaml
.github/workflows/plugins-test.3.yaml
+3
-0
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+2
-0
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
...rg/apache/skywalking/apm/agent/core/context/tag/Tags.java
+2
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
...apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
+41
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
...skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
+78
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
...apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def
...phql-12.x-plugin/src/main/resources/skywalking-plugin.def
+17
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
.../apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
+40
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java
.../skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java
+109
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
.../apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def
...aphql-8.x-plugin/src/main/resources/skywalking-plugin.def
+17
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
.../apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
+40
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
.../skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
+78
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
.../apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def
...aphql-9.x-plugin/src/main/resources/skywalking-plugin.def
+17
-0
apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
+43
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+2
-1
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
...rver-bootstrap/src/main/resources/component-libraries.yml
+3
-0
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+0
-11
test/plugin/scenarios/canal-scenario/pom.xml
test/plugin/scenarios/canal-scenario/pom.xml
+0
-11
test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh
test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh
+21
-0
test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml
.../scenarios/graphql-12.x-scenario/config/expectedData.yaml
+92
-0
test/plugin/scenarios/graphql-12.x-scenario/configuration.yml
.../plugin/scenarios/graphql-12.x-scenario/configuration.yml
+20
-0
test/plugin/scenarios/graphql-12.x-scenario/pom.xml
test/plugin/scenarios/graphql-12.x-scenario/pom.xml
+115
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
...rios/graphql-12.x-scenario/src/main/assembly/assembly.xml
+41
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
...g/apache/skywalking/apm/testcase/graphql/Application.java
+29
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
...lking/apm/testcase/graphql/configuration/GraphSchema.java
+120
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
...lking/apm/testcase/graphql/controller/CaseController.java
+53
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
...org/apache/skywalking/apm/testcase/graphql/data/User.java
+26
-0
test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml
.../graphql-12.x-scenario/src/main/resources/application.yml
+20
-0
test/plugin/scenarios/graphql-12.x-scenario/support-version.list
...ugin/scenarios/graphql-12.x-scenario/support-version.list
+22
-0
test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh
test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh
+21
-0
test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml
...n/scenarios/graphql-8.x-scenario/config/expectedData.yaml
+92
-0
test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
+20
-0
test/plugin/scenarios/graphql-8.x-scenario/pom.xml
test/plugin/scenarios/graphql-8.x-scenario/pom.xml
+114
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
...arios/graphql-8.x-scenario/src/main/assembly/assembly.xml
+41
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
...g/apache/skywalking/apm/testcase/graphql/Application.java
+29
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
...lking/apm/testcase/graphql/configuration/GraphSchema.java
+121
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java
...e/skywalking/apm/testcase/graphql/configuration/User.java
+26
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
...lking/apm/testcase/graphql/controller/CaseController.java
+53
-0
test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml
...s/graphql-8.x-scenario/src/main/resources/application.yml
+20
-0
test/plugin/scenarios/graphql-8.x-scenario/support-version.list
...lugin/scenarios/graphql-8.x-scenario/support-version.list
+19
-0
test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh
test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh
+21
-0
test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml
...n/scenarios/graphql-9.x-scenario/config/expectedData.yaml
+92
-0
test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
+20
-0
test/plugin/scenarios/graphql-9.x-scenario/pom.xml
test/plugin/scenarios/graphql-9.x-scenario/pom.xml
+114
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
...arios/graphql-9.x-scenario/src/main/assembly/assembly.xml
+41
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
...g/apache/skywalking/apm/testcase/graphql/Application.java
+29
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
...lking/apm/testcase/graphql/configuration/GraphSchema.java
+120
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
...lking/apm/testcase/graphql/controller/CaseController.java
+53
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
...org/apache/skywalking/apm/testcase/graphql/data/User.java
+26
-0
test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml
...s/graphql-9.x-scenario/src/main/resources/application.yml
+20
-0
test/plugin/scenarios/graphql-9.x-scenario/support-version.list
...lugin/scenarios/graphql-9.x-scenario/support-version.list
+21
-0
未找到文件。
.github/workflows/plugins-test.3.yaml
浏览文件 @
80a534b1
...
...
@@ -49,6 +49,9 @@ jobs:
-
{
name
:
'
baidu-brpc-scenario'
,
title
:
'
baidu-brpc
2.3.7-2.5.3
(12)'
}
-
{
name
:
'
retransform-class-scenario'
,
title
:
'
Retransform
class
(1)'
}
-
{
name
:
'
retransform-class-tomcat-scenario'
,
title
:
'
Retransform
class
(1)'
}
-
{
name
:
'
graphql-8.x-scenario'
,
title
:
'
graphql-8.x
8.0
(1)'
}
-
{
name
:
'
graphql-9.x-scenario'
,
title
:
'
graphql-9.x
9.0-11.0
(3)'
}
-
{
name
:
'
graphql-12.x-scenario'
,
title
:
'
graphql-12.x
12.0-15.0
(4)'
}
steps
:
-
uses
:
actions/checkout@v2
with
:
...
...
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
80a534b1
...
...
@@ -164,4 +164,6 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
INFLUXDB_JAVA
=
new
OfficialComponent
(
90
,
"influxdb-java"
);
public
static
final
OfficialComponent
BRPC_JAVA
=
new
OfficialComponent
(
91
,
"brpc-java"
);
public
static
final
OfficialComponent
GRAPHQL
=
new
OfficialComponent
(
92
,
"GraphQL"
);
}
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
浏览文件 @
80a534b1
...
...
@@ -83,6 +83,8 @@ public final class Tags {
public
static
final
StringTag
PARAMS
=
new
StringTag
(
11
,
"http.params"
,
true
);
}
public
static
final
StringTag
LOGIC_ENDPOINT
=
new
StringTag
(
12
,
"x-le"
);
/**
* Creates a {@code StringTag} with the given key and cache it, if it's created before, simply return it without
* creating a new one.
...
...
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
graphql-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
graphql-12.x-plugin
</artifactId>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
12.0
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/GraphqlInterceptor.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v12
;
import
graphql.execution.ExecutionPath
;
import
graphql.execution.ExecutionStrategyParameters
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
GraphqlInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
;
}
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
parameters
.
getField
().
getSingleField
().
getName
());
Tags
.
LOGIC_ENDPOINT
.
set
(
span
,
buildLogicEndpointSpan
());
span
.
setComponent
(
ComponentsDefine
.
GRAPHQL
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
ret
;
}
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
;
}
dealException
(
t
);
}
private
void
dealException
(
Throwable
throwable
)
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
throwable
);
}
private
String
buildLogicEndpointSpan
()
{
Map
<
String
,
Object
>
logicEndpointSpan
=
new
HashMap
<>();
logicEndpointSpan
.
put
(
"logic-span"
,
true
);
return
logicEndpointSpan
.
toString
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v12/define/GraphqlInstrumentation.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v12.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
public
class
GraphqlInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.graphql.v12.GraphqlInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"graphql.execution.ExecutionStrategy"
;
public
static
final
String
ENHANCE_METHOD_DISPATCH
=
"resolveFieldWithInfo"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD_DISPATCH
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]
{
"graphql.cachecontrol.CacheControl"
};
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-12.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
80a534b1
# 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.
graphql=org.apache.skywalking.apm.plugin.graphql.v12.define.GraphqlInstrumentation
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
graphql-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
graphql-8.x-plugin
</artifactId>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
8.0
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/GraphqlInterceptor.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v8
;
import
graphql.execution.ExecutionPath
;
import
graphql.execution.ExecutionStrategyParameters
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
GraphqlInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
)
{
return
;
}
ExecutionPath
path
=
parameters
.
getPath
();
try
{
Field
field
=
ExecutionPath
.
class
.
getDeclaredField
(
"parent"
);
field
.
setAccessible
(
true
);
ExecutionPath
parentPath
=
(
ExecutionPath
)
field
.
get
(
path
);
if
(
parentPath
!=
ExecutionPath
.
rootPath
())
{
return
;
}
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
parameters
.
getField
().
get
(
0
).
getName
());
Tags
.
LOGIC_ENDPOINT
.
set
(
span
,
buildLogicEndpointSpan
());
span
.
setComponent
(
ComponentsDefine
.
GRAPHQL
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
)
{
return
ret
;
}
ExecutionPath
path
=
parameters
.
getPath
();
try
{
Field
field
=
ExecutionPath
.
class
.
getDeclaredField
(
"parent"
);
field
.
setAccessible
(
true
);
ExecutionPath
parentPath
=
(
ExecutionPath
)
field
.
get
(
path
);
if
(
parentPath
!=
ExecutionPath
.
rootPath
())
{
return
ret
;
}
ContextManager
.
stopSpan
();
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
)
{
return
;
}
ExecutionPath
path
=
parameters
.
getPath
();
try
{
Field
field
=
ExecutionPath
.
class
.
getDeclaredField
(
"parent"
);
field
.
setAccessible
(
true
);
ExecutionPath
parentPath
=
(
ExecutionPath
)
field
.
get
(
path
);
if
(
parentPath
!=
ExecutionPath
.
rootPath
())
{
return
;
}
dealException
(
t
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
}
}
private
void
dealException
(
Throwable
throwable
)
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
throwable
);
}
private
String
buildLogicEndpointSpan
()
{
Map
<
String
,
Object
>
logicEndpointSpan
=
new
HashMap
<>();
logicEndpointSpan
.
put
(
"logic-span"
,
true
);
return
logicEndpointSpan
.
toString
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v8/define/GraphqlInstrumentation.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v8.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
public
class
GraphqlInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.graphql.v8.GraphqlInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"graphql.execution.ExecutionStrategy"
;
public
static
final
String
ENHANCE_METHOD_DISPATCH
=
"resolveField"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD_DISPATCH
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]
{
"graphql.util.SimpleTraverserContext"
,
"graphql.analysis.FieldVisitor"
};
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-8.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
80a534b1
# 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.
graphql=org.apache.skywalking.apm.plugin.graphql.v8.define.GraphqlInstrumentation
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
graphql-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
graphql-9.x-plugin
</artifactId>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
9.0
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/GraphqlInterceptor.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v9
;
import
graphql.execution.ExecutionPath
;
import
graphql.execution.ExecutionStrategyParameters
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
GraphqlInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
;
}
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
parameters
.
getField
().
get
(
0
).
getName
());
Tags
.
LOGIC_ENDPOINT
.
set
(
span
,
buildLogicEndpointSpan
());
span
.
setComponent
(
ComponentsDefine
.
GRAPHQL
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
ret
;
}
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ExecutionStrategyParameters
parameters
=
(
ExecutionStrategyParameters
)
allArguments
[
1
];
if
(
parameters
==
null
||
parameters
.
getParent
().
getPath
()
!=
ExecutionPath
.
rootPath
())
{
return
;
}
dealException
(
t
);
}
private
void
dealException
(
Throwable
throwable
)
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
throwable
);
}
private
String
buildLogicEndpointSpan
()
{
Map
<
String
,
Object
>
logicEndpointSpan
=
new
HashMap
<>();
logicEndpointSpan
.
put
(
"logic-span"
,
true
);
return
logicEndpointSpan
.
toString
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/graphql/v9/define/GraphqlInstrumentation.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.plugin.graphql.v9.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
public
class
GraphqlInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.graphql.v9.GraphqlInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"graphql.execution.ExecutionStrategy"
;
public
static
final
String
ENHANCE_METHOD_DISPATCH
=
"resolveFieldWithInfo"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD_DISPATCH
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]
{
"graphql.util.SimpleTraverserContext"
,
"graphql.analysis.QueryVisitor"
};
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/graphql-plugin/graphql-9.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
80a534b1
# 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.
graphql=org.apache.skywalking.apm.plugin.graphql.v9.define.GraphqlInstrumentation
apm-sniffer/apm-sdk-plugin/graphql-plugin/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
apm-sdk-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
pom
</packaging>
<artifactId>
graphql-plugin
</artifactId>
<modules>
<module>
graphql-8.x-plugin
</module>
<module>
graphql-9.x-plugin
</module>
<module>
graphql-12.x-plugin
</module>
</modules>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<sdk.plugin.related.dir>
/..
</sdk.plugin.related.dir>
</properties>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
80a534b1
...
...
@@ -94,6 +94,7 @@
<module>
mariadb-2.x-plugin
</module>
<module>
influxdb-2.x-plugin
</module>
<module>
baidu-brpc-plugin
</module>
<module>
graphql-plugin
</module>
</modules>
<packaging>
pom
</packaging>
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
80a534b1
...
...
@@ -95,7 +95,8 @@
*
[
Ehcache
](
https://www.ehcache.org/
)
2.x
*
Kotlin
*
[
Coroutine
](
https://kotlinlang.org/docs/reference/coroutines-overview.html
)
1.0.1 -> 1.3.x (Optional²)
*
GraphQL
*
[
Graphql
](
https://github.com/graphql-java
)
8.0 -> 15.x
¹Due to license incompatibilities/restrictions these plugins are hosted and released in 3rd part repository,
go to
[
SkyAPM java plugin extension repository
](
https://github.com/SkyAPM/java-plugin-extensions
)
to get these.
...
...
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
浏览文件 @
80a534b1
...
...
@@ -305,6 +305,9 @@ influxdb-java:
brpc-java
:
id
:
91
languages
:
Java
GraphQL
:
id
:
92
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
浏览文件 @
80a534b1
...
...
@@ -105,15 +105,4 @@
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>
spring-snapshots
</id>
<url>
http://repo.spring.io/snapshot
</url>
</pluginRepository>
<pluginRepository>
<id>
spring-milestones
</id>
<url>
http://repo.spring.io/milestone
</url>
</pluginRepository>
</pluginRepositories>
</project>
\ No newline at end of file
test/plugin/scenarios/canal-scenario/pom.xml
浏览文件 @
80a534b1
...
...
@@ -154,15 +154,4 @@
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>
spring-snapshots
</id>
<url>
http://repo.spring.io/snapshot
</url>
</pluginRepository>
<pluginRepository>
<id>
spring-milestones
</id>
<url>
http://repo.spring.io/milestone
</url>
</pluginRepository>
</pluginRepositories>
</project>
\ No newline at end of file
test/plugin/scenarios/graphql-12.x-scenario/bin/startup.sh
0 → 100644
浏览文件 @
80a534b1
#!/bin/bash
#
# 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.
home
=
"
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
"
java
-jar
${
agent_opts
}
${
home
}
/../libs/graphql-12.x-scenario.jar &
\ No newline at end of file
test/plugin/scenarios/graphql-12.x-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
80a534b1
# 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.
segmentItems
:
-
serviceName
:
graphql-12.x-scenario
segmentSize
:
gt
1
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
1
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
2
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
3
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
4
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
/graphql-scenario/case/graphql
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Http
startTime
:
nq
0
endTime
:
nq
0
componentId
:
1
isError
:
false
spanType
:
Entry
peer
:
'
'
tags
:
-
{
key
:
url
,
value
:
'
http://localhost:8080/graphql-scenario/case/graphql'
}
-
{
key
:
http.method
,
value
:
GET
}
skipAnalysis
:
'
false'
test/plugin/scenarios/graphql-12.x-scenario/configuration.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
type
:
jvm
entryService
:
http://localhost:8080/graphql-scenario/case/graphql
healthCheck
:
http://localhost:8080/graphql-scenario/case/healthCheck
startScript
:
./bin/startup.sh
test/plugin/scenarios/graphql-12.x-scenario/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<groupId>
org.apache.skywalking.apm.testcase
</groupId>
<artifactId>
graphql-12.x-scenario
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<name>
skywalking-graphql-12.x-scenario
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<spring.boot.version>
2.1.6.RELEASE
</spring.boot.version>
<test.framework.version>
9.0
</test.framework.version>
<lombok.version>
1.18.10
</lombok.version>
<test.framework>
graphql
</test.framework>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring.boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
${test.framework.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
graphql-12.x-scenario
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${compiler.version}
</source>
<target>
${compiler.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<id>
assemble
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
<outputDirectory>
./target/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
test/plugin/scenarios/graphql-12.x-scenario/src/main/assembly/assembly.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<formats>
<format>
zip
</format>
</formats>
<fileSets>
<fileSet>
<directory>
./bin
</directory>
<fileMode>
0775
</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>
${project.build.directory}/graphql-12.x-scenario.jar
</source>
<outputDirectory>
./libs
</outputDirectory>
<fileMode>
0775
</fileMode>
</file>
</files>
</assembly>
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.configuration
;
import
graphql.GraphQL
;
import
graphql.schema.GraphQLFieldDefinition
;
import
graphql.schema.GraphQLList
;
import
graphql.schema.GraphQLOutputType
;
import
graphql.schema.GraphQLSchema
;
import
org.apache.skywalking.apm.testcase.graphql.data.User
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
graphql
.
Scalars
.
GraphQLInt
;
import
static
graphql
.
Scalars
.
GraphQLString
;
import
static
graphql
.
schema
.
GraphQLArgument
.
newArgument
;
import
static
graphql
.
schema
.
GraphQLFieldDefinition
.
newFieldDefinition
;
import
static
graphql
.
schema
.
GraphQLObjectType
.
newObject
;
@Component
public
class
GraphSchema
{
private
graphql
.
schema
.
GraphQLSchema
schema
;
private
GraphQLOutputType
userType
;
@PostConstruct
public
void
init
()
{
initOutputType
();
schema
=
graphql
.
schema
.
GraphQLSchema
.
newSchema
().
query
(
newObject
()
.
name
(
"GraphQuery"
)
.
field
(
createUsersField
())
.
field
(
createUserField
())
.
build
()).
build
();
}
@Bean
public
GraphQL
graphQL
()
{
return
new
GraphQL
(
getSchema
());
}
private
void
initOutputType
()
{
userType
=
newObject
()
.
name
(
"User"
)
.
field
(
newFieldDefinition
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
field
(
newFieldDefinition
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
build
();
}
private
GraphQLFieldDefinition
createUserField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"user"
)
.
argument
(
newArgument
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
type
(
userType
)
.
dataFetcher
(
environment
->
{
int
id
=
environment
.
getArgument
(
"id"
);
try
{
Thread
.
sleep
(
300L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
User
user
=
new
User
();
user
.
setId
(
id
);
user
.
setName
(
"Name_"
+
id
);
return
user
;
})
.
build
();
}
private
GraphQLFieldDefinition
createUsersField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"users"
)
.
argument
(
newArgument
().
name
(
"page"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"size"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
type
(
new
GraphQLList
(
userType
))
.
dataFetcher
(
environment
->
{
int
page
=
environment
.
getArgument
(
"page"
);
int
size
=
environment
.
getArgument
(
"size"
);
String
name
=
environment
.
getArgument
(
"name"
);
try
{
Thread
.
sleep
(
100L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
List
<
User
>
list
=
new
ArrayList
<>(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
User
user
=
new
User
();
user
.
setId
(
i
);
user
.
setName
(
name
+
"_"
+
page
+
"_"
+
i
);
list
.
add
(
user
);
}
return
list
;
})
.
build
();
}
public
GraphQLSchema
getSchema
()
{
return
schema
;
}
}
\ No newline at end of file
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.controller
;
import
graphql.ExecutionInput
;
import
graphql.GraphQL
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/case"
)
public
class
CaseController
{
private
static
final
String
SUCCESS
=
"Success"
;
@Resource
private
GraphQL
graphQL
;
@RequestMapping
(
"/healthCheck"
)
@ResponseBody
public
String
healthCheck
()
{
return
SUCCESS
;
}
@RequestMapping
(
"/graphql"
)
@ResponseBody
public
String
graphql
()
{
String
query3
=
"{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}"
;
ExecutionInput
executionInput
=
ExecutionInput
.
newExecutionInput
().
query
(
query3
).
build
();
graphQL
.
execute
(
executionInput
);
graphQL
.
executeAsync
(
executionInput
);
return
SUCCESS
;
}
}
test/plugin/scenarios/graphql-12.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.data
;
import
lombok.Data
;
@Data
public
class
User
{
private
int
id
;
private
String
name
;
}
\ No newline at end of file
test/plugin/scenarios/graphql-12.x-scenario/src/main/resources/application.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
server
:
port
:
8080
servlet
:
context-path
:
/graphql-scenario
\ No newline at end of file
test/plugin/scenarios/graphql-12.x-scenario/support-version.list
0 → 100644
浏览文件 @
80a534b1
# 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
# "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.
# lists your version here
12.0
13.0
14.0
15.0
\ No newline at end of file
test/plugin/scenarios/graphql-8.x-scenario/bin/startup.sh
0 → 100644
浏览文件 @
80a534b1
#!/bin/bash
#
# 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.
home
=
"
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
"
java
-jar
${
agent_opts
}
${
home
}
/../libs/graphql-8.x-scenario.jar &
\ No newline at end of file
test/plugin/scenarios/graphql-8.x-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
80a534b1
# 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.
segmentItems
:
-
serviceName
:
graphql-8.x-scenario
segmentSize
:
gt
1
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
1
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
2
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
3
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
4
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
/graphql-scenario/case/graphql
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Http
startTime
:
nq
0
endTime
:
nq
0
componentId
:
1
isError
:
false
spanType
:
Entry
peer
:
'
'
tags
:
-
{
key
:
url
,
value
:
'
http://localhost:8080/graphql-scenario/case/graphql'
}
-
{
key
:
http.method
,
value
:
GET
}
skipAnalysis
:
'
false'
test/plugin/scenarios/graphql-8.x-scenario/configuration.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
type
:
jvm
entryService
:
http://localhost:8080/graphql-scenario/case/graphql
healthCheck
:
http://localhost:8080/graphql-scenario/case/healthCheck
startScript
:
./bin/startup.sh
test/plugin/scenarios/graphql-8.x-scenario/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<groupId>
org.apache.skywalking.apm.testcase
</groupId>
<artifactId>
graphql-8.x-scenario
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<name>
skywalking-graphql-8.x-scenario
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<spring.boot.version>
2.1.6.RELEASE
</spring.boot.version>
<test.framework.version>
8.0
</test.framework.version>
<lombok.version>
1.18.10
</lombok.version>
<test.framework>
graphql
</test.framework>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring.boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
graphql-8.x-scenario
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${compiler.version}
</source>
<target>
${compiler.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<id>
assemble
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
<outputDirectory>
./target/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
test/plugin/scenarios/graphql-8.x-scenario/src/main/assembly/assembly.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<formats>
<format>
zip
</format>
</formats>
<fileSets>
<fileSet>
<directory>
./bin
</directory>
<fileMode>
0775
</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>
${project.build.directory}/graphql-8.x-scenario.jar
</source>
<outputDirectory>
./libs
</outputDirectory>
<fileMode>
0775
</fileMode>
</file>
</files>
</assembly>
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.configuration
;
import
graphql.GraphQL
;
import
graphql.schema.GraphQLFieldDefinition
;
import
graphql.schema.GraphQLList
;
import
graphql.schema.GraphQLOutputType
;
import
graphql.schema.GraphQLSchema
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
graphql
.
Scalars
.
GraphQLInt
;
import
static
graphql
.
Scalars
.
GraphQLString
;
import
static
graphql
.
schema
.
GraphQLArgument
.
newArgument
;
import
static
graphql
.
schema
.
GraphQLFieldDefinition
.
newFieldDefinition
;
import
static
graphql
.
schema
.
GraphQLObjectType
.
newObject
;
@Component
public
class
GraphSchema
{
private
graphql
.
schema
.
GraphQLSchema
schema
;
private
GraphQLOutputType
userType
;
@PostConstruct
public
void
init
()
{
initOutputType
();
schema
=
graphql
.
schema
.
GraphQLSchema
.
newSchema
().
query
(
newObject
()
.
name
(
"GraphQuery"
)
.
field
(
createUsersField
())
.
field
(
createUserField
())
.
build
()).
build
();
}
@Bean
public
GraphQL
graphQL
()
{
return
new
GraphQL
(
getSchema
());
}
private
void
initOutputType
()
{
userType
=
newObject
()
.
name
(
"User"
)
.
field
(
newFieldDefinition
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
field
(
newFieldDefinition
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
build
();
}
private
GraphQLFieldDefinition
createUserField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"user"
)
.
argument
(
newArgument
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
type
(
userType
)
.
dataFetcher
(
environment
->
{
int
id
=
environment
.
getArgument
(
"id"
);
try
{
Thread
.
sleep
(
300L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
User
user
=
new
User
();
user
.
setId
(
id
);
user
.
setName
(
"Name_"
+
id
);
return
user
;
})
.
build
();
}
private
GraphQLFieldDefinition
createUsersField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"users"
)
.
argument
(
newArgument
().
name
(
"page"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"size"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
type
(
new
GraphQLList
(
userType
))
.
dataFetcher
(
environment
->
{
int
page
=
environment
.
getArgument
(
"page"
);
int
size
=
environment
.
getArgument
(
"size"
);
String
name
=
environment
.
getArgument
(
"name"
);
try
{
Thread
.
sleep
(
100L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
List
<
User
>
list
=
new
ArrayList
<>(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
User
user
=
new
User
();
user
.
setId
(
i
);
user
.
setName
(
name
+
"_"
+
page
+
"_"
+
i
);
list
.
add
(
user
);
}
return
list
;
})
.
build
();
}
public
GraphQLSchema
getSchema
()
{
return
schema
;
}
}
\ No newline at end of file
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/User.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.configuration
;
import
lombok.Data
;
@Data
public
class
User
{
private
int
id
;
private
String
name
;
}
\ No newline at end of file
test/plugin/scenarios/graphql-8.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.controller
;
import
graphql.ExecutionInput
;
import
graphql.GraphQL
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/case"
)
public
class
CaseController
{
private
static
final
String
SUCCESS
=
"Success"
;
@Resource
private
GraphQL
graphQL
;
@RequestMapping
(
"/healthCheck"
)
@ResponseBody
public
String
healthCheck
()
{
return
SUCCESS
;
}
@RequestMapping
(
"/graphql"
)
@ResponseBody
public
String
graphql
()
{
String
query3
=
"{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}"
;
ExecutionInput
executionInput
=
ExecutionInput
.
newExecutionInput
().
query
(
query3
).
build
();
graphQL
.
execute
(
executionInput
);
graphQL
.
executeAsync
(
executionInput
);
return
SUCCESS
;
}
}
test/plugin/scenarios/graphql-8.x-scenario/src/main/resources/application.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
server
:
port
:
8080
servlet
:
context-path
:
/graphql-scenario
\ No newline at end of file
test/plugin/scenarios/graphql-8.x-scenario/support-version.list
0 → 100644
浏览文件 @
80a534b1
# 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
# "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.
# lists your version here
8.0
\ No newline at end of file
test/plugin/scenarios/graphql-9.x-scenario/bin/startup.sh
0 → 100644
浏览文件 @
80a534b1
#!/bin/bash
#
# 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.
home
=
"
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
"
java
-jar
${
agent_opts
}
${
home
}
/../libs/graphql-9.x-scenario.jar &
\ No newline at end of file
test/plugin/scenarios/graphql-9.x-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
80a534b1
# 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.
segmentItems
:
-
serviceName
:
graphql-9.x-scenario
segmentSize
:
gt
1
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
1
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
2
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
user
operationId
:
0
parentSpanId
:
0
spanId
:
3
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
users
operationId
:
0
parentSpanId
:
0
spanId
:
4
spanLayer
:
Unknown
startTime
:
nq
0
endTime
:
nq
0
componentId
:
92
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{logic-span=true}'
}
-
operationName
:
/graphql-scenario/case/graphql
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Http
startTime
:
nq
0
endTime
:
nq
0
componentId
:
1
isError
:
false
spanType
:
Entry
peer
:
'
'
tags
:
-
{
key
:
url
,
value
:
'
http://localhost:8080/graphql-scenario/case/graphql'
}
-
{
key
:
http.method
,
value
:
GET
}
skipAnalysis
:
'
false'
test/plugin/scenarios/graphql-9.x-scenario/configuration.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
type
:
jvm
entryService
:
http://localhost:8080/graphql-scenario/case/graphql
healthCheck
:
http://localhost:8080/graphql-scenario/case/healthCheck
startScript
:
./bin/startup.sh
test/plugin/scenarios/graphql-9.x-scenario/pom.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<groupId>
org.apache.skywalking.apm.testcase
</groupId>
<artifactId>
graphql-9.x-scenario
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<name>
skywalking-graphql-9.x-scenario
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<spring.boot.version>
2.1.6.RELEASE
</spring.boot.version>
<test.framework.version>
9.0
</test.framework.version>
<lombok.version>
1.18.10
</lombok.version>
<test.framework>
graphql
</test.framework>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring.boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.graphql-java
</groupId>
<artifactId>
graphql-java
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
graphql-9.x-scenario
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${compiler.version}
</source>
<target>
${compiler.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<id>
assemble
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
<outputDirectory>
./target/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
test/plugin/scenarios/graphql-9.x-scenario/src/main/assembly/assembly.xml
0 → 100644
浏览文件 @
80a534b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<formats>
<format>
zip
</format>
</formats>
<fileSets>
<fileSet>
<directory>
./bin
</directory>
<fileMode>
0775
</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>
${project.build.directory}/graphql-9.x-scenario.jar
</source>
<outputDirectory>
./libs
</outputDirectory>
<fileMode>
0775
</fileMode>
</file>
</files>
</assembly>
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/Application.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/configuration/GraphSchema.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.configuration
;
import
graphql.GraphQL
;
import
graphql.schema.GraphQLFieldDefinition
;
import
graphql.schema.GraphQLList
;
import
graphql.schema.GraphQLOutputType
;
import
graphql.schema.GraphQLSchema
;
import
org.apache.skywalking.apm.testcase.graphql.data.User
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
graphql
.
Scalars
.
GraphQLInt
;
import
static
graphql
.
Scalars
.
GraphQLString
;
import
static
graphql
.
schema
.
GraphQLArgument
.
newArgument
;
import
static
graphql
.
schema
.
GraphQLFieldDefinition
.
newFieldDefinition
;
import
static
graphql
.
schema
.
GraphQLObjectType
.
newObject
;
@Component
public
class
GraphSchema
{
private
graphql
.
schema
.
GraphQLSchema
schema
;
private
GraphQLOutputType
userType
;
@PostConstruct
public
void
init
()
{
initOutputType
();
schema
=
graphql
.
schema
.
GraphQLSchema
.
newSchema
().
query
(
newObject
()
.
name
(
"GraphQuery"
)
.
field
(
createUsersField
())
.
field
(
createUserField
())
.
build
()).
build
();
}
@Bean
public
GraphQL
graphQL
()
{
return
new
GraphQL
(
getSchema
());
}
private
void
initOutputType
()
{
userType
=
newObject
()
.
name
(
"User"
)
.
field
(
newFieldDefinition
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
field
(
newFieldDefinition
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
build
();
}
private
GraphQLFieldDefinition
createUserField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"user"
)
.
argument
(
newArgument
().
name
(
"id"
).
type
(
GraphQLInt
).
build
())
.
type
(
userType
)
.
dataFetcher
(
environment
->
{
int
id
=
environment
.
getArgument
(
"id"
);
try
{
Thread
.
sleep
(
300L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
User
user
=
new
User
();
user
.
setId
(
id
);
user
.
setName
(
"Name_"
+
id
);
return
user
;
})
.
build
();
}
private
GraphQLFieldDefinition
createUsersField
()
{
return
GraphQLFieldDefinition
.
newFieldDefinition
()
.
name
(
"users"
)
.
argument
(
newArgument
().
name
(
"page"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"size"
).
type
(
GraphQLInt
).
build
())
.
argument
(
newArgument
().
name
(
"name"
).
type
(
GraphQLString
).
build
())
.
type
(
new
GraphQLList
(
userType
))
.
dataFetcher
(
environment
->
{
int
page
=
environment
.
getArgument
(
"page"
);
int
size
=
environment
.
getArgument
(
"size"
);
String
name
=
environment
.
getArgument
(
"name"
);
try
{
Thread
.
sleep
(
100L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
List
<
User
>
list
=
new
ArrayList
<>(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
User
user
=
new
User
();
user
.
setId
(
i
);
user
.
setName
(
name
+
"_"
+
page
+
"_"
+
i
);
list
.
add
(
user
);
}
return
list
;
})
.
build
();
}
public
GraphQLSchema
getSchema
()
{
return
schema
;
}
}
\ No newline at end of file
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/controller/CaseController.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.controller
;
import
graphql.ExecutionInput
;
import
graphql.GraphQL
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/case"
)
public
class
CaseController
{
private
static
final
String
SUCCESS
=
"Success"
;
@Resource
private
GraphQL
graphQL
;
@RequestMapping
(
"/healthCheck"
)
@ResponseBody
public
String
healthCheck
()
{
return
SUCCESS
;
}
@RequestMapping
(
"/graphql"
)
@ResponseBody
public
String
graphql
()
{
String
query3
=
"{user(id:6) {id,name},users(page:2,size:5,name:\"john\") {id,name}}"
;
ExecutionInput
executionInput
=
ExecutionInput
.
newExecutionInput
().
query
(
query3
).
build
();
graphQL
.
execute
(
executionInput
);
graphQL
.
executeAsync
(
executionInput
);
return
SUCCESS
;
}
}
test/plugin/scenarios/graphql-9.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/graphql/data/User.java
0 → 100644
浏览文件 @
80a534b1
/*
* 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.apm.testcase.graphql.data
;
import
lombok.Data
;
@Data
public
class
User
{
private
int
id
;
private
String
name
;
}
\ No newline at end of file
test/plugin/scenarios/graphql-9.x-scenario/src/main/resources/application.yml
0 → 100644
浏览文件 @
80a534b1
# 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.
server
:
port
:
8080
servlet
:
context-path
:
/graphql-scenario
\ No newline at end of file
test/plugin/scenarios/graphql-9.x-scenario/support-version.list
0 → 100644
浏览文件 @
80a534b1
# 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
# "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.
# lists your version here
9.0
10.0
11.0
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录