From 73d8de7e2753a2036e1ea6c04eea81c6ffb060bb Mon Sep 17 00:00:00 2001 From: qinyouzeng Date: Mon, 18 Dec 2023 10:50:44 +0800 Subject: [PATCH] fix: fix trace select query --- .../Extensions/ICallerExtensions.cs | 6 +-- .../Services/MetricService.cs | 2 +- .../Masa.Tsc.Service.Admin/Program.cs | 4 +- .../Properties/launchSettings.json | 16 +++---- .../Panel/Trace/TscTraceSearch.razor | 8 ++-- .../Panel/Trace/TscTraceSearch.razor.cs | 45 +++++++++---------- 6 files changed, 39 insertions(+), 42 deletions(-) diff --git a/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/ICallerExtensions.cs b/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/ICallerExtensions.cs index 2331e31b..f44bfcab 100644 --- a/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/ICallerExtensions.cs +++ b/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/ICallerExtensions.cs @@ -5,13 +5,13 @@ namespace Masa.Contrib.Service.Caller; internal static class ICallerExtensions { - public static async Task GetByBodyAsync(this ICaller caller, string url, object body) where TResult : class + public static async Task GetByBodyAsync(this ICaller caller, string url, object body, CancellationToken? token = null) where TResult : class { if (caller is DaprCaller daprCaller) { var request = daprCaller.CreateRequest(HttpMethod.Get, url, body); - return (await daprCaller.SendAsync(request, default)) ?? default!; + return (await daprCaller.SendAsync(request, token ?? default)) ?? default!; } else { @@ -20,7 +20,7 @@ public static async Task GetByBodyAsync(this ICaller caller, s { request.Content = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json"); } - return (await caller.SendAsync(request, default)) ?? default!; + return (await caller.SendAsync(request, token ?? default)) ?? default!; } } } diff --git a/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Services/MetricService.cs b/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Services/MetricService.cs index bcc4bfe0..a72455a6 100644 --- a/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Services/MetricService.cs +++ b/src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Services/MetricService.cs @@ -46,7 +46,7 @@ public async Task GetQueryRangeAsync(RequestMetricAggDt return ConvertResult(result); } - public async Task> GetMultiRangeAsync(RequestMultiQueryRangeDto param) + public async Task> GetMultiRangeAsync(RequestMultiQueryRangeDto param, CancellationToken? token=null) { var result = (await Caller.GetByBodyAsync>($"{RootPath}/multi-range", param))!; if (result != null && result.Any()) diff --git a/src/Services/Masa.Tsc.Service.Admin/Program.cs b/src/Services/Masa.Tsc.Service.Admin/Program.cs index 52d22496..6fbc759c 100644 --- a/src/Services/Masa.Tsc.Service.Admin/Program.cs +++ b/src/Services/Masa.Tsc.Service.Admin/Program.cs @@ -57,8 +57,8 @@ #if DEBUG redis = AppSettings.GetModel("LocalRedisOptions"); -pmServiceUrl = "https://pm-service-dev.masastack.com"; -authServiceUrl = "https://auth-service-dev.masastack.com"; +pmServiceUrl = "https://pm-serviceiotdev.lonsid.cn"; +authServiceUrl = "https://auth-serviceiotdev.lonsid.cn"; builder.Services.AddDaprStarter(opt => { opt.AppId = appid; diff --git a/src/Services/Masa.Tsc.Service.Admin/Properties/launchSettings.json b/src/Services/Masa.Tsc.Service.Admin/Properties/launchSettings.json index 1f45c036..34454726 100644 --- a/src/Services/Masa.Tsc.Service.Admin/Properties/launchSettings.json +++ b/src/Services/Masa.Tsc.Service.Admin/Properties/launchSettings.json @@ -24,15 +24,15 @@ "MASA_ENVIRONMENT": "Development", "MASA_CLUSTER": "Default", "MASA_NAMESPACE": "masastack", - "SUFFIX_IDENTITY": "dev", - "MASA_STACK": "[{\"id\":\"pm\",\"service\":{\"id\":\"pm-service-dev\",\"domain\":\"http://pm-service-dev.masastack.com\"},\"web\":{\"id\":\"pm-web-dev\",\"domain\":\"https://pm-dev.masastack.com\"}},{\"id\":\"dcc\",\"service\":{\"id\":\"dcc-service-dev\",\"domain\":\"http://dcc-service-dev.masastack.com\"},\"web\":{\"id\":\"dcc-web-dev\",\"domain\":\"https://dcc-dev.masastack.com\"}},{\"id\":\"tsc\",\"service\":{\"id\":\"tsc-service-dev\",\"domain\":\"http://tsc-service-dev.masastack.com\"},\"web\":{\"id\":\"tsc-web-dev\",\"domain\":\"https://tsc-dev.masastack.com\"}},{\"id\":\"alert\",\"service\":{\"id\":\"alert-service-dev\",\"domain\":\"http://alert-service-dev.masastack.com\"},\"web\":{\"id\":\"alert-web-dev\",\"domain\":\"https://alert-dev.masastack.com\"}},{\"id\":\"scheduler\",\"service\":{\"id\":\"scheduler-service-dev\",\"domain\":\"http://scheduler-service-dev.masastack.com\"},\"worker\":{\"id\":\"scheduler-worker-dev\",\"domain\":\"http://scheduler-worker-dev.masastack.com\"},\"web\":{\"id\":\"scheduler-web-dev\",\"domain\":\"https://scheduler-dev.masastack.com\"}},{\"id\":\"mc\",\"service\":{\"id\":\"mc-service-dev\",\"domain\":\"http://mc-service-dev.masastack.com\"},\"web\":{\"id\":\"mc-web-dev\",\"domain\":\"https://mc-dev.masastack.com\"}},{\"id\":\"auth\",\"service\":{\"id\":\"auth-service-dev\",\"domain\":\"http://auth-service-dev.masastack.com\"},\"web\":{\"id\":\"auth-web-dev\",\"domain\":\"https://auth-dev.masastack.com\"},\"sso\":{\"id\":\"auth-sso-dev\",\"domain\":\"https://auth-sso-dev.masastack.com\"}}]", - "REDIS": "{\"RedisHost\": \"10.130.0.19\", \"RedisPort\": 2135, \"RedisDb\": 3,\"RedisPassword\": \"Hzss@123\"}", - "CONNECTIONSTRING": "{\"Server\": \"10.130.0.19\", \"Port\": 2415,\"Database\":\"pm-dev\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}", + //"SUFFIX_IDENTITY": "dev", + //"MASA_STACK": "[{\"id\":\"pm\",\"service\":{\"id\":\"pm-service-dev\",\"domain\":\"http://pm-service-dev.masastack.com\"},\"web\":{\"id\":\"pm-web-dev\",\"domain\":\"https://pm-dev.masastack.com\"}},{\"id\":\"dcc\",\"service\":{\"id\":\"dcc-service-dev\",\"domain\":\"http://dcc-service-dev.masastack.com\"},\"web\":{\"id\":\"dcc-web-dev\",\"domain\":\"https://dcc-dev.masastack.com\"}},{\"id\":\"tsc\",\"service\":{\"id\":\"tsc-service-dev\",\"domain\":\"http://tsc-service-dev.masastack.com\"},\"web\":{\"id\":\"tsc-web-dev\",\"domain\":\"https://tsc-dev.masastack.com\"}},{\"id\":\"alert\",\"service\":{\"id\":\"alert-service-dev\",\"domain\":\"http://alert-service-dev.masastack.com\"},\"web\":{\"id\":\"alert-web-dev\",\"domain\":\"https://alert-dev.masastack.com\"}},{\"id\":\"scheduler\",\"service\":{\"id\":\"scheduler-service-dev\",\"domain\":\"http://scheduler-service-dev.masastack.com\"},\"worker\":{\"id\":\"scheduler-worker-dev\",\"domain\":\"http://scheduler-worker-dev.masastack.com\"},\"web\":{\"id\":\"scheduler-web-dev\",\"domain\":\"https://scheduler-dev.masastack.com\"}},{\"id\":\"mc\",\"service\":{\"id\":\"mc-service-dev\",\"domain\":\"http://mc-service-dev.masastack.com\"},\"web\":{\"id\":\"mc-web-dev\",\"domain\":\"https://mc-dev.masastack.com\"}},{\"id\":\"auth\",\"service\":{\"id\":\"auth-service-dev\",\"domain\":\"http://auth-service-dev.masastack.com\"},\"web\":{\"id\":\"auth-web-dev\",\"domain\":\"https://auth-dev.masastack.com\"},\"sso\":{\"id\":\"auth-sso-dev\",\"domain\":\"https://auth-sso-dev.masastack.com\"}}]", + //"REDIS": "{\"RedisHost\": \"localhost\", \"RedisPort\": 6379, \"RedisDb\": 5}", + //"CONNECTIONSTRING": "{\"Server\": \"10.130.0.19\", \"Port\": 2415,\"Database\":\"pm-dev\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}", //"ELASTIC": "{\"Nodes\": [\"http://es-ydy-new.lonsid.cn:9200\"],\"Index\": \"auth_user_development\"}", - //"MASA_STACK": "[{\"id\":\"pm\",\"name\":\"PM\",\"service\":{\"name\":\"PM.Service\",\"id\":\"pm-service-iotdev\",\"domain\":\"https://pm-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"PM.Web\",\"id\":\"pm-web-iotdev\",\"domain\":\"https://pm-iotdev.lonsid.cn\"}},{\"id\":\"dcc\",\"name\":\"DCC\",\"service\":{\"name\":\"Dcc.Service\",\"id\":\"dcc-service-iotdev\",\"domain\":\"https://dcc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"DCC.Web\",\"id\":\"dcc-web-iotdev\",\"domain\":\"https://dcc-iotdev.lonsid.cn\"}},{\"id\":\"tsc\",\"name\":\"TSC\",\"service\":{\"name\":\"TSC.Service\",\"id\":\"tsc-service-iotdev\",\"domain\":\"https://tsc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"TSC.Web\",\"id\":\"tsc-web-iotdev\",\"domain\":\"https://tsc-iotdev.lonsid.cn\"}},{\"id\":\"alert\",\"name\":\"Alert\",\"service\":{\"name\":\"Alert.Service\",\"id\":\"alert-service-iotdev\",\"domain\":\"https://alert-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Alert.Web\",\"id\":\"alert-web-iotdev\",\"domain\":\"https://alert-iotdev.lonsid.cn\"}},{\"id\":\"scheduler\",\"name\":\"Scheduler\",\"service\":{\"name\":\"Scheduler.Service\",\"id\":\"scheduler-service-iotdev\",\"domain\":\"https://scheduler-service-iotdev.lonsid.cn\"},\"worker\":{\"name\":\"Scheduler.Worker\",\"id\":\"scheduler-worker-iotdev\",\"domain\":\"https://scheduler-worker-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Scheduler.Web\",\"id\":\"scheduler-web-iotdev\",\"domain\":\"https://scheduler-iotdev.lonsid.cn\"}},{\"id\":\"mc\",\"name\":\"MC\",\"service\":{\"name\":\"MC.Service\",\"id\":\"mc-service-iotdev\",\"domain\":\"https://mc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"MC.Web\",\"id\":\"mc-web-iotdev\",\"domain\":\"https://mc-iotdev.lonsid.cn\"}},{\"id\":\"auth\",\"name\":\"Auth\",\"service\":{\"name\":\"Auth.Service\",\"id\":\"auth-service-iotdev\",\"domain\":\"https://auth-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Auth.Web\",\"id\":\"auth-web-iotdev\",\"domain\":\"https://auth-iotdev.lonsid.cn\"},\"sso\":{\"name\":\"Auth.SSO\",\"id\":\"auth-sso-iotdev\",\"domain\":\"https://auth-sso-iotdev.lonsid.cn\"}},{\"id\":\"iot\",\"name\":\"IOT\",\"web\":{\"name\":\"Iot.Web\",\"id\":\"lonsid-iot-admin\",\"domain\":\"\"}}]", - //"REDIS": "{\"RedisHost\": \"10.130.0.235\",\"RedisPort\": 17140,\"RedisDb\": 0,\"RedisPassword\": \"Hzss@123\"}", - //"CONNECTIONSTRING": "{\"Server\": \"10.130.0.235\", \"Port\": 47622,\"Database\":\"\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}", - //"SUFFIX_IDENTITY": "iotdev", + "MASA_STACK": "[{\"id\":\"pm\",\"name\":\"PM\",\"service\":{\"name\":\"PM.Service\",\"id\":\"pm-service-iotdev\",\"domain\":\"https://pm-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"PM.Web\",\"id\":\"pm-web-iotdev\",\"domain\":\"https://pm-iotdev.lonsid.cn\"}},{\"id\":\"dcc\",\"name\":\"DCC\",\"service\":{\"name\":\"Dcc.Service\",\"id\":\"dcc-service-iotdev\",\"domain\":\"https://dcc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"DCC.Web\",\"id\":\"dcc-web-iotdev\",\"domain\":\"https://dcc-iotdev.lonsid.cn\"}},{\"id\":\"tsc\",\"name\":\"TSC\",\"service\":{\"name\":\"TSC.Service\",\"id\":\"tsc-service-iotdev\",\"domain\":\"https://tsc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"TSC.Web\",\"id\":\"tsc-web-iotdev\",\"domain\":\"https://tsc-iotdev.lonsid.cn\"}},{\"id\":\"alert\",\"name\":\"Alert\",\"service\":{\"name\":\"Alert.Service\",\"id\":\"alert-service-iotdev\",\"domain\":\"https://alert-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Alert.Web\",\"id\":\"alert-web-iotdev\",\"domain\":\"https://alert-iotdev.lonsid.cn\"}},{\"id\":\"scheduler\",\"name\":\"Scheduler\",\"service\":{\"name\":\"Scheduler.Service\",\"id\":\"scheduler-service-iotdev\",\"domain\":\"https://scheduler-service-iotdev.lonsid.cn\"},\"worker\":{\"name\":\"Scheduler.Worker\",\"id\":\"scheduler-worker-iotdev\",\"domain\":\"https://scheduler-worker-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Scheduler.Web\",\"id\":\"scheduler-web-iotdev\",\"domain\":\"https://scheduler-iotdev.lonsid.cn\"}},{\"id\":\"mc\",\"name\":\"MC\",\"service\":{\"name\":\"MC.Service\",\"id\":\"mc-service-iotdev\",\"domain\":\"https://mc-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"MC.Web\",\"id\":\"mc-web-iotdev\",\"domain\":\"https://mc-iotdev.lonsid.cn\"}},{\"id\":\"auth\",\"name\":\"Auth\",\"service\":{\"name\":\"Auth.Service\",\"id\":\"auth-service-iotdev\",\"domain\":\"https://auth-service-iotdev.lonsid.cn\"},\"web\":{\"name\":\"Auth.Web\",\"id\":\"auth-web-iotdev\",\"domain\":\"https://auth-iotdev.lonsid.cn\"},\"sso\":{\"name\":\"Auth.SSO\",\"id\":\"auth-sso-iotdev\",\"domain\":\"https://auth-sso-iotdev.lonsid.cn\"}},{\"id\":\"iot\",\"name\":\"IOT\",\"web\":{\"name\":\"Iot.Web\",\"id\":\"lonsid-iot-admin\",\"domain\":\"\"}}]", + "REDIS": "{\"RedisHost\": \"10.130.0.19\",\"RedisPort\": 2135,\"RedisDb\": 0,\"RedisPassword\": \"Hzss@123\"}", + "CONNECTIONSTRING": "{\"Server\": \"10.130.0.19\", \"Port\": 2959,\"Database\":\"\",\"UserId\": \"ss\",\"Password\":\"Hzss@123\"}", + "SUFFIX_IDENTITY": "iotdev", //"MASA_NAMESPACE": "masastack-iot", "ELASTIC": "{\"Nodes\": [\"http://es-ydy-new.lonsid.cn:9200\"],\"Index\": \"masastack\"}", //"CLICKHOUSE_CONNECTIONSTRING": "Compress=True;CheckCompressedHash=False;Compressor=lz4;SocketTimeout=10000;Host=10.130.0.19;Port=3806;User=apptest;Password=Apptest@123;Database=otel_test", diff --git a/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor b/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor index 72a4abd4..14cb43f3 100644 --- a/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor +++ b/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor @@ -21,7 +21,7 @@ Loading="_serviceSearching" Class="mr-4 rounded-2 m-input--h-40" Style="max-width: 280px" - OnSelectedItemUpdate="()=>Query(isService:true)" + OnSelect="()=>Query(isService:true)" OnClearClick="()=>Query(isService:true)" /> + OnSelect="()=>Query(isEndpoint:true)" + OnClearClick="()=>Query(isEndpoint:true)" /> @if (!PageMode) { diff --git a/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor.cs b/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor.cs index 20e3706f..93097b8c 100644 --- a/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor.cs +++ b/src/Web/Masa.Tsc.Web.Admin.Rcl/Components/Dashboards/Configurations/Panel/Trace/TscTraceSearch.razor.cs @@ -63,7 +63,7 @@ public async Task SearchServices() _services = (await QueryServices.Invoke())?.ToList()!; if (!string.IsNullOrEmpty(Service) && _services != null && _services.Contains(Service)) { - await SearchEndpoints(); + await SearchInstances(); await SearchEndpoints(); } else @@ -93,34 +93,31 @@ private async Task SearchEndpoints() _endpointSearching = false; } - private void OnEnter() + private Task OnEnter() { - Query(); + return Query(); } - private void Query(bool isService = false, bool isInstance = false) + private async Task Query(bool isService = false, bool isInstance = false, bool isEndpoint = false) { - NextTick(async () => + if (!(isService || isInstance || isEndpoint)) + { + await SearchServices(); + } + else if (isService) { - if (isService) - { - _instance = default; - _endpoint = default; - await SearchInstances(); - await SearchEndpoints(); - } - else if (isInstance) - { - await SearchEndpoints(); - } - else - { - await SearchServices(); - } - - await OnQueryUpdate.InvokeAsync((Service, _instance, _endpoint, Keyword)); - StateHasChanged(); - }); + _instance = default; + _endpoint = default; + await SearchInstances(); + await SearchEndpoints(); + } + else if (isInstance) + { + await SearchEndpoints(); + } + + await OnQueryUpdate.InvokeAsync((Service, _instance, _endpoint, Keyword)); + StateHasChanged(); } private async Task OnDateTimeUpdate((DateTimeOffset? start, DateTimeOffset? end) range)