|
@@ -65,10 +65,7 @@ namespace Sers.Gover.Apm.Zipkin
|
|
|
|
|
|
trace.Record(Annotations.ClientSend());
|
|
trace.Record(Annotations.ClientSend());
|
|
trace.Record(Annotations.Rpc(config.rpcName));
|
|
trace.Record(Annotations.Rpc(config.rpcName));
|
|
- trace.Record(Annotations.ServiceName(rpcData.apiStationName_Get()??""));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ trace.Record(Annotations.ServiceName(rpcData.apiStationName_Get()??""));
|
|
|
|
|
|
|
|
|
|
return (s, apiReplyMessage) => {
|
|
return (s, apiReplyMessage) => {
|
|
@@ -92,45 +89,116 @@ namespace Sers.Gover.Apm.Zipkin
|
|
//}
|
|
//}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
+ #region method getTagValue
|
|
|
|
|
|
- //tags
|
|
|
|
- config.tags?.ForEach(item =>trace.Record(Annotations.Tag(GetTagValue(item.Key) ?? "" , GetTagValue(item.Value) ?? "")));
|
|
|
|
|
|
|
|
-
|
|
|
|
- trace.Record(Annotations.ClientRecv());
|
|
|
|
|
|
+ string requestData_oriString = null;
|
|
|
|
+ JObject requestData_json = null;
|
|
|
|
|
|
- #region method getTagValue
|
|
|
|
- string GetTagValue(string valueString)
|
|
|
|
|
|
+ ApiMessage apiResponseMessage = null;
|
|
|
|
+
|
|
|
|
+ string responseRpc_oriString = null;
|
|
|
|
+ JObject responseRpc_json = null;
|
|
|
|
+
|
|
|
|
+ string responseData_oriString = null;
|
|
|
|
+ JObject responseData_json = null;
|
|
|
|
+
|
|
|
|
+ string GetTagValue(string valueString)
|
|
{
|
|
{
|
|
if (string.IsNullOrEmpty(valueString)) return null;
|
|
if (string.IsNullOrEmpty(valueString)) return null;
|
|
if (!valueString.StartsWith("{{") || !valueString.EndsWith("}}")) return valueString;
|
|
if (!valueString.StartsWith("{{") || !valueString.EndsWith("}}")) return valueString;
|
|
|
|
|
|
- valueString = valueString.Substring(2, valueString.Length - 4);
|
|
|
|
-
|
|
|
|
- string dataType;
|
|
|
|
- string path;
|
|
|
|
-
|
|
|
|
- var splitIndex = valueString.IndexOf('.');
|
|
|
|
- if (splitIndex < 0)
|
|
|
|
- {
|
|
|
|
- dataType = valueString;
|
|
|
|
- path = "";
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ try
|
|
{
|
|
{
|
|
- dataType = valueString.Substring(0, splitIndex);
|
|
|
|
- path = valueString.Substring(splitIndex + 1);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- switch (dataType)
|
|
|
|
|
|
+ valueString = valueString.Substring(2, valueString.Length - 4);
|
|
|
|
+
|
|
|
|
+ string dataType;
|
|
|
|
+ string path;
|
|
|
|
+
|
|
|
|
+ var splitIndex = valueString.IndexOf('.');
|
|
|
|
+ if (splitIndex < 0)
|
|
|
|
+ {
|
|
|
|
+ dataType = valueString;
|
|
|
|
+ path = "";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ dataType = valueString.Substring(0, splitIndex);
|
|
|
|
+ path = valueString.Substring(splitIndex + 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (dataType)
|
|
|
|
+ {
|
|
|
|
+ case "requestRpc": return rpcData?.oriJson.SelectToken(path).ConvertToString();
|
|
|
|
+ case "requestData":
|
|
|
|
+ if (requestData_oriString == null)
|
|
|
|
+ {
|
|
|
|
+ requestData_oriString = apiRequestMessage.value_OriData.ArraySegmentByteToString();
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrEmpty(path))
|
|
|
|
+ {
|
|
|
|
+ return requestData_oriString;
|
|
|
|
+ }
|
|
|
|
+ if (requestData_json == null)
|
|
|
|
+ {
|
|
|
|
+ requestData_json = requestData_oriString.Deserialize<JObject>();
|
|
|
|
+ }
|
|
|
|
+ return requestData_json.SelectToken(path).ConvertToString();
|
|
|
|
+
|
|
|
|
+ case "responseRpc":
|
|
|
|
+ if (apiResponseMessage == null)
|
|
|
|
+ {
|
|
|
|
+ apiResponseMessage = new ApiMessage();
|
|
|
|
+ apiResponseMessage.Unpack(apiReplyMessage.ByteDataToArraySegment());
|
|
|
|
+ }
|
|
|
|
+ if (responseRpc_oriString == null)
|
|
|
|
+ {
|
|
|
|
+ responseRpc_oriString = apiResponseMessage.rpcContextData_OriData.ArraySegmentByteToString();
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrEmpty(path))
|
|
|
|
+ {
|
|
|
|
+ return responseRpc_oriString;
|
|
|
|
+ }
|
|
|
|
+ if (responseRpc_json == null)
|
|
|
|
+ {
|
|
|
|
+ responseRpc_json = responseRpc_oriString.Deserialize<JObject>();
|
|
|
|
+ }
|
|
|
|
+ return responseRpc_json.SelectToken(path).ConvertToString();
|
|
|
|
+
|
|
|
|
+ case "responseData":
|
|
|
|
+ if (apiResponseMessage == null)
|
|
|
|
+ {
|
|
|
|
+ apiResponseMessage = new ApiMessage();
|
|
|
|
+ apiResponseMessage.Unpack(apiReplyMessage.ByteDataToArraySegment());
|
|
|
|
+ }
|
|
|
|
+ if (responseData_oriString == null)
|
|
|
|
+ {
|
|
|
|
+ responseData_oriString = apiResponseMessage.value_OriData.ArraySegmentByteToString();
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrEmpty(path))
|
|
|
|
+ {
|
|
|
|
+ return responseData_oriString;
|
|
|
|
+ }
|
|
|
|
+ if (responseData_json == null)
|
|
|
|
+ {
|
|
|
|
+ responseData_json = responseData_oriString.Deserialize<JObject>();
|
|
|
|
+ }
|
|
|
|
+ return responseData_json.SelectToken(path).ConvertToString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch
|
|
{
|
|
{
|
|
- case "requestRpc":return rpcData?.oriJson.SelectToken(path).ConvertToString();
|
|
|
|
- case "requestData": return apiRequestMessage.value_OriData.ArraySegmentByteToString();
|
|
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
+ //tags
|
|
|
|
+ config.tags?.ForEach(item =>trace.Record(Annotations.Tag(GetTagValue(item.Key) ?? "" , GetTagValue(item.Value) ?? "")));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ trace.Record(Annotations.ClientRecv());
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|