X-MSG-IM
的分佈式信令跟蹤能力已基本具有, 特色是:實時. 只有要RX/TX就會實時產生信令跟蹤事件, 先入kafka, 再入influxdb待查. 同時提供實時sub/pub接口.分佈式
完備. 能夠完整地回放整個業務流程.spa
代碼零侵入.code
x-msg-ap
, 訪問點.blog
x-msg-im-hlr
, 用戶歸屬位置.繼承
x-msg-im-auth
, 鑑權中心.token
客戶端向x-msg-ap
發起附着請求.接口
x-msg-ap
向x-msg-im-hlr
透傳此請求.flux
x-msg-im-hlr
向x-msg-im-auth
詢問此附着請求中的token等參數是否有效.事件
x-msg-im-auth
向x-msg-im-hlr
回送附着結果.事務
x-msg-im-hlr
向x-msg-ap
回送附着結果.
x-msg-ap
向客戶端透傳附着結果,
RX/TX
位置都有測點
, 也就是下圖中的: A, B, C, D, E, F, G, H, I, J
. 每一個測點上都抓取XSC協議從傳輸層到應用層每個字節.trace-id
進行關聯, 經過span-id
和parent-span-id
的繼承關係組成了一個完整的RPC鏈.detect point | timestamp(nano) | trace-id | span-id | parent-span-id | source network element | destination network element | pdu |
---|---|---|---|---|---|---|---|
A | 1571714778393000000 | 00fd4b376ab64e87 | 2267f44c65454cb9 | 0000000000000000 | 5c1acfd87a254463aa2cfa6bca8c7e94 | im.xmsg.dev5.cn.szap0$0000 | DEADBEEF |
B | 1571714778393000001 | 00fd4b376ab64e87 | 5b99e760169d41df | 2267f44c65454cb9 | im.xmsg.dev5.cn.szap0$0000 | im.xmsg.dev5.cn.szu0$0000 | DEADBEEF |
C | 1571714778393000002 | 00fd4b376ab64e87 | 6957f3c576af4d63 | 5b99e760169d41df | im.xmsg.dev5.cn.szap0$0000 | im.xmsg.dev5.cn.szu0$0000 | DEADBEEF |
D | 1571714778393000003 | 00fd4b376ab64e87 | b250652a8f5a434a | 6957f3c576af4d63 | im.xmsg.dev5.cn.szu0$0000 | im.xmsg.dev5.cn.sza0$0000 | DEADBEEF |
E | 1571714778393000004 | 00fd4b376ab64e87 | 878b41ccd8b6439b | b250652a8f5a434a | im.xmsg.dev5.cn.szu0$0000 | im.xmsg.dev5.cn.sza0$0000 | DEADBEEF |
F | 1571714778393000005 | 00fd4b376ab64e87 | 4d1eb9960e064048 | 878b41ccd8b6439b | im.xmsg.dev5.cn.sza0$0000 | im.xmsg.dev5.cn.szu0$0000 | DEADBEEF |
G | 1571714778393000006 | 00fd4b376ab64e87 | 4111a284197b42d3 | 4d1eb9960e064048 | im.xmsg.dev5.cn.sza0$0000 | im.xmsg.dev5.cn.szu0$0000 | DEADBEEF |
H | 1571714778393000008 | 00fd4b376ab64e87 | ac7a980bcfb84021 | 4111a284197b42d3 | im.xmsg.dev5.cn.szu0$0000 | im.xmsg.dev5.cn.szap0$0000 | DEADBEEF |
I | 1571714778393000009 | 00fd4b376ab64e87 | 1a13f39862c3472c | ac7a980bcfb84021 | im.xmsg.dev5.cn.szu0$0000 | im.xmsg.dev5.cn.szap0$0000 | DEADBEEF |
J | 1571714778393000010 | 00fd4b376ab64e87 | 4330b6dafba44a07 | 1a13f39862c3472c | im.xmsg.dev5.cn.szap0$0000 | 5c1acfd87a254463aa2cfa6bca8c7e94 | DEADBEEF |
x-msg-ap
網元上/* x-msg-ap處理來自客戶端的附着請求. */ void XmsgImHlrAttachSimple::handle(SptrXitp trans /* 事務. */, shared_ptr<XmsgImHlrAttachSimpleReq> req) { shared_ptr<XmsgNeUsr> hlr = XmsgNeGroupMgr::instance()->getHlr(); /* 獲取x-msg-im-hlr網元句柄. */ XmsgImChannel::cast(hlr->channel)->begin(req, [trans](SptrXiti itrans) /* 向x-msg-im-hlr透傳. */ { shared_ptr<XmsgImHlrAttachSimpleRsp> rsp = static_pointer_cast<XmsgImHlrAttachSimpleRsp>(itrans->endMsg); /* x-msg-im-hlr回來的響應. */ trans->end(rsp); /* 事務結束, 直接將響應透傳回客戶端. */ }, nullptr, trans); }
x-msg-im-hlr
網元上/* x-msg-im-hlr收到x-msg-ap透傳過來的客戶端附着請求. */ void XmsgImHlrAttachSimple::handle(shared_ptr<XmsgNeUsr> nu, const string& ccid, SptrXitp trans, shared_ptr<XmsgImHlrAttachSimpleReq> req) { shared_ptr<XmsgNeUsr> auth = XmsgNeGroupMgr::instance()->getAuth(); /* 獲取x-msg-im-auth網元句柄. */ XmsgImChannel::cast(auth->channel)->begin(req, [trans](SptrXiti itrans) /* 向x-msg-im-auth透傳. */ { shared_ptr<XmsgImHlrAttachSimpleRsp> rsp = static_pointer_cast<XmsgImHlrAttachSimpleRsp>(itrans->endMsg); /* x-msg-im-auth回來的響應. */ trans->end(rsp); /* 直接將響應透傳回x-msg-ap. */ }, nullptr, trans); }
x-msg-im-auth
網元上/* x-msg-im-auth收到x-msg-im-hlr透傳過來的客戶端附着請求. */ void XmsgImAuthClientAttachSimple::handle(shared_ptr<XmsgNeUsr> nu, SptrXitp trans, shared_ptr<XmsgImHlrAttachSimpleReq> req) { shared_ptr<XmsgImHlrAttachSimpleRsp> rsp(new XmsgImHlrAttachSimpleRsp()); rsp->set_usr("usr"); rsp->set_secret("secret"); LOG_DEBUG("x-msg-im-client attach successful, req: %s, rsp: %s", req->ShortDebugString().c_str(), rsp->ShortDebugString().c_str()) trans->end(rsp); /* 直接將響應透傳回x-msg-im-hlr. */ }