Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
d6696ad2
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
d6696ad2
编写于
3月 22, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix database plugin missing tag span.kind.
上级
5f6dd33c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
15 addition
and
12 deletion
+15
-12
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java
...i/src/main/java/com/a/eye/skywalking/api/conf/Config.java
+1
-1
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/sampling/SamplingService.java
...va/com/a/eye/skywalking/api/sampling/SamplingService.java
+8
-9
skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api/sampling/SamplingServiceTest.java
...om/a/eye/skywalking/api/sampling/SamplingServiceTest.java
+2
-2
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/CallableStatementTracing.java
.../eye/skywalking/plugin/jdbc/CallableStatementTracing.java
+1
-0
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
...a/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
+1
-0
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
.../eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
+1
-0
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
...va/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
+1
-0
未找到文件。
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java
浏览文件 @
d6696ad2
...
...
@@ -9,7 +9,7 @@ public class Config {
public
static
String
PATH
=
""
;
public
static
int
SAMPLING_
RATE
=
10000
;
public
static
int
SAMPLING_
CYCLE
=
1
;
}
public
static
class
Collector
{
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/sampling/SamplingService.java
浏览文件 @
d6696ad2
...
...
@@ -12,7 +12,7 @@ import com.a.eye.skywalking.trace.TraceSegment;
* have been traced, but, considering CPU cost of serialization/deserialization, and network bandwidth, the agent do NOT
* send all of them to collector, if SAMPLING is on.
*
* By default, SAMPLING is off, and {@link Config.Agent#SAMPLING_
RATE} == 1000
.
* By default, SAMPLING is off, and {@link Config.Agent#SAMPLING_
CYCLE} == 1
.
*
* @author wusheng
*/
...
...
@@ -20,26 +20,25 @@ public class SamplingService implements BootService {
private
static
ILog
logger
=
LogManager
.
getLogger
(
SamplingService
.
class
);
private
volatile
boolean
on
=
false
;
private
volatile
int
rate
=
0
;
private
volatile
int
rollingSeed
=
1
;
@Override
public
void
bootUp
()
throws
Throwable
{
if
(
Config
.
Agent
.
SAMPLING_RATE
==
10000
)
{
if
(
Config
.
Agent
.
SAMPLING_CYCLE
==
1
)
{
this
.
on
=
false
;
return
;
}
if
(
Config
.
Agent
.
SAMPLING_
RATE
>
10000
||
Config
.
Agent
.
SAMPLING_RAT
E
<
1
)
{
throw
new
IllegalSamplingRateException
(
"sampling
rate should stay in (0, 10000]
."
);
if
(
Config
.
Agent
.
SAMPLING_
CYCL
E
<
1
)
{
throw
new
IllegalSamplingRateException
(
"sampling
cycle must greater than 0
."
);
}
rate
=
10000
/
Config
.
Agent
.
SAMPLING_RATE
;
on
=
true
;
this
.
on
=
true
;
logger
.
debug
(
"The trace sampling is on, and the sampling
rate is: {}"
,
rate
);
logger
.
debug
(
"The trace sampling is on, and the sampling
cycle is: {}"
,
Config
.
Agent
.
SAMPLING_CYCLE
);
}
public
void
trySampling
(
TraceSegment
segment
)
{
if
(
on
)
{
if
(
rollingSeed
%
rate
!=
0
)
{
if
(
rollingSeed
%
Config
.
Agent
.
SAMPLING_CYCLE
!=
0
)
{
segment
.
setSampled
(
false
);
}
rollingSeed
++;
...
...
skywalking-sniffer/skywalking-api/src/test/java/com/a/eye/skywalking/api/sampling/SamplingServiceTest.java
浏览文件 @
d6696ad2
...
...
@@ -13,7 +13,7 @@ import org.junit.Test;
public
class
SamplingServiceTest
{
@Test
public
void
test50Percent
(){
Config
.
Agent
.
SAMPLING_
RATE
=
5000
;
Config
.
Agent
.
SAMPLING_
CYCLE
=
2
;
ServiceManager
.
INSTANCE
.
boot
();
TraceSegment
segment
=
new
TraceSegment
();
...
...
@@ -30,7 +30,7 @@ public class SamplingServiceTest {
@AfterClass
public
static
void
clear
(){
Config
.
Agent
.
SAMPLING_
RATE
=
10000
;
Config
.
Agent
.
SAMPLING_
CYCLE
=
1
;
ServiceManager
.
INSTANCE
.
boot
();
}
}
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/CallableStatementTracing.java
浏览文件 @
d6696ad2
...
...
@@ -24,6 +24,7 @@ public class CallableStatementTracing {
try
{
Span
span
=
ContextManager
.
createSpan
(
connectInfo
.
getDBType
()
+
"/JDBI/CallableStatement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
Tags
.
SPAN_LAYER
.
asDB
(
span
);
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/ConnectionTracing.java
浏览文件 @
d6696ad2
...
...
@@ -24,6 +24,7 @@ public class ConnectionTracing {
try
{
Span
span
=
ContextManager
.
createSpan
(
connectInfo
.
getDBType
()
+
"/JDBI/Connection/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
Tags
.
COMPONENT
.
set
(
span
,
connectInfo
.
getDBType
());
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/PreparedStatementTracing.java
浏览文件 @
d6696ad2
...
...
@@ -23,6 +23,7 @@ public class PreparedStatementTracing {
try
{
Span
span
=
ContextManager
.
createSpan
(
connectInfo
.
getDBType
()
+
"/JDBI/PreparedStatement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
Tags
.
COMPONENT
.
set
(
span
,
connectInfo
.
getDBType
());
...
...
skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/a/eye/skywalking/plugin/jdbc/StatementTracing.java
浏览文件 @
d6696ad2
...
...
@@ -23,6 +23,7 @@ public class StatementTracing {
try
{
Span
span
=
ContextManager
.
createSpan
(
connectInfo
.
getDBType
()
+
"/JDBI/Statement/"
+
method
);
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_CLIENT
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
Tags
.
COMPONENT
.
set
(
span
,
connectInfo
.
getDBType
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录