diff --git a/Doc/星尘分布式.emmx b/Doc/星尘分布式.emmx index b42b015e..0060644a 100644 Binary files a/Doc/星尘分布式.emmx and b/Doc/星尘分布式.emmx differ diff --git a/Doc/星尘分布式.png b/Doc/星尘分布式.png index 76ce6f32..c6118ab3 100644 Binary files a/Doc/星尘分布式.png and b/Doc/星尘分布式.png differ diff --git a/StarAgent/StarService.cs b/StarAgent/StarService.cs index 67810c89..818aa483 100644 --- a/StarAgent/StarService.cs +++ b/StarAgent/StarService.cs @@ -84,7 +84,7 @@ public class StarService : DisposeBase, IApi var ai = _agentInfo ??= AgentInfo.GetLocal(true); ai.Server = set.Server; - ai.Services = Manager?.Services.Where(e => e.Enable || !e.Name.EqualIgnoreCase("test", "test2")).Select(e => e.Name).ToArray(); + ai.Services = Manager?.Services?.Where(e => e.Enable || !e.Name.EqualIgnoreCase("test", "test2")).Select(e => e.Name).ToArray(); ai.Code = AgentSetting.Code; ai.IP = AgentInfo.GetIps(); @@ -95,13 +95,13 @@ public class StarService : DisposeBase, IApi } // 更新应用服务 - var controller = Manager?.QueryByProcess(info.ProcessId); + var controller = info == null ? null : Manager?.QueryByProcess(info.ProcessId); if (controller != null) { // 标记为星尘应用,停止Deploy上报进程信息 controller.IsStarApp = true; - controller.WriteEvent("本地探测", raw); + controller.WriteEvent("本地探测", raw!); } // 返回插件服务器地址 diff --git a/Stardust.Data/Entity/应用性能.Biz.cs b/Stardust.Data/Entity/应用性能.Biz.cs index 6fbf836c..d3f39e3d 100644 --- a/Stardust.Data/Entity/应用性能.Biz.cs +++ b/Stardust.Data/Entity/应用性能.Biz.cs @@ -108,17 +108,19 @@ public partial class AppMeter : Entity /// 高级查询 /// 应用 /// 客户端标识 + /// 数据来源。区分Ping/Deploy /// 开始时间 /// 结束时间 /// 关键字 /// 分页参数信息。可携带统计和数据权限扩展查询等信息 /// 实体列表 - public static IList Search(Int32 appId, String clientId, DateTime start, DateTime end, String key, PageParameter page) + public static IList Search(Int32 appId, String clientId, String source, DateTime start, DateTime end, String key, PageParameter page) { var exp = new WhereExpression(); if (appId >= 0) exp &= _.AppId == appId; if (!clientId.IsNullOrEmpty() && clientId != "null") exp &= _.ClientId == clientId; + if (!source.IsNullOrEmpty()) exp &= _.Source == source; exp &= _.Id.Between(start, end, Meta.Factory.Snow); if (!key.IsNullOrEmpty()) exp &= _.ClientId.Contains(key) | _.Creator.Contains(key) | _.CreateIP.Contains(key); diff --git a/Stardust.Server/Stardust.Server.csproj b/Stardust.Server/Stardust.Server.csproj index 64492340..b7783e5e 100644 --- a/Stardust.Server/Stardust.Server.csproj +++ b/Stardust.Server/Stardust.Server.csproj @@ -47,7 +47,7 @@ - + diff --git a/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs b/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs index 8b6619f1..a8d7b8d3 100644 --- a/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs +++ b/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs @@ -25,7 +25,7 @@ public class NodeOnlineController : ReadOnlyEntityController var list = ListFields; list.Clear(); - var allows = new[] { "ID", "ProjectName", "Name", "Category", "ProductCode", "CityName", "Address", "PingCount", "WebSocket", "Version", "OSKind", "IP", "AvailableMemory", "MemoryUsed", "AvailableFreeSpace", "SpaceUsed", "CpuRate", "ProcessCount", __.Signal, __.Offset, "UplinkSpeed", "DownlinkSpeed", "TraceId", "LocalTime", "CreateTime", "UpdateTime", "UpdateIP" }; + var allows = new[] { "ID", "ProjectName", "Name", "Category", "ProductCode", "CityName", "Address", "PingCount", "WebSocket", "Version", "OSKind", "IP", "AvailableMemory", "MemoryUsed", "AvailableFreeSpace", "SpaceUsed", "CpuRate", "ProcessCount", __.Signal, __.Offset, "UplinkSpeed", "DownlinkSpeed", "IntranetScore", "InternetScore", "TraceId", "LocalTime", "CreateTime", "UpdateTime", "UpdateIP" }; foreach (var item in allows) { list.AddListField(item); diff --git a/Stardust.Web/Areas/Registry/Controllers/AppMeterController.cs b/Stardust.Web/Areas/Registry/Controllers/AppMeterController.cs index 28823d51..9a3a39cf 100644 --- a/Stardust.Web/Areas/Registry/Controllers/AppMeterController.cs +++ b/Stardust.Web/Areas/Registry/Controllers/AppMeterController.cs @@ -23,6 +23,10 @@ public class AppMeterController : EntityController var df = ListFields.GetField("ClientId") as ListField; df.Url = "/Registry/AppMeter?appId={AppId}&clientId={ClientId}"; } + { + var df = ListFields.GetField("Source") as ListField; + df.Url = "/Registry/AppMeter?appId={AppId}&clientId={ClientId}&source={Source}"; + } } public override void OnActionExecuting(ActionExecutingContext filterContext) @@ -56,6 +60,7 @@ public class AppMeterController : EntityController var appId = p["appId"].ToInt(-1); var clientId = p["clientId"]; + var source = p["source"]; // 应用在线多IP时,只取第一个 if (!clientId.IsNullOrEmpty()) @@ -90,7 +95,7 @@ public class AppMeterController : EntityController if (p.Sort.IsNullOrEmpty()) p.OrderBy = _.Id.Desc(); - var list = AppMeter.Search(appId, clientId, start, end, p["Q"], p); + var list = AppMeter.Search(appId, clientId, source, start, end, p["Q"], p); // 如果没有clientId,则可能列表数据里面只有一个,选择它,便于展示图表 if (list.Count > 0 && clientId.IsNullOrEmpty()) diff --git a/Stardust.Web/Stardust.Web.csproj b/Stardust.Web/Stardust.Web.csproj index 79e335a8..5f930050 100644 --- a/Stardust.Web/Stardust.Web.csproj +++ b/Stardust.Web/Stardust.Web.csproj @@ -53,7 +53,7 @@ - + diff --git a/Stardust/Monitors/PingMonitor.cs b/Stardust/Monitors/PingMonitor.cs index 32f97b38..625a27c0 100644 --- a/Stardust/Monitors/PingMonitor.cs +++ b/Stardust/Monitors/PingMonitor.cs @@ -47,12 +47,12 @@ public class PingMonitor var threshold = 1f; var successRate = rtTimes.Count / Times; var latency = rtTimes.Average(); - var latencyScore = 0d; - if (latency <= threshold) - latencyScore = 1f; - else - // 衰减系数λ=0.001。1ms为100%,10ms为99.1%,100ms为90.57%,500ms为60.71%,1000ms为36.82% - latencyScore = Math.Exp(-0.001 * (latency - threshold)); + //var latencyScore = 0d; + //if (latency <= threshold) + // latencyScore = 1f; + //else + // 衰减系数λ=0.001。1ms为100%,10ms为99.1%,100ms为90.57%,500ms为60.71%,1000ms为36.82% + var latencyScore = Math.Exp(-0.001 * (latency - threshold)); // 确保得分在0-1之间 var score = successRate * latencyScore; diff --git a/Stardust/Stardust.csproj b/Stardust/Stardust.csproj index 65370fd3..60e42427 100644 --- a/Stardust/Stardust.csproj +++ b/Stardust/Stardust.csproj @@ -119,7 +119,7 @@ - +