Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
c1c39465
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
c1c39465
编写于
10月 13, 2017
作者:
G
Gao Hongtao
提交者:
GitHub
10月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into master
上级
086c5ac0
c4098a23
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
109 addition
and
20 deletion
+109
-20
README_ZH.md
README_ZH.md
+1
-1
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java
...ntstream/worker/segment/cost/SegmentCostSpanListener.java
+7
-5
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactory.java
...alking/apm/agent/core/boot/DefaultNamedThreadFactory.java
+39
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/NoopSpan.java
...org/skywalking/apm/agent/core/context/trace/NoopSpan.java
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/jvm/JVMService.java
...in/java/org/skywalking/apm/agent/core/jvm/JVMService.java
+3
-3
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
...ng/apm/agent/core/remote/AppAndServiceRegisterClient.java
+3
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
...king/apm/agent/core/remote/CollectorDiscoveryService.java
+2
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/GRPCChannelManager.java
.../skywalking/apm/agent/core/remote/GRPCChannelManager.java
+10
-7
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/sampling/SamplingService.java
...g/skywalking/apm/agent/core/sampling/SamplingService.java
+2
-1
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
...ng/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
+41
-0
未找到文件。
README_ZH.md
浏览文件 @
c1c39465
...
...
@@ -12,7 +12,7 @@ Sky Walking | [English](README.md)
*
自动java探针,
**不需要修改应用程序源代码**
*
高性能探针,针对单实例5000tps的应用,在
**不需要采样
的情况下**
,只增加
**10%**
的CPU开销。
* 高性能探针,针对单实例5000tps的应用,在**全量采集
的情况下**,只增加**10%*
*
的CPU开销。
*
[
中间件,框架与类库支持列表
](
https://github.com/wu-sheng/sky-walking/wiki/3.2-supported-list
)
.
*
手动探针
*
[
使用OpenTracing手动探针API
](
http://opentracing.io/documentation/pages/supported-tracers
)
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java
浏览文件 @
c1c39465
...
...
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
/**
* @author pengys5
*/
public
class
SegmentCostSpanListener
implements
EntrySpanListener
,
ExitSpanListener
,
LocalSpanListener
,
FirstSpanListener
{
public
class
SegmentCostSpanListener
implements
EntrySpanListener
,
ExitSpanListener
,
LocalSpanListener
,
FirstSpanListener
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SegmentCostSpanListener
.
class
);
...
...
@@ -50,10 +50,7 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe
@Override
public
void
parseFirst
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
timeBucket
=
TimeBucketUtils
.
INSTANCE
.
getMinuteTimeBucket
(
spanObject
.
getStartTime
());
}
@Override
public
void
parseEntry
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
SegmentCostDataDefine
.
SegmentCost
segmentCost
=
new
SegmentCostDataDefine
.
SegmentCost
();
segmentCost
.
setSegmentId
(
segmentId
);
segmentCost
.
setApplicationId
(
applicationId
);
...
...
@@ -71,6 +68,11 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe
isError
=
isError
||
spanObject
.
getIsError
();
}
@Override
public
void
parseEntry
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
isError
=
isError
||
spanObject
.
getIsError
();
}
@Override
public
void
parseExit
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
isError
=
isError
||
spanObject
.
getIsError
();
...
...
@@ -96,4 +98,4 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe
}
}
}
}
\ No newline at end of file
}
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactory.java
0 → 100644
浏览文件 @
c1c39465
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.agent.core.boot
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* @author zhangkewei
*/
public
class
DefaultNamedThreadFactory
implements
ThreadFactory
{
private
static
final
AtomicInteger
BOOT_SERVICE_SEQ
=
new
AtomicInteger
(
0
);
private
final
AtomicInteger
threadSeq
=
new
AtomicInteger
(
0
);
private
final
String
namePrefix
;
public
DefaultNamedThreadFactory
(
String
name
)
{
namePrefix
=
"SkywalkingAgent-"
+
BOOT_SERVICE_SEQ
.
incrementAndGet
()
+
"-"
+
name
+
"-"
;
}
@Override
public
Thread
newThread
(
Runnable
r
)
{
Thread
t
=
new
Thread
(
r
,
namePrefix
+
threadSeq
.
getAndIncrement
());
t
.
setDaemon
(
true
);
return
t
;
}
}
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/NoopSpan.java
浏览文件 @
c1c39465
...
...
@@ -39,7 +39,7 @@ public class NoopSpan implements AbstractSpan {
}
@Override
public
AbstractSpan
errorOccurred
()
{
return
null
;
return
this
;
}
public
void
finish
()
{
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/jvm/JVMService.java
浏览文件 @
c1c39465
...
...
@@ -25,6 +25,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
...
...
@@ -57,7 +58,6 @@ public class JVMService implements BootService, Runnable {
private
volatile
ScheduledFuture
<?>
collectMetricFuture
;
private
volatile
ScheduledFuture
<?>
sendMetricFuture
;
private
Sender
sender
;
@Override
public
void
beforeBoot
()
throws
Throwable
{
queue
=
new
LinkedBlockingQueue
(
Config
.
Jvm
.
BUFFER_SIZE
);
...
...
@@ -68,10 +68,10 @@ public class JVMService implements BootService, Runnable {
@Override
public
void
boot
()
throws
Throwable
{
collectMetricFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"JVMService-produce"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
1
,
TimeUnit
.
SECONDS
);
sendMetricFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"JVMService-consume"
)
)
.
scheduleAtFixedRate
(
sender
,
0
,
1
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
浏览文件 @
c1c39465
...
...
@@ -24,6 +24,7 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
...
...
@@ -89,7 +90,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
@Override
public
void
boot
()
throws
Throwable
{
applicationRegisterFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"AppAndServiceRegisterClient"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
Config
.
Collector
.
APP_AND_SERVICE_REGISTER_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
...
...
@@ -105,6 +106,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
@Override
public
void
run
()
{
logger
.
debug
(
"AppAndServiceRegisterClient running, status:{}."
,
status
);
boolean
shouldTry
=
true
;
while
(
CONNECTED
.
equals
(
status
)
&&
shouldTry
)
{
shouldTry
=
false
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
浏览文件 @
c1c39465
...
...
@@ -22,6 +22,7 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.Config
;
/**
...
...
@@ -39,7 +40,7 @@ public class CollectorDiscoveryService implements BootService {
@Override
public
void
boot
()
throws
Throwable
{
future
=
Executors
.
newSingleThreadScheduledExecutor
()
future
=
Executors
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"CollectorDiscoveryService"
)
)
.
scheduleAtFixedRate
(
new
DiscoveryRestServiceClient
(),
0
,
Config
.
Collector
.
DISCOVERY_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/GRPCChannelManager.java
浏览文件 @
c1c39465
...
...
@@ -32,12 +32,12 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
import
org.skywalking.apm.logging.ILog
;
import
org.skywalking.apm.logging.LogManager
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
conf
.
Config
.
Collector
.
GRPC_CHANNEL_CHECK_INTERVAL
;
/**
* @author wusheng
*/
...
...
@@ -58,8 +58,8 @@ public class GRPCChannelManager implements BootService, Runnable {
@Override
public
void
boot
()
throws
Throwable
{
connectCheckFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
scheduleAtFixedRate
(
this
,
0
,
GRPC_CHANNEL_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"GRPCChannelManager"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
Config
.
Collector
.
GRPC_CHANNEL_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
@Override
...
...
@@ -71,15 +71,18 @@ public class GRPCChannelManager implements BootService, Runnable {
public
void
shutdown
()
throws
Throwable
{
connectCheckFuture
.
cancel
(
true
);
managedChannel
.
shutdownNow
();
logger
.
debug
(
"Selected collector grpc service shutdown."
);
}
@Override
public
void
run
()
{
logger
.
debug
(
"Selected collector grpc service running, reconnect:{}."
,
reconnect
);
if
(
reconnect
)
{
if
(
RemoteDownstreamConfig
.
Collector
.
GRPC_SERVERS
.
size
()
>
0
)
{
int
index
=
random
.
nextInt
()
%
RemoteDownstreamConfig
.
Collector
.
GRPC_SERVERS
.
size
();
String
server
=
RemoteDownstreamConfig
.
Collector
.
GRPC_SERVERS
.
get
(
index
);
String
server
=
""
;
try
{
int
index
=
Math
.
abs
(
random
.
nextInt
())
%
RemoteDownstreamConfig
.
Collector
.
GRPC_SERVERS
.
size
();
server
=
RemoteDownstreamConfig
.
Collector
.
GRPC_SERVERS
.
get
(
index
);
String
[]
ipAndPort
=
server
.
split
(
":"
);
ManagedChannelBuilder
<?>
channelBuilder
=
NettyChannelBuilder
.
forAddress
(
ipAndPort
[
0
],
Integer
.
parseInt
(
ipAndPort
[
1
]))
...
...
@@ -100,7 +103,7 @@ public class GRPCChannelManager implements BootService, Runnable {
}
}
logger
.
debug
(
"Selected collector grpc service is not available. Wait {} seconds to retry"
,
GRPC_CHANNEL_CHECK_INTERVAL
);
logger
.
debug
(
"Selected collector grpc service is not available. Wait {} seconds to retry"
,
Config
.
Collector
.
GRPC_CHANNEL_CHECK_INTERVAL
);
}
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/sampling/SamplingService.java
浏览文件 @
c1c39465
...
...
@@ -24,6 +24,7 @@ import java.util.concurrent.ScheduledFuture;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.skywalking.apm.logging.ILog
;
...
...
@@ -63,7 +64,7 @@ public class SamplingService implements BootService {
on
=
true
;
this
.
resetSamplingFactor
();
ScheduledExecutorService
service
=
Executors
.
newSingleThreadScheduledExecutor
();
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"SamplingService"
)
);
scheduledFuture
=
service
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
0 → 100644
浏览文件 @
c1c39465
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.agent.core.boot
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* @author zhangkewei
*/
public
class
DefaultNamedThreadFactoryTest
{
@Test
public
void
testNamedThread
()
throws
Exception
{
Thread
newThread
=
new
DefaultNamedThreadFactory
(
"DefaultNamedThreadFactoryTest"
).
newThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
}
});
newThread
.
start
();
assertNotNull
(
newThread
.
getName
());
assert
(
newThread
.
getName
().
contains
(
"DefaultNamedThreadFactoryTest"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录