Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gdyjdao
SkyWalking
提交
45cbf8b5
S
SkyWalking
项目概览
gdyjdao
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
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,体验更适合开发者的 AI 搜索 >>
提交
45cbf8b5
编写于
7月 27, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add OS Info when register and registerRecover.
上级
426d339a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
0 deletion
+93
-0
apm-network/src/main/proto/DiscoveryService.proto
apm-network/src/main/proto/DiscoveryService.proto
+8
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/os/OSUtil.java
...rc/main/java/org/skywalking/apm/agent/core/os/OSUtil.java
+82
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
...ng/apm/agent/core/remote/AppAndServiceRegisterClient.java
+3
-0
未找到文件。
apm-network/src/main/proto/DiscoveryService.proto
浏览文件 @
45cbf8b5
...
@@ -22,6 +22,7 @@ message ApplicationInstance {
...
@@ -22,6 +22,7 @@ message ApplicationInstance {
int32
applicationId
=
1
;
int32
applicationId
=
1
;
string
agentUUID
=
2
;
string
agentUUID
=
2
;
int64
registerTime
=
3
;
int64
registerTime
=
3
;
OSInfo
osinfo
=
4
;
}
}
message
ApplicationInstanceMapping
{
message
ApplicationInstanceMapping
{
...
@@ -33,6 +34,7 @@ message ApplicationInstanceRecover {
...
@@ -33,6 +34,7 @@ message ApplicationInstanceRecover {
int32
applicationId
=
1
;
int32
applicationId
=
1
;
int32
applicationInstanceId
=
2
;
int32
applicationInstanceId
=
2
;
int64
registerTime
=
3
;
int64
registerTime
=
3
;
OSInfo
osinfo
=
4
;
}
}
message
ApplicationInstanceHeartbeat
{
message
ApplicationInstanceHeartbeat
{
...
@@ -40,6 +42,12 @@ message ApplicationInstanceHeartbeat {
...
@@ -40,6 +42,12 @@ message ApplicationInstanceHeartbeat {
int64
heartbeatTime
=
2
;
int64
heartbeatTime
=
2
;
}
}
message
OSInfo
{
string
osName
=
1
;
string
hostname
=
2
;
repeated
string
ipv4s
=
3
;
}
//discovery service for ServiceName by Network address or application code
//discovery service for ServiceName by Network address or application code
service
ServiceNameDiscoveryService
{
service
ServiceNameDiscoveryService
{
rpc
discovery
(
ServiceNameCollection
)
returns
(
ServiceNameMappingCollection
)
{
rpc
discovery
(
ServiceNameCollection
)
returns
(
ServiceNameMappingCollection
)
{
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/os/OSUtil.java
0 → 100644
浏览文件 @
45cbf8b5
package
org.skywalking.apm.agent.core.os
;
import
java.net.Inet4Address
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.net.UnknownHostException
;
import
java.util.Enumeration
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.skywalking.apm.network.proto.OSInfo
;
/**
* @author wusheng
*/
public
class
OSUtil
{
private
static
volatile
String
OS_NAME
;
private
static
volatile
String
HOST_NAME
;
private
static
volatile
List
<
String
>
IPV4_LIST
;
public
static
String
getOsName
()
{
if
(
OS_NAME
==
null
)
{
OS_NAME
=
System
.
getProperty
(
"os.name"
);
}
return
OS_NAME
;
}
public
static
String
getHostName
()
{
if
(
HOST_NAME
==
null
)
{
try
{
InetAddress
host
=
InetAddress
.
getLocalHost
();
HOST_NAME
=
host
.
getHostName
();
}
catch
(
UnknownHostException
e
)
{
HOST_NAME
=
"unknown"
;
}
}
return
HOST_NAME
;
}
public
static
List
<
String
>
getAllIPV4
()
{
if
(
IPV4_LIST
==
null
)
{
IPV4_LIST
=
new
LinkedList
<
String
>();
try
{
Enumeration
<
NetworkInterface
>
interfs
=
NetworkInterface
.
getNetworkInterfaces
();
while
(
interfs
.
hasMoreElements
())
{
NetworkInterface
networkInterface
=
interfs
.
nextElement
();
Enumeration
<
InetAddress
>
inetAddresses
=
networkInterface
.
getInetAddresses
();
while
(
inetAddresses
.
hasMoreElements
())
{
InetAddress
address
=
inetAddresses
.
nextElement
();
if
(
address
instanceof
Inet4Address
)
{
String
addressStr
=
address
.
getHostAddress
();
if
(
"127.0.0.1"
.
equals
(
addressStr
))
{
continue
;
}
IPV4_LIST
.
add
(
addressStr
);
}
}
}
}
catch
(
SocketException
e
)
{
}
}
return
IPV4_LIST
;
}
public
static
OSInfo
buildOSInfo
()
{
OSInfo
.
Builder
builder
=
OSInfo
.
newBuilder
();
String
osName
=
getOsName
();
if
(
osName
!=
null
)
{
builder
.
setOsName
(
osName
);
}
String
hostName
=
getHostName
();
if
(
hostName
!=
null
)
{
builder
.
setHostname
(
hostName
);
}
List
<
String
>
allIPV4
=
getAllIPV4
();
if
(
allIPV4
.
size
()
>
0
)
{
builder
.
addAllIpv4S
(
allIPV4
);
}
return
builder
.
build
();
}
}
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
浏览文件 @
45cbf8b5
...
@@ -15,6 +15,7 @@ import org.skywalking.apm.agent.core.context.trace.TraceSegment;
...
@@ -15,6 +15,7 @@ import org.skywalking.apm.agent.core.context.trace.TraceSegment;
import
org.skywalking.apm.agent.core.dictionary.ApplicationDictionary
;
import
org.skywalking.apm.agent.core.dictionary.ApplicationDictionary
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryUtil
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryUtil
;
import
org.skywalking.apm.agent.core.dictionary.OperationNameDictionary
;
import
org.skywalking.apm.agent.core.dictionary.OperationNameDictionary
;
import
org.skywalking.apm.agent.core.os.OSUtil
;
import
org.skywalking.apm.logging.ILog
;
import
org.skywalking.apm.logging.ILog
;
import
org.skywalking.apm.logging.LogManager
;
import
org.skywalking.apm.logging.LogManager
;
import
org.skywalking.apm.network.proto.Application
;
import
org.skywalking.apm.network.proto.Application
;
...
@@ -104,6 +105,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
...
@@ -104,6 +105,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
.
setApplicationId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_ID
)
.
setApplicationId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_ID
)
.
setAgentUUID
(
PROCESS_UUID
)
.
setAgentUUID
(
PROCESS_UUID
)
.
setRegisterTime
(
System
.
currentTimeMillis
())
.
setRegisterTime
(
System
.
currentTimeMillis
())
.
setOsinfo
(
OSUtil
.
buildOSInfo
())
.
build
());
.
build
());
if
(
instanceMapping
.
getApplicationInstanceId
()
!=
DictionaryUtil
.
nullValue
())
{
if
(
instanceMapping
.
getApplicationInstanceId
()
!=
DictionaryUtil
.
nullValue
())
{
RemoteDownstreamConfig
.
Agent
.
APPLICATION_INSTANCE_ID
RemoteDownstreamConfig
.
Agent
.
APPLICATION_INSTANCE_ID
...
@@ -115,6 +117,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
...
@@ -115,6 +117,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
.
setApplicationId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_ID
)
.
setApplicationId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_ID
)
.
setApplicationInstanceId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_INSTANCE_ID
)
.
setApplicationInstanceId
(
RemoteDownstreamConfig
.
Agent
.
APPLICATION_INSTANCE_ID
)
.
setRegisterTime
(
System
.
currentTimeMillis
())
.
setRegisterTime
(
System
.
currentTimeMillis
())
.
setOsinfo
(
OSUtil
.
buildOSInfo
())
.
build
());
.
build
());
}
else
{
}
else
{
if
(
lastSegmentTime
-
System
.
currentTimeMillis
()
>
60
*
1000
)
{
if
(
lastSegmentTime
-
System
.
currentTimeMillis
()
>
60
*
1000
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录