Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
11212c40
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
11212c40
编写于
4月 16, 2019
作者:
I
IluckySi
提交者:
wu-sheng
4月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify some spell error and prompt error (#2488)
上级
73cdce57
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
17 deletion
+17
-17
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
...ava/org/apache/skywalking/apm/agent/core/conf/Config.java
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
...walking/apm/agent/core/conf/SnifferConfigInitializer.java
+15
-15
apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java
...java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java
+1
-1
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
浏览文件 @
11212c40
...
...
@@ -40,7 +40,7 @@ public class Config {
public
static
String
NAMESPACE
=
""
;
/**
*
Application cod
e is showed in skywalking-ui. Suggestion: set a unique name for each service,
*
Service nam
e is showed in skywalking-ui. Suggestion: set a unique name for each service,
* service instance nodes share the same code
*/
public
static
String
SERVICE_NAME
=
""
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
浏览文件 @
11212c40
...
...
@@ -54,11 +54,11 @@ public class SnifferConfigInitializer {
* specified agent config path is not set , the agent will try to locate `agent.config`, which should be in the
* /config dictionary of agent package.
* <p>
* Also try to override the config by system.
env and system.properties. All the keys in these two places
should
* start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.
application_cod
e=yourAppName` to override
* `agent.
application_cod
e` in config file.
* Also try to override the config by system.
properties. All the keys in this place
should
* start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.
service_nam
e=yourAppName` to override
* `agent.
service_nam
e` in config file.
* <p>
* At the end, `agent.
application_cod
e` and `collector.servers` must be not blank.
* At the end, `agent.
service_nam
e` and `collector.servers` must be not blank.
*/
public
static
void
initialize
(
String
agentOptions
)
throws
ConfigNotFoundException
,
AgentPackageNotFoundException
{
InputStreamReader
configFileStream
;
...
...
@@ -80,7 +80,7 @@ public class SnifferConfigInitializer {
try
{
overrideConfigBySystemProp
();
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
"Failed to read the system
env
."
);
logger
.
error
(
e
,
"Failed to read the system
properties
."
);
}
if
(!
StringUtil
.
isEmpty
(
agentOptions
))
{
...
...
@@ -95,10 +95,10 @@ public class SnifferConfigInitializer {
}
if
(
StringUtil
.
isEmpty
(
Config
.
Agent
.
SERVICE_NAME
))
{
throw
new
ExceptionInInitializerError
(
"`agent.service_
cod
e` is missing."
);
throw
new
ExceptionInInitializerError
(
"`agent.service_
nam
e` is missing."
);
}
if
(
StringUtil
.
isEmpty
(
Config
.
Collector
.
BACKEND_SERVICE
))
{
throw
new
ExceptionInInitializerError
(
"`collector.
direct_servers` and `collector.servers` cannot be empty at the same time
."
);
throw
new
ExceptionInInitializerError
(
"`collector.
backend_service` is missing
."
);
}
IS_INIT_COMPLETED
=
true
;
...
...
@@ -149,12 +149,11 @@ public class SnifferConfigInitializer {
}
/**
* Override the config by system properties. The
env key must start with `skywalking`, the reus
lt should be as same
* Override the config by system properties. The
property key must start with `skywalking`, the resu
lt should be as same
* as in `agent.config`
* <p>
* such as:
Env key of `agent.application_code` shoule be `skywalking.agent.application_cod
e`
* such as:
Property key of `agent.service_name` should be `skywalking.agent.service_nam
e`
*
* @return the config file {@link InputStream}, or null if not needEnhance.
*/
private
static
void
overrideConfigBySystemProp
()
throws
IllegalAccessException
{
Properties
properties
=
new
Properties
();
...
...
@@ -162,8 +161,9 @@ public class SnifferConfigInitializer {
Iterator
<
Map
.
Entry
<
Object
,
Object
>>
entryIterator
=
systemProperties
.
entrySet
().
iterator
();
while
(
entryIterator
.
hasNext
())
{
Map
.
Entry
<
Object
,
Object
>
prop
=
entryIterator
.
next
();
if
(
prop
.
getKey
().
toString
().
startsWith
(
ENV_KEY_PREFIX
))
{
String
realKey
=
prop
.
getKey
().
toString
().
substring
(
ENV_KEY_PREFIX
.
length
());
String
key
=
prop
.
getKey
().
toString
();
if
(
key
.
startsWith
(
ENV_KEY_PREFIX
))
{
String
realKey
=
key
.
substring
(
ENV_KEY_PREFIX
.
length
());
properties
.
put
(
realKey
,
prop
.
getValue
());
}
}
...
...
@@ -189,11 +189,11 @@ public class SnifferConfigInitializer {
return
new
InputStreamReader
(
new
FileInputStream
(
configFile
),
"UTF-8"
);
}
catch
(
FileNotFoundException
e
)
{
throw
new
ConfigNotFoundException
(
"Fail to load agent.config"
,
e
);
throw
new
ConfigNotFoundException
(
"Fail
ed
to load agent.config"
,
e
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
ConfigReadFailedException
(
"Fail to load agent.config"
,
e
);
throw
new
ConfigReadFailedException
(
"Fail
ed
to load agent.config"
,
e
);
}
}
throw
new
ConfigNotFoundException
(
"Fail
to load agent config file
."
);
throw
new
ConfigNotFoundException
(
"Fail
ed to load agent.config
."
);
}
}
apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java
浏览文件 @
11212c40
...
...
@@ -40,7 +40,7 @@ import java.util.List;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.*;
/**
* The main entrance of sky-waking agent, based on javaagent mechanism.
* The main entrance of sky-wa
l
king agent, based on javaagent mechanism.
*
* @author wusheng
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录