Skip to content

Commit

Permalink
完成rabbit.send链路追踪
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Oct 18, 2023
1 parent e3501a7 commit 78fc045
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rabbitProduct.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/flog"
"github.com/farseer-go/linkTrace"
amqp "github.com/rabbitmq/amqp091-go"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -120,6 +121,7 @@ func (receiver *rabbitProduct) SendJsonKey(data any, routingKey string) error {

// SendMessage 发送消息
func (receiver *rabbitProduct) SendMessage(message []byte, routingKey, messageId string, priority uint8) error {
traceDetailMq := linkTrace.TraceMq("Send", receiver.manager.config.Server, receiver.manager.config.Exchange, receiver.manager.config.RoutingKey)
rabbitChl := receiver.popChannel()
defer func(rabbitChl rabbitChannel) {
receiver.pushChannel(rabbitChl)
Expand All @@ -140,6 +142,7 @@ func (receiver *rabbitProduct) SendMessage(message []byte, routingKey, messageId
Body: message,
})

defer func() { traceDetailMq.End(err) }()
if err != nil {
//if rabbitError, ok := err.(*amqp.Error); ok {
// if rabbitError.Code == 504 {
Expand Down

0 comments on commit 78fc045

Please sign in to comment.