Skip to content

Commit

Permalink
fix: fix trace select query
Browse files Browse the repository at this point in the history
  • Loading branch information
qinyouzeng committed Dec 18, 2023
1 parent 6594095 commit 73d8de7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace Masa.Contrib.Service.Caller;

internal static class ICallerExtensions
{
public static async Task<TResult> GetByBodyAsync<TResult>(this ICaller caller, string url, object body) where TResult : class
public static async Task<TResult> GetByBodyAsync<TResult>(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<TResult>(request, default)) ?? default!;
return (await daprCaller.SendAsync<TResult>(request, token ?? default)) ?? default!;
}
else
{
Expand All @@ -20,7 +20,7 @@ public static async Task<TResult> GetByBodyAsync<TResult>(this ICaller caller, s
{
request.Content = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
}
return (await caller.SendAsync<TResult>(request, default)) ?? default!;
return (await caller.SendAsync<TResult>(request, token ?? default)) ?? default!;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task<QueryResultDataResponse> GetQueryRangeAsync(RequestMetricAggDt
return ConvertResult(result);
}

public async Task<List<QueryResultDataResponse>> GetMultiRangeAsync(RequestMultiQueryRangeDto param)
public async Task<List<QueryResultDataResponse>> GetMultiRangeAsync(RequestMultiQueryRangeDto param, CancellationToken? token=null)
{
var result = (await Caller.GetByBodyAsync<List<QueryResultDataResponse>>($"{RootPath}/multi-range", param))!;
if (result != null && result.Any())
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Masa.Tsc.Service.Admin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@

#if DEBUG
redis = AppSettings.GetModel<RedisConfigurationOptions>("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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)" />

<SAutoComplete Placeholder="@I18n.T("Instance")" Label="@I18n.T("Instance")"
Expand All @@ -44,7 +44,7 @@
Class="mr-4 rounded-2 m-input--h-40"
Style="max-width: 280px"
Disabled="@(string.IsNullOrWhiteSpace(Service))"
OnSelectedItemUpdate="()=>Query(isInstance:true)"
OnSelect="()=>Query(isInstance:true)"
OnClearClick="()=>Query(isInstance:true)" />

<SAutoComplete Placeholder="@I18n.T("Endpoint")" Label="@I18n.T("Endpoint")"
Expand All @@ -68,8 +68,8 @@
Disabled="@(string.IsNullOrWhiteSpace(Service))"
Class="mr-4 rounded-2 m-input--h-40"
Style="max-width: 280px;"
OnSelectedItemUpdate="()=>Query()"
OnClearClick="()=>Query()" />
OnSelect="()=>Query(isEndpoint:true)"
OnClearClick="()=>Query(isEndpoint:true)" />
@if (!PageMode)
{
<MSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 73d8de7

Please sign in to comment.