From c2f3dbce2cd650f0e8a328f18add14cb8c8cd848 Mon Sep 17 00:00:00 2001 From: Manendra Pal Singh Date: Mon, 23 Feb 2026 23:16:49 +0530 Subject: [PATCH] fix: sender and recipient.id --- core/module/handler/stdHandler.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/core/module/handler/stdHandler.go b/core/module/handler/stdHandler.go index ab50ffb..facb668 100644 --- a/core/module/handler/stdHandler.go +++ b/core/module/handler/stdHandler.go @@ -8,6 +8,7 @@ import ( "net/http" "net/http/httputil" "strconv" + "strings" "time" "github.com/beckn-one/beckn-onix/pkg/log" @@ -376,18 +377,22 @@ func (h *stdHandler) initSteps(ctx context.Context, mgr PluginManager, cfg *Conf } func setBecknAttr(span trace.Span, r *http.Request, h *stdHandler) { - recipientID := h.SubscriberID - - if v, ok := r.Context().Value(model.ContextKeySubscriberID).(string); ok { - recipientID = v - } - senderID := "" + selfID := h.SubscriberID + remoteID := "" if v, ok := r.Context().Value(model.ContextKeyCallerID).(string); ok { - senderID = v + remoteID = v } + var senderID, receiverID string + if strings.Contains(h.moduleName, "Caller") { + senderID = selfID + receiverID = remoteID + } else { + senderID = remoteID + receiverID = selfID + } attrs := []attribute.KeyValue{ - attribute.String("recipient.id", recipientID), + attribute.String("recipient.id", receiverID), attribute.String("sender.id", senderID), attribute.String("span_uuid", uuid.New().String()), attribute.String("http.request.method", r.Method),