基础的插件注册+获取+调度能力, 待完善

This commit is contained in:
2024-11-13 18:26:47 +08:00
parent 942cd1dfed
commit 507f1f5090
4 changed files with 161 additions and 3 deletions

View File

@ -47,6 +47,24 @@ func (rc *RequestContext) SetPluginResult(r *PluginResult) {
rc.pluginResultTable[r.ID] = append(rc.pluginResultTable[r.ID], r)
}
// TraceID 获取traceID
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:22 2024/11/13
func (rc *RequestContext) TraceID() string {
return rc.traceID
}
// Trace 追踪实例
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:24 2024/11/13
func (rc *RequestContext) Trace() *trace.Runtime {
return rc.runtimeInstance
}
func (rc *RequestContext) Lock() {
rc.lock.Lock()
}

View File

@ -7,6 +7,8 @@
// Date : 2024-11-13 17:26
package define
import "git.zhangdeman.cn/zhangdeman/trace"
// PluginResult 插件执行结果
//
// Author : go_developer@163.com<白茶清欢>
@ -14,6 +16,7 @@ package define
// Date : 17:28 2024/11/13
type PluginResult struct {
ID string `json:"id"` // 插件ID
Trace *trace.Runtime `json:"-"` // 执行跟踪
StartTime int64 `json:"start_time"` // 开始执行时间: ms
FinishTime int64 `json:"finish_time"` // 完成执行时间: ms
IsSuccess bool `json:"is_success"` // 是否成功