Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
a862690e
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,发现更多精彩内容 >>
未验证
提交
a862690e
编写于
11月 28, 2017
作者:
wu-sheng
提交者:
GitHub
11月 28, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #623 from OpenSkywalking/featuren/improving-agent-debugging
Output all instrumented classes into physical files.
上级
9b5fdeb5
4ef5b1dc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
95 addition
and
5 deletion
+95
-5
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
.../main/java/org/skywalking/apm/agent/core/conf/Config.java
+6
-0
apm-sniffer/apm-agent/src/main/java/org/skywalking/apm/agent/InstrumentDebuggingClass.java
...va/org/skywalking/apm/agent/InstrumentDebuggingClass.java
+71
-0
apm-sniffer/apm-agent/src/main/java/org/skywalking/apm/agent/SkyWalkingAgent.java
...c/main/java/org/skywalking/apm/agent/SkyWalkingAgent.java
+10
-5
apm-sniffer/config/agent.config
apm-sniffer/config/agent.config
+4
-0
docs/cn/Deploy-skywalking-agent-CN.md
docs/cn/Deploy-skywalking-agent-CN.md
+4
-0
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
浏览文件 @
a862690e
...
...
@@ -52,6 +52,12 @@ public class Config {
* memory cost estimated.
*/
public
static
int
SPAN_LIMIT_PER_SEGMENT
=
300
;
/**
* If true, skywalking agent will save all instrumented classes files in `/debugging` folder.
* Skywalking team may ask for these files in order to resolve compatible problem.
*/
public
static
boolean
IS_OPEN_DEBUGGING_CLASS
=
false
;
}
public
static
class
Collector
{
...
...
apm-sniffer/apm-agent/src/main/java/org/skywalking/apm/agent/InstrumentDebuggingClass.java
0 → 100644
浏览文件 @
a862690e
/*
* 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
;
import
java.io.File
;
import
java.io.IOException
;
import
net.bytebuddy.description.type.TypeDescription
;
import
net.bytebuddy.dynamic.DynamicType
;
import
org.skywalking.apm.agent.core.boot.AgentPackageNotFoundException
;
import
org.skywalking.apm.agent.core.boot.AgentPackagePath
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.logging.api.ILog
;
import
org.skywalking.apm.agent.core.logging.api.LogManager
;
/**
* @author wu-sheng
*/
public
enum
InstrumentDebuggingClass
{
INSTANCE
;
private
static
final
ILog
logger
=
LogManager
.
getLogger
(
InstrumentDebuggingClass
.
class
);
private
File
debuggingClassesRootPath
;
public
void
log
(
TypeDescription
typeDescription
,
DynamicType
dynamicType
)
{
if
(!
Config
.
Agent
.
IS_OPEN_DEBUGGING_CLASS
)
{
return
;
}
/**
* try to do I/O things in synchronized way, to avoid unexpected situations.
*/
synchronized
(
INSTANCE
)
{
try
{
if
(
debuggingClassesRootPath
==
null
)
{
try
{
debuggingClassesRootPath
=
new
File
(
AgentPackagePath
.
getPath
(),
"/debugging"
);
if
(!
debuggingClassesRootPath
.
exists
())
{
debuggingClassesRootPath
.
mkdir
();
}
}
catch
(
AgentPackageNotFoundException
e
)
{
logger
.
error
(
e
,
"Can't find the root path for creating /debugging folder."
);
}
}
try
{
dynamicType
.
saveIn
(
debuggingClassesRootPath
);
}
catch
(
IOException
e
)
{
logger
.
error
(
e
,
"Can't save class {} to file."
+
typeDescription
.
getActualName
());
}
}
catch
(
Throwable
t
)
{
logger
.
error
(
t
,
"Save debugging classes fail."
);
}
}
}
}
apm-sniffer/apm-agent/src/main/java/org/skywalking/apm/agent/SkyWalkingAgent.java
浏览文件 @
a862690e
...
...
@@ -18,6 +18,8 @@
package
org.skywalking.apm.agent
;
import
java.lang.instrument.Instrumentation
;
import
java.util.List
;
import
net.bytebuddy.agent.builder.AgentBuilder
;
import
net.bytebuddy.description.type.TypeDescription
;
import
net.bytebuddy.dynamic.DynamicType
;
...
...
@@ -26,10 +28,11 @@ import org.skywalking.apm.agent.core.boot.ServiceManager;
import
org.skywalking.apm.agent.core.conf.SnifferConfigInitializer
;
import
org.skywalking.apm.agent.core.logging.api.ILog
;
import
org.skywalking.apm.agent.core.logging.api.LogManager
;
import
org.skywalking.apm.agent.core.plugin.*
;
import
java.lang.instrument.Instrumentation
;
import
java.util.List
;
import
org.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine
;
import
org.skywalking.apm.agent.core.plugin.EnhanceContext
;
import
org.skywalking.apm.agent.core.plugin.PluginBootstrap
;
import
org.skywalking.apm.agent.core.plugin.PluginException
;
import
org.skywalking.apm.agent.core.plugin.PluginFinder
;
/**
* The main entrance of sky-waking agent,
...
...
@@ -103,6 +106,8 @@ public class SkyWalkingAgent {
if
(
logger
.
isDebugEnable
())
{
logger
.
debug
(
"On Transformation class {}."
,
typeDescription
.
getName
());
}
InstrumentDebuggingClass
.
INSTANCE
.
log
(
typeDescription
,
dynamicType
);
}
@Override
...
...
@@ -113,7 +118,7 @@ public class SkyWalkingAgent {
@Override
public
void
onError
(
String
typeName
,
ClassLoader
classLoader
,
JavaModule
module
,
boolean
loaded
,
Throwable
throwable
)
{
logger
.
error
(
"
Failed to enhance class "
+
typeName
,
throwable
);
logger
.
error
(
"
Enhance class "
+
typeName
+
" error."
,
throwable
);
}
@Override
...
...
apm-sniffer/config/agent.config
浏览文件 @
a862690e
...
...
@@ -12,6 +12,10 @@ agent.application_code=Your_ApplicationName
# Ignore the segments if their operation names start with these suffix.
# agent.ignore_suffix=.jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg
# If true, skywalking agent will save all instrumented classes files in `/debugging` folder.
# Skywalking team may ask for these files in order to resolve compatible problem.
# agent.is_open_debugging_class = true
# Server addresses.
# Mapping to `agent_server/jetty/port` in `config/application.yml` of Collector.
# Examples:
...
...
docs/cn/Deploy-skywalking-agent-CN.md
浏览文件 @
a862690e
...
...
@@ -38,6 +38,10 @@ agent.application_code=Your_ApplicationName
# 默认配置如下
# agent.ignore_suffix=.jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg
# 探针调试开关,如果设置为true,探针会将所有操作字节码的类输出到/debugging目录下
# skywalking团队可能在调试,需要此文件
# agent.is_open_debugging_class = true
# 对应Collector的config/application.yml配置文件中 agent_server/jetty/port 配置内容
# 例如:
# 单节点配置:SERVERS="127.0.0.1:8080"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录