lith il y a 5 ans
Parent
commit
ea6fe90240
40 fichiers modifiés avec 316 ajouts et 47 suppressions
  1. 5 1
      dotnet/Doc/UpgradeLog/Sers2.1.1.txt
  2. 7 0
      dotnet/Sers.sln
  3. 1 1
      dotnet/Sers/ApiLoader/Sers.NetcoreLoader/Sers.NetcoreLoader.csproj
  4. 1 1
      dotnet/Sers/ApiLoader/Sers.Serslot/Sers.Serslot.csproj
  5. 1 1
      dotnet/Sers/Sers.CL/Ipc/Sers.CL.Ipc.SharedMemory/Sers.CL.Ipc.SharedMemory.csproj
  6. 1 1
      dotnet/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/Sers.CL.Socket.Iocp.csproj
  7. 1 1
      dotnet/Sers/Sers.CL/Socket/Sers.CL.Socket.ThreadWait/Sers.CL.Socket.ThreadWait.csproj
  8. 1 1
      dotnet/Sers/Sers.CL/WebSocket/Sers.CL.WebSocket/Sers.CL.WebSocket.csproj
  9. 1 1
      dotnet/Sers/Sers.CL/Zmq/FullDuplex/Sers.CL.Zmq.FullDuplex/Sers.CL.Zmq.FullDuplex.csproj
  10. 1 1
      dotnet/Sers/Sers.CL/Zmq/ThreadWait/Sers.CL.ClrZmq.ThreadWait/Sers.CL.ClrZmq.ThreadWait.csproj
  11. 11 0
      dotnet/Sers/Sers.Core/Sers.Core/Module/Api/Rpc/Extendsions/IRpcContextDataExtensions.cs
  12. 1 1
      dotnet/Sers/Sers.Core/Sers.Core/Sers.Core.csproj
  13. 14 2
      dotnet/Sers/Sers.Gateway/Sers.Gateway/GatewayHelp.cs
  14. 1 1
      dotnet/Sers/Sers.Gateway/Sers.Gateway/Sers.Gateway.csproj
  15. 1 1
      dotnet/Sers/Sers.Hardware/Sers.Hardware/Sers.Hardware.csproj
  16. 1 1
      dotnet/Sers/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj
  17. 139 0
      dotnet/Sers/Sers.ServiceCenter/Sers.Gover.Zipkin/Extensions/ZipkinExtensions.cs
  18. 25 0
      dotnet/Sers/Sers.ServiceCenter/Sers.Gover.Zipkin/Sers.Gover.Zipkin.csproj
  19. 38 3
      dotnet/Sers/Sers.ServiceCenter/Sers.Gover/Base/GoverManage.cs
  20. 2 2
      dotnet/Sers/Sers.ServiceCenter/Sers.Gover/Sers.Gover.csproj
  21. 1 1
      dotnet/Sers/Sers.ServiceCenter/Sers.ServiceCenter/ApiCenter/ApiCenterService.cs
  22. 1 1
      dotnet/Sers/Sers.ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter.csproj
  23. 1 1
      dotnet/Sers/Sers.ServiceStation/Sers.ServiceStation/Sers.ServiceStation.csproj
  24. 1 1
      dotnet/StationDemo/SersLoader/Did.SersLoader.Demo/Did.SersLoader.Demo.csproj
  25. 1 1
      dotnet/StationDemo/SersLoader/Did.SersLoader.HelloWorld/Did.SersLoader.HelloWorld.csproj
  26. 26 0
      dotnet/Vit/Vit.Core/Vit.Core/Extensions/HexStringExtensions.cs
  27. 2 11
      dotnet/Vit/Vit.Core/Vit.Core/Extensions/byte/HexStringExtensions.cs
  28. 1 1
      dotnet/Vit/Vit.Core/Vit.Core/Vit.Core.csproj
  29. 1 1
      dotnet/Vit/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj
  30. 1 1
      dotnet/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj
  31. 1 1
      dotnet/Vit/Vit.WebHost/Vit.WebHost.csproj
  32. 1 1
      dotnet/netcore/Gateway/App.Gateway/App.Gateway.csproj
  33. 3 0
      dotnet/netcore/Gateway/App.Gateway/appsettings.json
  34. 1 1
      dotnet/netcore/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj
  35. 3 0
      dotnet/netcore/ServiceCenter/App.Gover.Gateway/appsettings.json
  36. 4 2
      dotnet/netcore/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj
  37. 1 0
      dotnet/netcore/ServiceCenter/App.ServiceCenter/Program.cs
  38. 11 1
      dotnet/netcore/ServiceCenter/App.ServiceCenter/appsettings.json
  39. 1 1
      dotnet/netcore/Station/App.Ioc.Station/App.Ioc.Station.csproj
  40. 1 1
      dotnet/netcore/Station/App.Robot.Station/App.Robot.Station.csproj

+ 5 - 1
dotnet/Doc/UpgradeLog/Sers2.1.1.txt

@@ -100,4 +100,8 @@ ServiceCenter
 修复程序退出函数在没正常启动程序时不正确退出的bug(StopStation StopCenter)
 
 [tag]Sers2.1.1.318
-------------------------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------------------------------
+服务中心 添加apm.zipkin
+
+[tag]Sers2.1.1.329
+------------------------------------------------------------------------------------------------------------------

+ 7 - 0
dotnet/Sers.sln

@@ -153,6 +153,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Did.Serslot.HelloWorld", "S
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Did.NetcoreLoader.HellolWorld", "StationDemo\NetcoreLoader\Did.NetcoreLoader.HelloWorld\Did.NetcoreLoader.HellolWorld.csproj", "{141C89FB-54A7-4283-8649-D6EF51B22FA9}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gover.Zipkin", "Sers\Sers.ServiceCenter\Sers.Gover.Zipkin\Sers.Gover.Zipkin.csproj", "{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -323,6 +325,10 @@ Global
 		{141C89FB-54A7-4283-8649-D6EF51B22FA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{141C89FB-54A7-4283-8649-D6EF51B22FA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{141C89FB-54A7-4283-8649-D6EF51B22FA9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -399,6 +405,7 @@ Global
 		{F2FAF3AF-59E1-4B71-86A0-78B980C55474} = {015B5793-0478-4884-A58B-8889639FD65A}
 		{6611EC51-AEE4-4EF7-A9D2-2302F2F61845} = {015B5793-0478-4884-A58B-8889639FD65A}
 		{141C89FB-54A7-4283-8649-D6EF51B22FA9} = {DA14C04D-FEEF-4A3C-A9F2-BBA25897B9A4}
+		{88153CF7-7B59-4C5E-B5E0-713E6E5CC70D} = {97C34C06-AE79-4E1A-8D04-EB0107643302}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {C7DA16E3-9949-49FA-B0B4-F830636DE60F}

+ 1 - 1
dotnet/Sers/ApiLoader/Sers.NetcoreLoader/Sers.NetcoreLoader.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/ApiLoader/Sers.Serslot/Sers.Serslot.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.CL/Ipc/Sers.CL.Ipc.SharedMemory/Sers.CL.Ipc.SharedMemory.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/Sers.CL.Socket.Iocp.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.CL/Socket/Sers.CL.Socket.ThreadWait/Sers.CL.Socket.ThreadWait.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.CL/WebSocket/Sers.CL.WebSocket/Sers.CL.WebSocket.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.CL/Zmq/FullDuplex/Sers.CL.Zmq.FullDuplex/Sers.CL.Zmq.FullDuplex.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
   

+ 1 - 1
dotnet/Sers/Sers.CL/Zmq/ThreadWait/Sers.CL.ClrZmq.ThreadWait/Sers.CL.ClrZmq.ThreadWait.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
   

+ 11 - 0
dotnet/Sers/Sers.Core/Sers.Core/Module/Api/Rpc/Extendsions/IRpcContextDataExtensions.cs

@@ -6,6 +6,7 @@ using Sers.Core.Module.Api.Rpc;
 using Vit.Core.Util.Common;
 using System.IO;
 using Vit.Core.Util.ComponentModel.SsError;
+using System.Linq;
 
 namespace Vit.Extensions
 {
@@ -138,6 +139,16 @@ namespace Vit.Extensions
         #endregion
 
 
+
+        #region apiStationName_Get
+        public static string apiStationName_Get(this IRpcContextData data)
+        {
+            var arr = data.route?.Split('/');
+            if (arr == null || arr.Length <= 1) return null;
+            return arr[1];
+        }        
+        #endregion
+
         #region caller
 
         #region caller

+ 1 - 1
dotnet/Sers/Sers.Core/Sers.Core/Sers.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 14 - 2
dotnet/Sers/Sers.Gateway/Sers.Gateway/GatewayHelp.cs

@@ -118,6 +118,7 @@ namespace Sers.Gateway
 
 
         #region BuildHttp
+        static string prefixOfCopyIpToHeader = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetStringByPath("Sers.Gateway.WebHost.prefixOfCopyIpToHeader");
         protected JObject BuildHttp(HttpRequest request)
         {
             var http = new JObject();
@@ -133,6 +134,15 @@ namespace Sers.Gateway
                 headers[kv.Key] = kv.Value.ToString();
             }
 
+            //(x.x.2)记录Ip 到 headers
+            if(prefixOfCopyIpToHeader!=null)
+            {
+                headers[prefixOfCopyIpToHeader+"RemoteIpAddress"] = request.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
+                headers[prefixOfCopyIpToHeader + "RemotePort"] = request.HttpContext.Connection.RemotePort;
+
+                headers[prefixOfCopyIpToHeader + "LocalIpAddress"] = request.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString();
+                headers[prefixOfCopyIpToHeader + "LocalPort"] = request.HttpContext.Connection.LocalPort;
+            }
             #endregion
 
             #region (x.3) method
@@ -244,7 +254,8 @@ namespace Sers.Gateway
             #endregion
 
          
-            #region (x.2) header             
+            #region (x.2) header
+            //(x.x.1)原始header
             var headers = response.Headers; 
             if (null != replyRpcData)
             {
@@ -258,7 +269,8 @@ namespace Sers.Gateway
                 }
             }
 
-            //Content-Type → application/json
+            
+            //(x.2)Content-Type → application/json
             if (!headers.ContainsKey("Content-Type"))
             {
                 headers["Content-Type"]= ResponseDefaultContentType;

+ 1 - 1
dotnet/Sers/Sers.Gateway/Sers.Gateway/Sers.Gateway.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.Hardware/Sers.Hardware/Sers.Hardware.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Sers/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 139 - 0
dotnet/Sers/Sers.ServiceCenter/Sers.Gover.Zipkin/Extensions/ZipkinExtensions.cs

@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using Sers.Core.Module.Message;
+using Sers.Core.Module.Rpc;
+using Sers.Gover.Base;
+using Vit.Core.Module.Log;
+using zipkin4net;
+using zipkin4net.Tracers.Zipkin;
+using zipkin4net.Transport.Http;
+
+namespace Vit.Extensions
+{
+    public static partial class ZipkinExtensions
+    {
+        class Config
+        {
+            public float SamplingRate;
+            public string zipkinCollectorUrl;
+        }
+
+        /// <summary>
+        /// 从 appsettings.json::Sers.ServiceCenter.zipkin加载配置启用zipkin(若未指定则不启用zipkin)
+        /// </summary>
+        /// <param name="data"></param>
+        public static void UseZipkin(this GoverManage data)
+        {
+
+            var config = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetByPath<Config>("Sers.ServiceCenter.zipkin");
+
+            if (config == null) return;
+
+            #region (x.1)注册和启动 Zipkin
+            if (config.SamplingRate <= 0 || config.SamplingRate > 1) config.SamplingRate = 1;
+
+            TraceManager.SamplingRate = config.SamplingRate;
+
+            // 在链路追踪控制台获取 Zipkin Endpoint,注意 Endpoint 中不包含“/api/v2/spans”。
+            var httpSender = new HttpZipkinSender(config.zipkinCollectorUrl, "application/json");
+
+            var tracer = new ZipkinTracer(httpSender, new JSONSpanSerializer());
+
+            TraceManager.RegisterTracer(tracer);
+            TraceManager.Start(new MyLogger());
+            #endregion
+
+
+            data.AddApiScopeEvent(ApiScopeEvent);
+
+        }
+
+        static Action<Object, List<ArraySegment<byte>>> ApiScopeEvent(IRpcContextData rpcData, ApiMessage apiRequestMessage)
+        {
+            //记录请求数据
+
+            Trace trace = null;
+            try
+            {
+                long spanId = 0;
+                long traceId = 0;
+                long? parentSpanId = null;
+
+                {
+                    var hexStr = rpcData.caller_rid_Get();
+                    spanId = hexStr.Substring(0, 16).HexStringToInt64();
+                }
+                {
+                    var hexStr = rpcData.caller_rootRid_Get();
+                    if (hexStr == null)
+                    {
+                        traceId = spanId;
+                    }
+                    else
+                    {
+                        traceId = hexStr.Substring(0, 16).HexStringToInt64();
+                    }
+                }
+                {
+                    var hexStr = rpcData.caller_parentRid_Get();
+                    parentSpanId = hexStr?.Substring(0, 16).HexStringToInt64();
+                }
+
+                var spanState = new zipkin4net.SpanState(traceId, parentSpanId, spanId, true, false);
+                trace = Trace.CreateFromId(spanState);
+            }
+            catch (Exception ex)
+            {
+                trace = Trace.Create();
+                Logger.Error(ex);
+            }          
+           
+            Trace.Current = trace;
+
+            trace.Record(Annotations.ClientSend());
+            trace.Record(Annotations.Rpc("ServiceCenter"));
+            trace.Record(Annotations.ServiceName(rpcData.apiStationName_Get()));
+            trace.Record(Annotations.Tag("http.path", rpcData.route));
+            trace.Record(Annotations.Tag("http.url", rpcData.http_url_Get()));
+            trace.Record(Annotations.Tag("http.method", rpcData.http_method_Get()));
+
+            #region rpc data
+            try
+            {
+                trace.Record(Annotations.Tag("ReqRpc", rpcData.oriJson.ToString()));
+                string str = apiRequestMessage.value_OriData.ArraySegmentByteToString();
+                trace.Record(Annotations.Tag("ReqData", str ?? "")); 
+            }
+            catch
+            {
+            }
+            #endregion
+
+
+            return (s, apiReplyMessage) => {
+                trace.Record(Annotations.ClientRecv()); 
+            };
+        }
+
+
+        #region MyLogger       
+        class MyLogger : ILogger
+        {
+            public void LogError(string message)
+            {
+                Logger.Error("[zipkin]" + message);
+            }
+
+            public void LogInformation(string message)
+            {
+                Logger.Info("[zipkin]" + message);
+            }
+
+            public void LogWarning(string message)
+            {
+                Logger.Info("[zipkin]" + message);
+            }
+        }
+        #endregion
+    }
+}

+ 25 - 0
dotnet/Sers/Sers.ServiceCenter/Sers.Gover.Zipkin/Sers.Gover.Zipkin.csproj

@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netstandard2.0</TargetFramework>
+    <Version>2.1.1.329</Version>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <DocumentationFile>bin\Debug\netstandard2.0\Sers.Gover.Zipkin.xml</DocumentationFile>
+  </PropertyGroup>
+
+  <ItemGroup> 
+    <PackageReference Include="zipkin4net" Version="1.3.0" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Sers.Gover\Sers.Gover.csproj" />
+  </ItemGroup>
+
+ 
+
+  
+  
+  
+</Project>

+ 38 - 3
dotnet/Sers/Sers.ServiceCenter/Sers.Gover/Base/GoverManage.cs

@@ -194,10 +194,29 @@ namespace Sers.Gover.Base
                 }
                 #endregion
 
+                #region (x.8)ApiScopeEvent
+                apiScopeEventList?.ForEach(onScope =>
+                {
+                    try
+                    {
+                        var onDispose = onScope(rpcData, requestMessage);
+                        if (onDispose != null)
+                        {
+                            callback += onDispose;
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        Logger.Error(ex);
+                    }
+                });
+                #endregion
 
-                #region (x.8) 服务调用 
-                apiNode.CallApiAsync(rpcData, requestMessage, sender,callback);
+
+                #region (x.9)服务调用
+                apiNode.CallApiAsync(rpcData, requestMessage, sender,callback);                
                 #endregion
+
             }
             catch (Exception ex)
             {
@@ -314,7 +333,23 @@ namespace Sers.Gover.Base
         #endregion
 
 
-        
+        #region ApiScopeEvent
+
+        /// <summary>
+        /// 
+        /// </summary>
+        List<Func<IRpcContextData, ApiMessage, Action<Object, List<ArraySegment<byte>>>>> apiScopeEventList = null;
+        /// <summary>
+        /// 在调用api前调用onScope,若onScope返回的结果(onDispose)不为空,则在api调用结束前调用onDispose
+        /// </summary>
+        /// <param name="apiScopeEvent"></param>
+        public void AddApiScopeEvent(Func<IRpcContextData, ApiMessage, Action<Object, List<ArraySegment<byte>>>> apiScopeEvent) 
+        {
+            if (apiScopeEventList == null) apiScopeEventList=new List<Func<IRpcContextData, ApiMessage, Action<Object, List<ArraySegment<byte>>>>>();
+
+            apiScopeEventList.Add(apiScopeEvent);
+        }
+        #endregion
 
     }
 }

+ 2 - 2
dotnet/Sers/Sers.ServiceCenter/Sers.Gover/Sers.Gover.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
   </PropertyGroup>
 
   <PropertyGroup>
@@ -10,7 +10,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <ProjectReference Include="..\Sers.ServiceCenter\Sers.ServiceCenter.csproj" />
+    <ProjectReference Include="..\Sers.ServiceCenter\Sers.ServiceCenter.csproj" />   
   </ItemGroup>
 
  

+ 1 - 1
dotnet/Sers/Sers.ServiceCenter/Sers.ServiceCenter/ApiCenter/ApiCenterService.cs

@@ -74,7 +74,7 @@ namespace Sers.ServiceCenter.ApiCenter
         /// BeforeCallApi(IRpcContextData rpcData, ApiMessage requestMessage)
         /// </summary>
         [JsonIgnore]
-        public Action<IRpcContextData, ApiMessage> BeforeCallApi { get; set; }
+        public Action<IRpcContextData, ApiMessage> BeforeCallApi;
 
         public abstract void CallApiAsync(IRpcContextData rpcData, ApiMessage requestMessage, Object sender, Action<object, List<ArraySegment<byte>>> callback);
 

+ 1 - 1
dotnet/Sers/Sers.ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
   </PropertyGroup>
 
 

+ 1 - 1
dotnet/Sers/Sers.ServiceStation/Sers.ServiceStation/Sers.ServiceStation.csproj

@@ -3,7 +3,7 @@
  
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/StationDemo/SersLoader/Did.SersLoader.Demo/Did.SersLoader.Demo.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>

+ 1 - 1
dotnet/StationDemo/SersLoader/Did.SersLoader.HelloWorld/Did.SersLoader.HelloWorld.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 26 - 0
dotnet/Vit/Vit.Core/Vit.Core/Extensions/HexStringExtensions.cs

@@ -0,0 +1,26 @@
+using System;
+
+namespace Vit.Extensions
+{
+    public static partial class HexStringExtensions
+    {
+
+        #region bytes <--> HexString
+
+        public static string Int64ToHexString(this Int64 data)
+        {
+            return Convert.ToString(data, 16);
+        }
+
+
+        public static Int64 HexStringToInt64(this string hex)
+        {
+            //return Convert.ToInt64(hex, 16);
+            return Int64.Parse(hex, System.Globalization.NumberStyles.AllowHexSpecifier); 
+        }
+        #endregion
+
+
+
+    }
+}

+ 2 - 11
dotnet/Vit/Vit.Core/Vit.Core/Extensions/byte/HexStringExtensions.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Text;
-using Vit.Core.Module.Serialization;
 
 namespace Vit.Extensions
 {
@@ -12,7 +9,7 @@ namespace Vit.Extensions
 
         public static string BytesToHexString(this byte[] data)
         {
-            return BitConverter.ToString(data, 0).Replace("-", string.Empty);
+            return BitConverter.ToString(data).Replace("-", string.Empty);
         }
 
 
@@ -26,13 +23,7 @@ namespace Vit.Extensions
             }
             return bytes;
         }
-        #endregion
-
-
-     
-
-
-         
+        #endregion       
 
 
     }

+ 1 - 1
dotnet/Vit/Vit.Core/Vit.Core/Vit.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Vit/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Vit/Vit.WebHost/Vit.WebHost.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/netcore/Gateway/App.Gateway/App.Gateway.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 3 - 0
dotnet/netcore/Gateway/App.Gateway/appsettings.json

@@ -61,6 +61,9 @@
         /* 是否允许跨域访问,默认true */
         "allowAnyOrigin": true,
 
+        /* 把请求的ip地址、端口号复制到请求头中的前缀。若不指定则不复制。 */
+        "prefixOfCopyIpToHeader": "Sers-Gateway-",
+
         /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset  */
         "//ResponseDefaultContentType": "application/json; charset=UTF-8",
 

+ 1 - 1
dotnet/netcore/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 3 - 0
dotnet/netcore/ServiceCenter/App.Gover.Gateway/appsettings.json

@@ -53,6 +53,9 @@
         /* 是否允许跨域访问,默认true */
         "allowAnyOrigin": true,
 
+        /* 把请求的ip地址、端口号复制到请求头中的前缀。若不指定则不复制。 */
+        "prefixOfCopyIpToHeader": "Sers-Gateway-",
+
         /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset  */
         "//ResponseDefaultContentType": "application/json; charset=UTF-8",
 

+ 4 - 2
dotnet/netcore/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 
@@ -13,7 +13,8 @@
     <Content Include="web.config">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-  </ItemGroup>
+  </ItemGroup> 
+ 
 
   <ItemGroup>
     <ProjectReference Include="..\..\..\Sers\Sers.CL\Ipc\Sers.CL.Ipc.SharedMemory\Sers.CL.Ipc.SharedMemory.csproj" />
@@ -21,6 +22,7 @@
     <ProjectReference Include="..\..\..\Sers\Sers.CL\Zmq\FullDuplex\Sers.CL.Zmq.FullDuplex\Sers.CL.Zmq.FullDuplex.csproj" />
     <ProjectReference Include="..\..\..\Sers\Sers.CL\Zmq\ThreadWait\Sers.CL.ClrZmq.ThreadWait\Sers.CL.ClrZmq.ThreadWait.csproj" />
     <ProjectReference Include="..\..\..\Sers\Sers.Gateway\Sers.Gateway\Sers.Gateway.csproj" />
+    <ProjectReference Include="..\..\..\Sers\Sers.ServiceCenter\Sers.Gover.Zipkin\Sers.Gover.Zipkin.csproj" />
     <ProjectReference Include="..\..\..\Sers\Sers.ServiceCenter\Sers.Gover\Sers.Gover.csproj" />
   </ItemGroup>
  

+ 1 - 0
dotnet/netcore/ServiceCenter/App.ServiceCenter/Program.cs

@@ -19,6 +19,7 @@ namespace App.ServiceCenter
 
             #region (x.x.1)使用 Gover 服务治理 模块
             Sers.ServiceCenter.ServiceCenter.Instance.UseGover();
+            Sers.Gover.Base.GoverManage.Instance.UseZipkin();
             #endregion
 
 

+ 11 - 1
dotnet/netcore/ServiceCenter/App.ServiceCenter/appsettings.json

@@ -313,7 +313,14 @@
             }
           ]
         }
-      ]
+      ],
+
+
+      /* zipkin配置。若未指定则不启用zipkin */
+      "//zipkin": {
+        "SamplingRate": "1.0",
+        "zipkinCollectorUrl": "http://do.sersms.com:9411"
+      }
 
     },
 
@@ -338,6 +345,9 @@
         /* 是否允许跨域访问,默认true */
         "allowAnyOrigin": true,
 
+        /* 把请求的ip地址、端口号复制到请求头中的前缀。若不指定则不复制。 */
+        "prefixOfCopyIpToHeader": "Sers-Gateway-",
+
         /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset  */
         "//ResponseDefaultContentType": "application/json; charset=UTF-8",
 

+ 1 - 1
dotnet/netcore/Station/App.Ioc.Station/App.Ioc.Station.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/netcore/Station/App.Robot.Station/App.Robot.Station.csproj

@@ -4,7 +4,7 @@
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
     <RunPostBuildEvent>Always</RunPostBuildEvent>
-    <Version>2.1.1.328</Version>
+    <Version>2.1.1.329</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>