Skip to content

Commit

Permalink
实现ws的链路追踪
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Sep 16, 2024
1 parent f2e270d commit 2a15543
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion websocket/baseContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (receiver *BaseContext) Send(msg any) error {
var message string
// 基础类型不需要进行序列化
if fastReflect.PointerOf(msg).Type == fastReflect.GoBasicType {
message = parse.ToString(message)
message = parse.ToString(msg)
} else {
// 其余类型,一律使用json
marshal, _ := json.Marshal(msg)
Expand Down
2 changes: 1 addition & 1 deletion websocket/socketHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func SocketHandler(route *context.HttpRoute) websocket.Handler {
httpContext.SetWebsocket(conn)

// 创建链路追踪上下文
trackContext := container.Resolve[trace.IManager]().EntryWebSocket(httpContext.URI.Host, httpContext.URI.Url, httpContext.ContentType, httpContext.Header.ToMap(), httpContext.URI.GetRealIp())
trackContext := container.Resolve[trace.IManager]().EntryWebSocket(httpContext.URI.Host, httpContext.URI.Url, httpContext.Header.ToMap(), httpContext.URI.GetRealIp())
trackContext.SetBody(httpContext.Request.BodyString, httpContext.Response.GetHttpCode(), string(httpContext.Response.BodyBytes))
trackContext.End(nil)
//httpContext.Data.Set("Trace", trackContext)
Expand Down

0 comments on commit 2a15543

Please sign in to comment.