Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
share
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄刚
share
Commits
7c4a48df
Commit
7c4a48df
authored
Oct 15, 2018
by
黄刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加trace设计草稿
parent
d24520cc
Pipeline
#3803
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
trace组件设计草稿.md
trace组件设计草稿.md
+62
-0
No files found.
trace组件设计草稿.md
0 → 100644
View file @
7c4a48df
# trace组件工作流程
# trace组件工作流程
## 正常流程
1.
Trace Server的Task Manager的页面会展示出从Falcon server获取到的节点列表
2.
选中1个或多个节点,创建trace任务,任务参数包含任务id,任务名,开始时间,结束时间,交易hash等条件
3.
创建任务通过调用TraceServer的接口实现,创建成功后Trace Server返回结果,Task Manager将任务信息写入数据库。
4.
Trace Server通过RPC方式与Trace Client通信,进而控制Trace Plugin的开启和关闭,以及获取Trace Plugin上报的数据并存储到对应任务目录的文件中。
5.
Trace Server还提供任务内容的查询接口,以便前端展示内容。

## 异常流程
在出现任务相关节点异常退出或网络断开等情况时,一旦恢复正常,能够及时更新节点trace状态。
1.
某个任务正在执行,该任务中的一个或多个节点异常退出,一段时间后恢复,Trace Server检测到Trace Client启动后,恢复上报功能。
2.
某个任务正在执行,该任务中的一个或多个节点网络连接断开,收到停止任务命令,网络恢复后,停止对应节点的上报功能。
3.
某个节点网络连接断开,创建包含该节点的trace任务,网络恢复后,启动上报功能。
## 详细设计
### 任务状态和任务类型定义
```
go
type
TaskStatus
int
type
TaskType
int
const
(
TSCreated
TaskStatus
=
1
+
iota
//已创建未执行
TSRunning
//正在执行
TSStopped
//已停止
//TSRemoved //已删除
)
const
(
TTTransaction
TaskType
=
1
+
iota
//交易
)
```
### 接口定义
#### Task Server
```
go
CreateTask
(
taskId
string
,
ty
TaskType
,
taskName
string
,
nodeList
[]
string
,
ctx
...
interface
{})
error
StartTask
(
taskId
string
)
error
StopTask
(
taskId
string
)
error
DeleteTask
(
taskId
string
)
error
QueryTaskStatus
(
taskId
string
)
TaskStatus
```
#### Trace Plugin
```
go
StartTask
(
ctx
...
interface
{})
StopTask
(
ctx
...
interface
{})
```
参数为过滤条件,比如只需要某个交易hash的信息,参数就可以是("Txhash",“xxxxxxxxx”);或者只要打印mempool模块的信息,参数就可以是(“module”,“mempool”);两个条件同事满足("Txhash",“xxxxxxxxx”,“module”,“mempool”);多个交易hash?多个模块?更复杂的条件还没有想好怎么表达和处理。
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment