forked from didi/sharingan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangjing
committed
Apr 15, 2020
1 parent
45685e1
commit 0896082
Showing
37 changed files
with
933 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
### 噪音/DSL/模块_http接口说明 | ||
|
||
回放时,噪音、DSL 根据 [本地回放](../README.md#4本地回放) 和 非本地回放 的不同,分别上报到不同的地方;而模块信息也会读取自不同的来源:[回放模块配置](./conf/moduleinfo.md)。 | ||
<br> | ||
|
||
回放时,噪音、DSL 根据 [本地回放](../README.md#4本地回放) 和 非本地回放 的不同,分别上报到不同的地方;模块信息也会读取自不同的来源:[回放模块配置](./conf/moduleinfo.md)。 | ||
|
||
* 本地回放:噪音 上报到本机 [conf/noise/](../../../replayer-agent/conf/noise) 目录下,DSL 上报到本机 [conf/dsl/](../../../replayer-agent/conf/dsl) 目录下,模块信息读取自本地配置。 | ||
* 非本地回放:噪音、DSL 上报到 [conf/app.toml](../../../replayer-agent/conf/app.toml) 下 [http_api]小节 配置的http接口。模块信息也读取自该配置接口。 | ||
|
||
回放Agent默认配置的是本地回放,因此,对于想将 噪音、DSL、模块信息 存入数据库,而非本地配置文件的同学,可以参考下面的接口说明,实现接口即可。 | ||
|
||
<br> | ||
|
||
下面逐个接口说明: | ||
回放Agent默认配置的是本地回放;对于想将 噪音、DSL、模块信息存入数据库的同学,请仔细阅读下面接口说明。 | ||
> 温馨提示: | ||
> | ||
> 接口实现 只要字段名和字段类型符合接口说明即可,**至于字段的具体值无需担心,因为所有的值都会通过前端js处理后传给后端,比如dsl字段、noise字段等**。 | ||
|
@@ -39,6 +40,8 @@ | |
| errno | int | 错误码,0 成功,非0 失败 | | ||
| errmsg | string | 错误信息 | | ||
|
||
<br> | ||
|
||
##### 2. dsl_get | ||
|
||
接口: http://{{your_domain}}/dsl?project=%s | ||
|
@@ -63,6 +66,8 @@ | |
| project | string | 被测模块名 | | ||
| addTime | string | 添加时间 | | ||
|
||
<br> | ||
|
||
##### 3. noise_push | ||
|
||
接口: http://{{your_domain}}/noise | ||
|
@@ -88,6 +93,8 @@ | |
| errno | int | 错误码,0 成功,非0 失败 | | ||
| errmsg | string | 错误信息 | | ||
|
||
<br> | ||
|
||
##### 4. noise_del | ||
|
||
接口: http://{{your_domain}}/noise/del | ||
|
@@ -109,6 +116,8 @@ | |
| errno | int | 错误码,0 成功,非0 失败 | | ||
| errmsg | string | 错误信息 | | ||
|
||
<br> | ||
|
||
##### 5. noise_get | ||
|
||
接口: http://{{your_domain}}/noise | ||
|
@@ -136,6 +145,8 @@ | |
| addTime | string | 添加时间 | | ||
| user | string | 上报用户 | | ||
|
||
<br> | ||
|
||
##### 6. module_info | ||
|
||
接口: http://{{your_domain}}/platform/module?per=1000 | ||
|
@@ -160,16 +171,24 @@ | |
| Module说明 | | | | ||
| :-----| :-----| :-----| | ||
| name | string | 接入模块名,即project | | ||
| data | string | []KV类型数组的json串 | | ||
| data | string | []KV类型数组的json串,存储模块详细信息 | | ||
|
||
> 温馨提示: | ||
> | ||
> name尽量与编译后的$binName保持一致。如果存在冲突,可以增加前缀'\*-',即\*-$binName。 | ||
> | ||
> 如果name形如'\*a-b-c',则尽量保证c具有可识别性,因为,[覆盖率统计回放](../replayer-codecov.md#1-覆盖率报告)会通过 *c* 来获取SUT进程信息并重启SUT。 | ||
| KV说明 | | | | ||
| :-----| :-----| :-----| | ||
| key | string | 某项配置信息名,如git | | ||
| value | string | 具体配置值,如[email protected] | | ||
| key | string | 与模块相关的一些信息,如监听地址listen-addr等 | | ||
| value | string | 与key对应的具体值 | | ||
|
||
目前KV类型中key支持的具体值有: | ||
* context:必选,录制机器的地址,与录制流量的Context字段对应,以区分不同模块。一般一个模块找一台机器录制流量即可。 | ||
|
||
* listen-addr:必选,SUT的监听地址,一般为127.0.0.1:xxxx。 | ||
|
||
* department:可选,模块所属部门,默认空(则为default部门)。若非空,在非本地回放时,会按部门字段读取es_url地址。es_url配置可详见:[回放Agent配置](../replayer-conf.md#5-es_url) | ||
|
||
非本地回放时,Agent只用到上面三个key值,如果业务方想在该接口顺便存储模块其他信息,只需扩充[]KV即可。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,75 @@ | ||
### 流量回放指南 | ||
|
||
即将更新~ | ||
<br> | ||
|
||
流量回放指南 可以帮助对我们进一步了解回放结果页的流量状态及字段,加深我们对回放结果的理解,提升问题定位的能力。 | ||
|
||
<br> | ||
下面逐个介绍: | ||
|
||
##### 1. 查看接口返回 | ||
点击下图1的"运行"后,会进入图2的流量回放结果页。 | ||
![guide_replay_run](../../images/guide_replay_run.png) | ||
|
||
下图2的流量回放结果页,第一条请求,即Inbound请求,标注为"主请求"。其余请求均为Outbound请求。 | ||
![guide_replay_response](../../images/guide_replay_response.png) | ||
|
||
主请求里的 'Testing Response',就是SUT针对Inbound请求的返回结果,包括header头和body体。 | ||
|
||
![guide_replay_outbound](../../images/guide_replay_outbound.png) | ||
|
||
> 注意: | ||
> | ||
>对比上图2和上图3,只有Inbound请求的'O==T Diff' tab给的是Response的diff结果。 所有Outbound请求的'O==T Diff' tab给的是Request的diff结果。 | ||
<br> | ||
|
||
##### 2. 定位失败原因 | ||
|
||
回放Agent采用了非常严格的测试标准,只要有任何diff或者异常都会显示回放失败,目的是为了让大家能够发现隐藏问题 | ||
|
||
对于回放失败的结果,还可以细分如下: | ||
|
||
> 状态1:存在diff | ||
![guide_replay_diff](../../images/guide_replay_diff.png) | ||
|
||
如上图,点击飘红的行,存在飘红的字段。 | ||
|
||
根据代码可以区分出这个是一个“噪音”(每次都是随机数),可以点击"上报噪音"消除噪音,被消除噪音在下次回放时就消失了。 | ||
|
||
<br> | ||
|
||
> 状态2:missing | ||
![guide_replay_missing](../../images/guide_replay_missing.png) | ||
|
||
出现上图情况,是因为被测代码缺少一条请求,这个时候就要确认是否有删除或者改动代码有问题。亦可详见:[常见问题及排查](./troubleshoot.md#5-部分outbound匹配失败ot-diff没有diff) 第5条。 | ||
|
||
<br> | ||
|
||
> 状态3:not matched | ||
![guide_replay_notmatch](../../images/guide_replay_notmatch.png) | ||
|
||
出现上图情况,是因为被测代码发出了线上流量没有的请求,匹配不到,所以可能也是代码中加入了新的逻辑。亦可详见:[常见问题及排查](./troubleshoot.md#5-部分outbound匹配失败ot-diff没有diff) 第5条。 | ||
|
||
<br> | ||
|
||
更多问题,请详见 [常见问题及排查](./troubleshoot.md) 手册,及里面的 **[Sharingan交流群](./troubleshoot.md#交流群)**。 | ||
|
||
<br> | ||
|
||
##### 3. 格式化 | ||
> 支持json格式化 | ||
选中json代码片段,当松开鼠标按钮的时候就会将其格式化显示。如下图所示 | ||
|
||
![guide_replay_json1](../../images/guide_replay_json1.png) | ||
|
||
<br> | ||
|
||
> 支持unicode编码转换 | ||
选中带引号的unicode编码片段即可。因为 带引号的片段会当成json格式处理,自动会进行编码转换 | ||
![guide_replay_json2](../../images/guide_replay_json2.png) |
Oops, something went wrong.