/// <summary> /// /// </summary> /// <param name="data"></param> public static void RegistTracing(ref object data) { var model = (data as RequestModel); if (model != null && model.Header != null) { var header = model.Header; header.RpcID = Util.VersionIncr(TracingContextData.GetSubRpcID()); } }
private static void Client_OnRequest(HttpRequestMessage request, RpcContext rpcContext) { var rpcId = string.Empty; var requestHeader = TracingContextData.GetRequestHeader(); if (requestHeader == null) { requestHeader = TracingContextData.GetDefaultRequestHeader(); TracingContextData.SetRequestHeader(requestHeader); //HttpContentData.SetSubRpcID(modelHeader.RpcID + ".0"); //rpcId = requestHeader.RpcID + ".0"; } //else //{ // rpcId = Util.VersionIncr(TracingContextData.GetSubRpcID()); //} rpcId = Util.VersionIncr(TracingContextData.GetSubRpcID()); TracingContextData.SetSubRpcID(rpcId); rpcContext.Items[TraceIDKey] = requestHeader.TraceID; rpcContext.Items[RpcIDKey] = rpcId; //post/put content is ObjectContent var oc = request.Content as ObjectContent; if (oc != null) { var reqModel = oc.Value as IRequestModel <Header>; if (reqModel != null) { if (reqModel.Header == null) { reqModel.Header = new Header(); } reqModel.Header.TraceID = requestHeader.TraceID; reqModel.Header.RpcID = rpcId; } } }