diff --git a/.erda/migrations/monitor/20210902-sp_metric_expression.sql b/.erda/migrations/monitor/20210902-sp_metric_expression.sql new file mode 100644 index 00000000000..c589beb4f37 --- /dev/null +++ b/.erda/migrations/monitor/20210902-sp_metric_expression.sql @@ -0,0 +1,8 @@ +UPDATE `sp_metric_expression` SET `enable` = 0 WHERE `id` = (SELECT `id` FROM (SELECT `id` FROM `sp_metric_expression` WHERE `enable` = 1 AND `expression` LIKE "%\"alias\":\"trace\"%") AS `ids`); +INSERT `sp_metric_expression`(`attributes`,`expression`,`version`) VALUES("{}","{\"alias\":\"trace\",\"filter\":{},\"functions\":[{\"aggregator\":\"min\",\"alias\":\"start_time\",\"field\":\"start_time\"},{\"aggregator\":\"max\",\"alias\":\"end_time\",\"field\":\"end_time\"},{\"aggregator\":\"distinct\",\"alias\":\"components\",\"field\":\"components\",\"field_script\":\"function invoke(field, tag){ if(tag.span_layer=='http' || tag.span_layer=='rpc') return tag.service_name; return tag.component; }\"},{\"aggregator\":\"sum\",\"field\":\"errors\",\"field_script\":\"function invoke(field, tag){ return tag.error=='true'?1:0; }\"},{\"aggregator\":\"distinct\",\"alias\":\"application_names\",\"field\":\"applications\",\"field_script\":\"function invoke(field, tag){ return tag.application_name; }\"},{\"aggregator\":\"distinct\",\"alias\":\"applications_ids\",\"field\":\"applications_ids\",\"field_script\":\"function invoke(field, tag){ return tag.application_id; }\"},{\"aggregator\":\"distinct\",\"alias\":\"service_names\",\"field\":\"service_names\",\"field_script\":\"function invoke(field, tag){ return tag.service_name; }\"},{\"aggregator\":\"distinct\",\"alias\":\"service_ids\",\"field\":\"service_ids\",\"field_script\":\"function invoke(field, tag){ return tag.service_id; }\"},{\"aggregator\":\"distinct\",\"alias\":\"dubbo_methods\",\"field\":\"dubbo_methods\",\"field_script\":\"function invoke(field, tag){ return tag.dubbo_method; }\"},{\"aggregator\":\"distinct\",\"alias\":\"http_paths\",\"field\":\"http_paths\",\"field_script\":\"function invoke(field, tag){ return tag.http_path; }\"},{\"aggregator\":\"distinct\",\"alias\":\"db_statements\",\"field\":\"db_statements\",\"field_script\":\"function invoke(field, tag){ return tag.db_statement; }\"},{\"aggregator\":\"distinct\",\"alias\":\"topics\",\"field\":\"topics\",\"field_script\":\"function invoke(field, tag){ return tag.message_bus_destination; }\"},{\"aggregator\":\"distinct\",\"alias\":\"terminus_keys\",\"field\":\"terminus_keys\",\"field_script\":\"function invoke(field, tag){ return tag.terminus_key; }\"},{\"aggregator\":\"value\",\"alias\":\"trace_duration\",\"field\":\"trace_duration\",\"field_script\":\"function invoke(field, tag){ return field.end_time - field.start_time; }\",\"trigger\":\"aggregated\"},{\"aggregator\":\"sum\",\"alias\":\"span_count\",\"field\":\"span_count\",\"field_script\":\"function invoke(field, tag){ return 1; }\"}],\"group\":[\"trace_id\"],\"metric\":\"span\",\"outputs\":[\"metric\"],\"select\":{\"cluster_name\":\"#cluster_name\",\"org_id\":\"#org_id\",\"org_name\":\"#org_name\",\"project_id\":\"#project_id\",\"project_name\":\"#project_name\",\"trace_id\":\"#trace_id\",\"workspace\":\"#workspace\"},\"window\":3}","3.0"); + +REPLACE INTO `sp_dashboard_block_system` (`id`,`name`,`desc`,`scope`,`scope_id`,`version`,`view_config`) VALUES ("translation_analysis_cache","translation_analysis_cache","","micro_service","global","v2",'[{"h":10,"i":"view-lVTYdASX","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filterServiceName":"{{serviceName}}","layer":"cache","search":"{{search}}","serviceId":"{{serviceId}}","sort":"{{sort}}","start":"{{startTime}}","terminusKey":"{{terminusKey}}"},"url":"/api/apm/topology/translation/db"},"chartType":"table","config":{"dataSourceConfig":{"valueDimensions":[{"alias":"事务名称","i18n":{"alias":{"en":"Translation Name","zh":"事务名称"}},"key":"operation","resultType":"string","type":"field"},{"alias":"缓存类型","i18n":{"alias":{"en":"Cache Type","zh":"缓存类型"}},"key":"db_type","resultType":"string","type":"field"},{"alias":"缓存地址","i18n":{"alias":{"en":"Cache Host","zh":"缓存地址"}},"key":"db_host","resultType":"string","type":"field"},{"alias":"调用次数","i18n":{"alias":{"en":"Called Count","zh":"调用次数"}},"key":"call_count","resultType":"number","type":"field"},{"alias":"慢调用次数","i18n":{"alias":{"en":"Slow Called Count","zh":"慢调用次数"}},"key":"slow_elapsed_count","resultType":"number","type":"field"},{"alias":"平均时延","i18n":{"alias":{"en":"Avg Time Delay","zh":"平均时延"}},"key":"avg_elapsed","resultType":"string","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"searchTranslation","value":"operation"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Cache Called","zh":"缓存事务"}},"staticData":{},"title":"缓存事务"},"w":24,"x":0,"y":0},{"h":11,"i":"view-1XA1pzWR","view":{"api":{"body":{"from":["application_cache"],"groupby":["time()"],"select":[{"alias":"typegq99wZs2","expr":"time()"},{"alias":"valueSR6vrde7","expr":"round_float(sum(elapsed_count::field), 2)"}],"where":["db_statement::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","search":"{{search}}","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:bar","config":{"dataSourceConfig":{"activedMetricGroups":["application_cache","application_cahce_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typegq99wZs2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"count","alias":"请求次数","field":"application_cache-elapsed_count::field","i18n":{"alias":{"en":"Request Count","zh":"请求次数"}},"key":"valueSR6vrde7","resultType":"number","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD"}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Service Request","zh":"服务请求"}},"staticData":{},"title":"服务请求"},"w":12,"x":0,"y":10},{"h":11,"i":"view-J4SwjHDP","view":{"api":{"body":{"from":["application_cache"],"groupby":["time()"],"select":[{"alias":"typeQuPvs7M2","expr":"time()"},{"alias":"valueCxbcWuWT","expr":"round_float(avg(elapsed_mean::field), 2)"}],"where":["db_statement::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:line","config":{"dataSourceConfig":{"activedMetricGroups":["application_cache","application_cache_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typeQuPvs7M2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"avg","alias":"平均响应时间","field":"application_cache-elapsed_mean::field","i18n":{"alias":{"en":"Avg Response Time","zh":"平均响应时间"}},"key":"valueCxbcWuWT","resultType":"number","type":"field","unit":{"type":"TIME","unit":"ns"}}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD","noAreaColor":true}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Request Time Delay","zh":"请求时延"}},"staticData":{},"title":"请求延迟"},"w":12,"x":12,"y":10},{"h":9,"i":"view-FlQBcOqT","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","format":"chartv2","q":"SELECT db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(max(elapsed_max::field),\'\',2) as 最大耗时,format_duration(min(elapsed_min::field),\'\',2) as 最小耗时 FROM application_cache_slow WHERE db_statement::tag=~/.*{{subSearch}}.*/ GROUP BY db_statement::tag ORDER BY avg(elapsed_mean::field) DESC LIMIT 50 ","ql":"influxql","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_cache_slow","fromSource":["application_cache_slow"],"groupBy":"db_statement::tag","limit":50,"orderBy":"","select":"db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时","where":["db_statement::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Statement"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Slow Translation Tracing Top50","zh":"慢事务追踪 Top50"}},"staticData":{},"title":"慢事务追踪 Top50"},"w":14,"x":0,"y":21},{"h":9,"i":"view-sCRTdIQb","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","format":"chartv2","q":"SELECT db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间 FROM application_cache_error WHERE db_statement::tag=~/.*{{subSearch}}.*/ GROUP BY db_statement::tag ORDER BY max(timestamp) DESC LIMIT 50 ","ql":"influxql","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_cache_error","fromSource":["application_cache_error"],"groupBy":"db_statement::tag","limit":50,"select":"db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间","where":["db_statement::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Statement"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Error Translation Tracing Top50","zh":"错误事务追踪 Top50"}},"staticData":{},"title":"错误事务追踪 Top50"},"w":10,"x":14,"y":21}]'); +REPLACE INTO `sp_dashboard_block_system` (`id`,`name`,`desc`,`scope`,`scope_id`,`version`,`view_config`) VALUES ("translation_analysis_database","translation_analysis_database","","micro_service","global","v2",'[{"h":10,"i":"view-lVTYdASX","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filterServiceName":"{{serviceName}}","layer":"db","search":"{{search}}","serviceId":"{{serviceId}}","sort":"{{sort}}","start":"{{startTime}}","terminusKey":"{{terminusKey}}"},"url":"/api/apm/topology/translation/db"},"chartType":"table","config":{"dataSourceConfig":{"valueDimensions":[{"alias":"SQL 事务","i18n":{"alias":{"en":"SQL","zh":"SQL 事务"}},"key":"operation","resultType":"string","type":"field"},{"alias":"数据库类型","i18n":{"alias":{"en":"Database Type","zh":"数据库类型"}},"key":"db_type","resultType":"string","type":"field"},{"alias":"数据库实例","i18n":{"alias":{"en":"Database Instance","zh":"数据库实例"}},"key":"db_instance","resultType":"string","type":"field"},{"alias":"数据库地址","i18n":{"alias":{"en":"Database Instance","zh":"数据库实例"}},"key":"db_host","resultType":"string","type":"field"},{"alias":"调用次数","i18n":{"alias":{"en":"Request Count","zh":"调用次数"}},"key":"call_count","resultType":"number","type":"field"},{"alias":"慢调用次数","i18n":{"alias":{"en":"Slow Request Count","zh":"慢调用次数"}},"key":"slow_elapsed_count","resultType":"number","type":"field"},{"alias":"平均延迟","i18n":{"alias":{"en":"Avg Time Delay","zh":"平均延迟"}},"key":"avg_elapsed","resultType":"string","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"searchTranslation","value":"operation"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Databases Translation","zh":"数据库事务"}},"staticData":{},"title":"数据库事务"},"w":24,"x":0,"y":0},{"h":11,"i":"view-1XA1pzWR","view":{"api":{"body":{"from":["application_db"],"groupby":["time()"],"select":[{"alias":"typegq99wZs2","expr":"time()"},{"alias":"valueSR6vrde7","expr":"round_float(sum(elapsed_count::field), 2)"}],"where":["db_statement::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:bar","config":{"dataSourceConfig":{"activedMetricGroups":["application_db","application_db_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typegq99wZs2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"count","alias":"请求次数","field":"application_db-elapsed_count::field","i18n":{"alias":{"en":"Request Count","zh":"请求次数"}},"key":"valueSR6vrde7","resultType":"number","type":"field"}]},"optionProps":{"isMoreThanOneDay":false,"moreThanOneDayFormat":"YYYY/MM/DD"}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Service Request","zh":"服务请求"}},"staticData":{},"title":"服务请求"},"w":12,"x":0,"y":10},{"h":11,"i":"view-J4SwjHDP","view":{"api":{"body":{"from":["application_db"],"groupby":["time()"],"select":[{"alias":"typeQuPvs7M2","expr":"time()"},{"alias":"valueCxbcWuWT","expr":"round_float(avg(elapsed_mean::field), 2)"}],"where":["db_statement::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:line","config":{"dataSourceConfig":{"activedMetricGroups":["application_db","application_db_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typeQuPvs7M2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"avg","alias":"平均响应时间","field":"application_db-elapsed_mean::field","i18n":{"alias":{"en":"Avg Response Time","zh":"平均响应时间"}},"key":"valueCxbcWuWT","resultType":"number","type":"field","unit":{"type":"TIME","unit":"ns"}}]},"optionProps":{"isMoreThanOneDay":false,"moreThanOneDayFormat":"YYYY/MM/DD","noAreaColor":true}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Request Time Delay","zh":"请求时延"}},"staticData":{},"title":"请求时延"},"w":12,"x":12,"y":10},{"h":9,"i":"view-FlQBcOqT","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","format":"chartv2","q":"SELECT db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(max(elapsed_max::field),\'\',2) as 最大耗时,format_duration(min(elapsed_min::field),\'\',2) as 最小耗时 FROM application_db_slow WHERE db_statement::tag=~/.*{{subSearch}}.*/ GROUP BY db_statement::tag ORDER BY avg(elapsed_mean::field) DESC LIMIT 50 ","ql":"influxql","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_db_slow","fromSource":["application_db_slow"],"groupBy":"db_statement::tag","limit":50,"orderBy":"","select":"db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时","where":["db_statement::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Statement"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Slow Translation Tracing Top50","zh":"慢事务追踪 Top50"}},"staticData":{},"title":"慢事务追踪 Top50"},"w":14,"x":0,"y":21},{"h":9,"i":"view-sCRTdIQb","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_source_service_id":"{{serviceId}}","format":"chartv2","q":"SELECT db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间 FROM application_db_error WHERE db_statement::tag=~/.*{{subSearch}}.*/ GROUP BY db_statement::tag ORDER BY max(timestamp) DESC LIMIT 50 ","ql":"influxql","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_db_error","fromSource":["application_db_error"],"groupBy":"db_statement::tag","limit":50,"select":"db_statement::tag as Statement,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间","where":["db_statement::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Statement"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Error Translation Tracing Top50","zh":"错误事务追踪 Top50"}},"staticData":{},"title":"错误事务追踪 Top50"},"w":10,"x":14,"y":21}]'); +REPLACE INTO `sp_dashboard_block_system` (`id`,`name`,`desc`,`scope`,`scope_id`,`version`,`view_config`) VALUES ("translation_analysis_http","translation_analysis_http","","micro_service","global","v2",'[{"h":10,"i":"view-lVTYdASX","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filterServiceName":"{{serviceName}}","layer":"http","search":"{{search}}","serviceId":"{{serviceId}}","sort":"{{sort}}","start":"{{startTime}}","terminusKey":"{{terminusKey}}"},"url":"/api/apm/topology/translation"},"chartType":"table","config":{"dataSourceConfig":{"valueDimensions":[{"alias":"事务名称","i18n":{"alias":{"en":"Translation Name","zh":"事务名称"}},"key":"translation_name","resultType":"string","type":"field"},{"alias":"调用次数","i18n":{"alias":{"en":"Called Count","zh":"调用次数"}},"key":"elapsed_count","resultType":"number","type":"field"},{"alias":"错误次数","i18n":{"alias":{"en":"Error Count","zh":"错误次数"}},"key":"error_count","resultType":"number","type":"field"},{"alias":"慢调用次数","i18n":{"alias":{"en":"Slow Called Count","zh":"慢调用次数"}},"key":"slow_elapsed_count","resultType":"number","type":"field"},{"alias":"平均时延","i18n":{"alias":{"en":"Avg Time Delay","zh":"平均时延"}},"key":"avg_elapsed","resultType":"string","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"searchTranslation","value":"translation_name"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"HTTP Translation","zh":"HTTP 事务"}},"staticData":{},"title":"HTTP 事务"},"w":24,"x":0,"y":0},{"h":11,"i":"view-UQW30sdQ","view":{"api":{"body":{"from":["application_http"],"groupby":["time()"],"select":[{"alias":"typeHWstw9Kl","expr":"time()"},{"alias":"valuensYW3soM","expr":"round_float(sum(elapsed_count::field), 2)"}],"where":["http_path::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:bar","config":{"dataSourceConfig":{"activedMetricGroups":["application_http","application_http_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typeHWstw9Kl","timeField":{},"timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"count","alias":"请求次数","field":"application_http-elapsed_count::field","i18n":{"alias":{"en":"Request Count","zh":"请求次数"}},"key":"valuensYW3soM","resultType":"number","type":"field"}]},"optionProps":{"isConnectNulls":false,"isLabel":false,"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD"}},"controls":null,"dataSourceType":"api","description":"","i18n":{"alias":{"en":"Service Request","zh":"服务请求"}},"staticData":{},"title":"服务请求"},"w":12,"x":0,"y":10},{"h":11,"i":"view-WPTjI5ir","view":{"api":{"body":{"from":["application_http"],"groupby":["time()"],"select":[{"alias":"type2jCjYVIp","expr":"time()"},{"alias":"valueZjrFmhZg","expr":"round_float(avg(elapsed_mean::field), 2)"}],"where":["http_path::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:line","config":{"dataSourceConfig":{"activedMetricGroups":["application_http","application_http_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"type2jCjYVIp","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"avg","alias":"平均响应时间","field":"application_http-elapsed_mean::field","i18n":{"alias":{"en":"Avg Response Time","zh":"平均响应时间"}},"key":"valueZjrFmhZg","resultType":"number","type":"field","unit":{"type":"TIME","unit":"ns"}}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD","noAreaColor":true}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Request Time Delay","zh":"请求时延"}},"staticData":{},"title":"请求时延"},"w":12,"x":12,"y":10},{"h":9,"i":"view-FlQBcOqT","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","q":"SELECT http_path::tag as URL,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(max(elapsed_max::field),\'\',2) as 最大耗时,format_duration(min(elapsed_min::field),\'\',2) as 最小耗时 FROM application_http WHERE http_path::tag=~/.*{{subSearch}}.*/ AND target_service_name::tag=~/.*{{serviceName}}.*/ GROUP BY http_path::tag ORDER BY avg(elapsed_mean::field) DESC LIMIT 50 ","ql":"influxql","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_http_slow","fromSource":["application_http","application_http_slow"],"groupBy":"http_path::tag","limit":50,"orderBy":"","select":"http_path::tag as URL,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时","where":["http_path::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"URL"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Slow Translation Tracing Top50","zh":"慢事务追踪 Top50"}},"staticData":{},"title":"慢事务追踪 Top50"},"w":14,"x":0,"y":21},{"h":9,"i":"view-sCRTdIQb","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","q":"SELECT http_path::tag as URL,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间 FROM application_http_error WHERE http_path::tag=~/.*{{subSearch}}.*/ AND target_service_name::tag=~/.*{{serviceName}}.*/ GROUP BY http_path::tag ORDER BY max(timestamp) DESC LIMIT 50 ","ql":"influxql","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_http_error","fromSource":["application_http","application_http_error"],"groupBy":"http_path::tag","limit":50,"select":"http_path::tag as URL,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间","where":["http_path::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"URL"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Error Translation Tracing Top50","zh":"错误事务追踪 Top50"}},"staticData":{},"title":"错误事务追踪 Top50"},"w":10,"x":14,"y":21}]'); +REPLACE INTO `sp_dashboard_block_system` (`id`,`name`,`desc`,`scope`,`scope_id`,`version`,`view_config`) VALUES ("translation_analysis_mq","translation_analysis_mq","","micro_service","global","v2",'[{"h":10,"i":"view-lVTYdASX","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filterServiceName":"{{serviceName}}","layer":"mq","search":"{{topic}}","serviceId":"{{serviceId}}","sort":"{{sort}}","start":"{{startTime}}","terminusKey":"{{terminusKey}}","type":"{{type}}"},"url":"/api/apm/topology/translation/db"},"chartType":"table","config":{"dataSourceConfig":{"valueDimensions":[{"alias":"Topic","i18n":{"alias":{"en":"Topic","zh":"Topic"}},"key":"topic","resultType":"string","type":"field"},{"alias":"调用类型","i18n":{"alias":{"en":"Call Type","zh":"调用类型"}},"key":"type","resultType":"string","type":"field"},{"alias":"MQ 类型","i18n":{"alias":{"en":"MQ Type","zh":"MQ 类型"}},"key":"component","resultType":"string","type":"field"},{"alias":"服务地址","i18n":{"alias":{"en":"Service Address","zh":"服务地址"}},"key":"host","resultType":"string","type":"field"},{"alias":"调用次数","i18n":{"alias":{"en":"Request Count","zh":"调用次数"}},"key":"call_count","resultType":"number","type":"field"},{"alias":"慢调用次数","i18n":{"alias":{"en":"Slow Request Count","zh":"慢调用次数"}},"key":"slow_elapsed_count","resultType":"number","type":"field"},{"alias":"平均延迟","i18n":{"alias":{"en":"Avg Time Delay","zh":"平均延迟"}},"key":"avg_elapsed","resultType":"string","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"searchTranslation","value":"operation"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"MQ Translation","zh":"MQ 事务"}},"staticData":{},"title":"MQ 事务"},"w":24,"x":0,"y":0},{"h":11,"i":"view-1XA1pzWR","view":{"api":{"body":{"from":["application_mq"],"groupby":["time()"],"select":[{"alias":"typegq99wZs2","expr":"time()"},{"alias":"valueSR6vrde7","expr":"round_float(sum(elapsed_count::field), 2)"}],"where":["message_bus_destination::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","or_eq_source_service_id":"{{serviceId}}","or_eq_target_service_id":"{{serviceId}}","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:bar","config":{"dataSourceConfig":{"activedMetricGroups":["application_mq"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typegq99wZs2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"count","alias":"请求次数","field":"application_mq-elapsed_count::field","i18n":{"alias":{"en":"Request Count","zh":"请求次数"}},"key":"valueSR6vrde7","resultType":"number","type":"field"}]},"optionProps":{"isMoreThanOneDay":false,"moreThanOneDayFormat":"YYYY/MM/DD"}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Service Request","zh":"服务请求"}},"staticData":{},"title":"服务请求"},"w":12,"x":0,"y":10},{"h":11,"i":"view-J4SwjHDP","view":{"api":{"body":{"from":["application_mq"],"groupby":["time()"],"select":[{"alias":"typeQuPvs7M2","expr":"time()"},{"alias":"valueCxbcWuWT","expr":"round_float(avg(elapsed_mean::field), 2)"}],"where":["message_bus_destination::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","or_eq_source_service_id":"{{serviceId}}","or_eq_target_service_id":"{{serviceId}}","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:line","config":{"dataSourceConfig":{"activedMetricGroups":["application_mq"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typeQuPvs7M2","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"avg","alias":"平均响应时间","field":"application_mq-elapsed_mean::field","i18n":{"alias":{"en":"Avg Response Time","zh":"平均响应时间"}},"key":"valueCxbcWuWT","resultType":"number","type":"field","unit":{"type":"TIME","unit":"ns"}}]},"optionProps":{"isMoreThanOneDay":false,"moreThanOneDayFormat":"YYYY/MM/DD","noAreaColor":true}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Request Time Delay","zh":"请求时延"}},"staticData":{},"title":"请求时延"},"w":12,"x":12,"y":10},{"h":9,"i":"view-FlQBcOqT","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","format":"chartv2","or_eq_source_service_id":"{{serviceId}}","or_eq_target_service_id":"{{serviceId}}","q":"SELECT message_bus_destination::tag as Topic,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(max(elapsed_max::field),\'\',2) as 最大耗时,format_duration(min(elapsed_min::field),\'\',2) as 最小耗时 FROM application_mq_slow WHERE message_bus_destination::tag=~/.*{{subSearch}}.*/ GROUP BY message_bus_destination::tag ORDER BY avg(elapsed_mean::field) DESC LIMIT 50 ","ql":"influxql","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_mq_slow","fromSource":["application_mq_slow"],"groupBy":"message_bus_destination::tag","limit":50,"orderBy":"","select":"message_bus_destination::tag as Topic,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时","where":["message_bus_destination::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Topic"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Slow Translation Tracing Top50","zh":"慢事务追踪 Top50"}},"staticData":{},"title":"慢事务追踪 Top50"},"w":14,"x":0,"y":21},{"h":9,"i":"view-sCRTdIQb","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","format":"chartv2","or_eq_source_service_id":"{{serviceId}}","or_eq_target_service_id":"{{serviceId}}","q":"SELECT message_bus_destination::tag as Topic,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间 FROM application_mq_error WHERE message_bus_destination::tag=~/.*{{subSearch}}.*/ GROUP BY message_bus_destination::tag ORDER BY max(timestamp) DESC LIMIT 50 ","ql":"influxql","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_mq_error","fromSource":["application_mq_error"],"groupBy":"message_bus_destination::tag","limit":50,"select":"message_bus_destination::tag as Topic,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间","where":["message_bus_destination::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Topic"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Error Translation Tracing Top50","zh":"错误事务追踪 Top50"}},"staticData":{},"title":"错误事务追踪 Top50"},"w":10,"x":14,"y":21}]'); +REPLACE INTO `sp_dashboard_block_system` (`id`,`name`,`desc`,`scope`,`scope_id`,`version`,`view_config`) VALUES ("translation_analysis_rpc","translation_analysis_rpc","","micro_service","global","v2",'[{"h":11,"i":"view-UQW30sdQ","view":{"api":{"body":{"from":["application_rpc"],"groupby":["time()"],"select":[{"alias":"typeHWstw9Kl","expr":"time()"},{"alias":"valueV71fTatk","expr":"round_float(sum(elapsed_count::field), 2)"}],"where":["dubbo_method::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:bar","config":{"dataSourceConfig":{"activedMetricGroups":["application_rpc","application_rpc_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"typeHWstw9Kl","timeField":{},"timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"count","alias":"请求次数","field":"application_rpc-elapsed_count::field","i18n":{"alias":{"en":"Request Count","zh":"请求次数"}},"key":"valueV71fTatk","resultType":"number","type":"field"}]},"optionProps":{"isConnectNulls":false,"isLabel":false,"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD"}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Service Request","zh":"服务请求"}},"staticData":{},"title":"服务请求"},"w":12,"x":0,"y":10},{"h":11,"i":"view-WPTjI5ir","view":{"api":{"body":{"from":["application_rpc"],"groupby":["time()"],"select":[{"alias":"type2jCjYVIp","expr":"time()"},{"alias":"valueaecENLIN","expr":"round_float(avg(elapsed_mean::field), 2)"}],"where":["dubbo_method::tag=~/.*{{subSearch}}.*/"]},"extraData":null,"header":null,"method":"post","query":{"end":"{{endTime}}","epoch":"ms","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","ql":"influxql:ast","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"chart:line","config":{"dataSourceConfig":{"activedMetricGroups":["application_rpc","application_rpc_request"],"typeDimensions":[{"alias":"时间","i18n":{"alias":{"en":"Time","zh":"时间"}},"key":"type2jCjYVIp","timeFormat":"YYYY/MM/DD","timeInterval":{"unit":"m","value":1},"type":"time"}],"valueDimensions":[{"aggregation":"avg","alias":"请求耗时平均值","field":"application_rpc-elapsed_mean::field","i18n":{"alias":{"en":"Avg Request Elapse","zh":"请求耗时平均值"}},"key":"valueaecENLIN","resultType":"number","type":"field","unit":{"type":"TIME","unit":"ns"}}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"YYYY/MM/DD","noAreaColor":true}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Request Time Delay","zh":"请求时延"}},"staticData":{},"title":"请求时延"},"w":12,"x":12,"y":10},{"h":10,"i":"view-lVTYdASX","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filterServiceName":"{{serviceName}}","layer":"rpc","search":"{{search}}","serviceId":"{{serviceId}}","sort":"{{sort}}","start":"{{startTime}}","terminusKey":"{{terminusKey}}"},"url":"/api/apm/topology/translation"},"chartType":"table","config":{"dataSourceConfig":{"valueDimensions":[{"alias":"事务名称","i18n":{"alias":{"en":"Translation Name","zh":"事务名称"}},"key":"translation_name","resultType":"string","type":"field"},{"alias":"调用次数","i18n":{"alias":{"en":"Called Count","zh":"调用次数"}},"key":"elapsed_count","resultType":"number","type":"field"},{"alias":"错误次数","i18n":{"alias":{"en":"Error Count","zh":"错误次数"}},"key":"error_count","resultType":"number","type":"field"},{"alias":"慢调用次数","i18n":{"alias":{"en":"Slow Called Count","zh":"慢调用次数"}},"key":"slow_elapsed_count","resultType":"number","type":"field"},{"alias":"平均时延","i18n":{"alias":{"en":"Avg Time Delay","zh":"平均时延"}},"key":"avg_elapsed","resultType":"string","type":"field"}]},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"searchTranslation","value":"translation_name"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"RPC Translation","zh":"RPC 事务"}},"staticData":{},"title":"RPC 事务"},"w":24,"x":0,"y":0},{"h":9,"i":"view-FlQBcOqT","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","filter_terminus_key":"{{terminusKey}}","format":"chartv2","q":"SELECT dubbo_service::tag as Service,dubbo_method::tag as Method,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时 FROM application_rpc_slow WHERE dubbo_method::tag=~/.*{{subSearch}}.*/ AND target_service_name::tag=~/.*{{serviceName}}.*/ GROUP BY dubbo_method::tag ORDER BY avg(elapsed_mean::field) DESC LIMIT 50 ","ql":"influxql","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_rpc_slow","fromSource":["application_rpc","application_rpc_slow"],"groupBy":"dubbo_method::tag","limit":50,"orderBy":"","select":"dubbo_method::tag as Method,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间,format_duration(elapsed_max::field,\'\',2) as 最大耗时,format_duration(elapsed_min::field,\'\',2) as 最小耗时","where":["dubbo_method::tag=~/.*{{subSearch}}.*/"]}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Method"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Slow Translation Tracing Top50","zh":"慢事务追踪 Top50"}},"staticData":{},"title":"慢事务追踪 Top50"},"w":14,"x":0,"y":21},{"h":9,"i":"view-sCRTdIQb","view":{"api":{"body":null,"extraData":null,"header":null,"method":"get","query":{"end":"{{endTime}}","filter__metric_scope":"micro_service","filter__metric_scope_id":"{{terminusKey}}","filter_target_service_id":"{{serviceId}}","format":"chartv2","q":"SELECT dubbo_service::tag as Service,dubbo_method::tag as Method,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间 FROM application_rpc_error WHERE dubbo_method::tag=~/.*{{subSearch}}.*/ AND target_service_name::tag=~/.*{{serviceName}}.*/ GROUP BY dubbo_method::tag ORDER BY max(timestamp) DESC LIMIT 50 ","ql":"influxql","serviceName":"{{serviceName}}","start":"{{startTime}}","type":"_"},"url":"/api/tmc/metrics-query"},"chartType":"table","config":{"dataSourceConfig":{"isSqlMode":true,"sql":{"from":"application_rpc_error","fromSource":["application_rpc","application_rpc_error"],"groupBy":"dubbo_method::tag","limit":50,"select":"dubbo_method::tag as Method,format_time(timestamp,\'2006-01-02 15:04:05\') as 时间","where":"dubbo_method::tag=~/.*{{subSearch}}.*/"}},"optionProps":{"isMoreThanOneDay":true,"moreThanOneDayFormat":"M/D","rowClick":{"name":"traceSlowTranslation","value":"Method"}}},"controls":null,"dataSourceType":"api","description":"","i18n":{"title":{"en":"Error Translation Tracing Top50","zh":"错误事务追踪 Top50"}},"staticData":{},"title":"错误事务追踪Top50"},"w":10,"x":14,"y":21}]'); diff --git a/modules/monitor/apm/topology/routes.go b/modules/monitor/apm/topology/routes.go index 1c79cae5927..e1d65bd3af2 100644 --- a/modules/monitor/apm/topology/routes.go +++ b/modules/monitor/apm/topology/routes.go @@ -38,7 +38,8 @@ func (topology *provider) initRoutes(routes httpserver.Router) error { routes.GET("/api/apm/topology/exception/message", topology.exceptionMessage) routes.GET("/api/apm/topology/exception/types", topology.exceptionTypes) routes.GET("/api/apm/topology/translation", topology.translation) - routes.GET("/api/apm/topology/translation/db", topology.dbTransaction) + routes.GET("/api/apm/topology/translation/db", topology.middlewareTransaction) + routes.GET("/api/apm/topology/translation/mq", topology.middlewareTransaction) routes.GET("/api/apm/topology/translation/slow", topology.slowTranslationTrace) return nil } @@ -82,6 +83,7 @@ type translation struct { TerminusKey string `query:"terminusKey" validate:"required"` Sort int64 `query:"sort"` ServiceId string `query:"serviceId" validate:"required"` + Type string `query:"type"` } func (topology *provider) exceptionTypes(r *http.Request, params ServiceParams) interface{} { diff --git a/modules/monitor/apm/topology/topology.go b/modules/monitor/apm/topology/topology.go index 705ebe65071..efa407cda34 100644 --- a/modules/monitor/apm/topology/topology.go +++ b/modules/monitor/apm/topology/topology.go @@ -1867,12 +1867,19 @@ func (topology *provider) translation(r *http.Request, params translation) inter default: return api.Errors.InvalidParameter(errors.New("not support layer name")) } + // elapsed_mean desc if params.Sort == 0 { - orderby = " ORDER BY count(error::tag) DESC" + orderby = " ORDER BY avg(elapsed_mean::field) DESC" } + // error elapsed_count desc if params.Sort == 1 { orderby = " ORDER BY sum(elapsed_count::field) DESC" } + // error count desc + if params.Sort == 2 { + orderby = " ORDER BY count(error::tag) DESC" + } + sql := fmt.Sprintf("SELECT %s,sum(elapsed_count::field),count(error::tag),format_duration(avg(elapsed_mean::field),'',2) "+ "FROM application_%s WHERE target_service_id::tag=$serviceId AND target_service_name::tag=$filterServiceName "+ "AND target_terminus_key::tag=$terminusKey %s GROUP BY %s", field, params.Layer, where.String(), field+orderby) @@ -1926,10 +1933,30 @@ func (topology *provider) translation(r *http.Request, params translation) inter } // db/cache -func (topology *provider) dbTransaction(r *http.Request, params translation) interface{} { - if params.Layer != "db" && params.Layer != "cache" { +func (topology *provider) middlewareTransaction(r *http.Request, params translation) interface{} { + if params.Layer != "db" && params.Layer != "cache" && params.Layer != "mq" { return api.Errors.Internal(errors.New("not supported layer name")) } + result, err := topology.middlewareStrategy(params) + if err != nil { + return api.Errors.Internal(err) + } + return api.Success(result) +} + +func (topology *provider) middlewareStrategy(params translation) (map[string]interface{}, error) { + switch params.Layer { + case "db": + return topology.dbOrCacheTranslation(params) + case "cache": + return topology.dbOrCacheTranslation(params) + case "mq": + return topology.mqTranslation(params) + } + return nil, errors.New("no support middleware type") +} + +func (topology *provider) dbOrCacheTranslation(params translation) (map[string]interface{}, error) { options := url.Values{} options.Set("start", strconv.FormatInt(params.Start, 10)) options.Set("end", strconv.FormatInt(params.End, 10)) @@ -1937,18 +1964,24 @@ func (topology *provider) dbTransaction(r *http.Request, params translation) int var orderby string param := make(map[string]interface{}) param["terminusKey"] = params.TerminusKey - param["filterServiceName"] = params.FilterServiceName param["serviceId"] = params.ServiceId if params.Search != "" { where.WriteString(" AND db_statement::tag=~$field") param["field"] = map[string]interface{}{"regex": ".*" + params.Search + ".*"} } + + // elapsed_mean desc + if params.Sort == 0 { + orderby = " ORDER BY avg(elapsed_mean::field) DESC" + } + // error elapsed_count desc if params.Sort == 1 { orderby = " ORDER BY sum(elapsed_count::field) DESC" } + sql := fmt.Sprintf("SELECT db_statement::tag,db_type::tag,db_instance::tag,host::tag,sum(elapsed_count::field),"+ "format_duration(avg(elapsed_mean::field),'',2) FROM application_%s WHERE source_service_id::tag=$serviceId AND "+ - "source_service_name::tag=$filterServiceName AND source_terminus_key::tag=$terminusKey %s GROUP BY db_statement::tag %s", + "source_terminus_key::tag=$terminusKey %s GROUP BY db_statement::tag %s", params.Layer, where.String(), orderby) source, err := topology.metricq.Query( metricq.InfluxQL, @@ -1956,7 +1989,7 @@ func (topology *provider) dbTransaction(r *http.Request, params translation) int param, options) if err != nil { - return api.Errors.Internal(err) + return nil, err } result := make(map[string]interface{}, 0) @@ -1980,19 +2013,18 @@ func (topology *provider) dbTransaction(r *http.Request, params translation) int itemResult["call_count"] = r[4] itemResult["avg_elapsed"] = r[5] sql := fmt.Sprintf("SELECT sum(elapsed_count::field) FROM application_%s_slow WHERE source_service_id::tag=$serviceId "+ - "AND source_service_name::tag=$filterServiceName AND db_statement::tag=$field AND target_terminus_key::tag=$terminusKey", params.Layer) + "AND db_statement::tag=$field AND source_terminus_key::tag=$terminusKey", params.Layer) slowElapsedCount, err := topology.metricq.Query( metricq.InfluxQL, sql, map[string]interface{}{ - "field": conv.ToString(r[0]), - "terminusKey": params.TerminusKey, - "filterServiceName": params.FilterServiceName, - "serviceId": params.ServiceId, + "field": conv.ToString(r[0]), + "terminusKey": params.TerminusKey, + "serviceId": params.ServiceId, }, options) if err != nil { - return api.Errors.Internal(err) + return nil, err } for _, item := range slowElapsedCount.ResultSet.Rows { itemResult["slow_elapsed_count"] = item[0] @@ -2000,7 +2032,117 @@ func (topology *provider) dbTransaction(r *http.Request, params translation) int data = append(data, itemResult) } result["data"] = data - return api.Success(result) + return result, nil +} + +func (topology *provider) mqTranslation(params translation) (map[string]interface{}, error) { + options := url.Values{} + options.Set("start", strconv.FormatInt(params.Start, 10)) + options.Set("end", strconv.FormatInt(params.End, 10)) + var where bytes.Buffer + var orderby string + param := make(map[string]interface{}) + param["terminusKey"] = params.TerminusKey + param["serviceId"] = params.ServiceId + if params.Search != "" { + where.WriteString(" AND message_bus_destination::tag=~$field") + param["field"] = map[string]interface{}{"regex": ".*" + params.Search + ".*"} + } + + // elapsed_mean desc + if params.Sort == 0 { + orderby = " ORDER BY avg(elapsed_mean::field) DESC" + } + // error elapsed_count desc + if params.Sort == 1 { + orderby = " ORDER BY sum(elapsed_count::field) DESC" + } + + // producer + sqlProducer := fmt.Sprintf("SELECT message_bus_destination::tag,span_kind::tag,component::tag,host::tag,sum(elapsed_count::field),"+ + "format_duration(avg(elapsed_mean::field),'',2) FROM application_%s WHERE source_service_id::tag=$serviceId AND "+ + "span_kind::tag='producer' AND source_terminus_key::tag=$terminusKey %s GROUP BY message_bus_destination::tag %s", params.Layer, where.String(), orderby) + // consumer + sqlConsumer := fmt.Sprintf("SELECT message_bus_destination::tag,span_kind::tag,component::tag,host::tag,sum(elapsed_count::field),"+ + "format_duration(avg(elapsed_mean::field),'',2) FROM application_%s WHERE target_service_id::tag=$serviceId AND "+ + "span_kind::tag='consumer' AND target_terminus_key::tag=$terminusKey %s GROUP BY message_bus_destination::tag %s", params.Layer, where.String(), orderby) + + p := &query.ResultSet{} + c := &query.ResultSet{} + if params.Type == "producer" { + producer, err := topology.metricq.Query(metricq.InfluxQL, sqlProducer, param, options) + if err != nil { + return nil, err + } + p = producer + } else if params.Type == "consumer" { + consumer, err := topology.metricq.Query(metricq.InfluxQL, sqlConsumer, param, options) + if err != nil { + return nil, err + } + c = consumer + } else { + producer, err := topology.metricq.Query(metricq.InfluxQL, sqlProducer, param, options) + if err != nil { + return nil, err + } + consumer, err := topology.metricq.Query(metricq.InfluxQL, sqlConsumer, param, options) + if err != nil { + return nil, err + } + p = producer + c = consumer + } + + result := make(map[string]interface{}, 0) + data, err := topology.handleMQTranslationResponse(params, p, options) + dataConsumer, err := topology.handleMQTranslationResponse(params, c, options) + data = append(data, dataConsumer...) + if err != nil { + return nil, err + } + result["data"] = data + return result, nil +} + +func (topology *provider) handleMQTranslationResponse(params translation, result *query.ResultSet, options url.Values) ([]map[string]interface{}, error) { + data := make([]map[string]interface{}, 0) + if result.ResultSet == nil { + return []map[string]interface{}{}, nil + } + for _, r := range result.ResultSet.Rows { + itemResult := make(map[string]interface{}) + itemResult["topic"] = r[0] + itemResult["type"] = r[1] + itemResult["component"] = r[2] + itemResult["host"] = r[3] + itemResult["call_count"] = r[4] + itemResult["avg_elapsed"] = r[5] + sqlProducer := fmt.Sprintf("SELECT sum(elapsed_count::field) FROM application_%s_slow WHERE source_service_id::tag=$serviceId "+ + "AND message_bus_destination::tag=$field AND span_kind::tag='producer' AND source_terminus_key::tag=$terminusKey", params.Layer) + sqlConsumer := fmt.Sprintf("SELECT sum(elapsed_count::field) FROM application_%s_slow WHERE target_service_id::tag=$serviceId "+ + "AND message_bus_destination::tag=$field AND span_kind::tag='consumer' AND target_terminus_key::tag=$terminusKey", params.Layer) + + paramsM := map[string]interface{}{ + "field": conv.ToString(r[0]), + "terminusKey": params.TerminusKey, + "serviceId": params.ServiceId, + } + slowCount := 0 + slowElapsedCountProducer, err := topology.metricq.Query(metricq.InfluxQL, sqlProducer, paramsM, options) + slowElapsedCountConsumer, err := topology.metricq.Query(metricq.InfluxQL, sqlConsumer, paramsM, options) + if err != nil { + return nil, err + } + cCount := slowElapsedCountProducer.ResultSet.Rows[0][0].(float64) + pCount := slowElapsedCountConsumer.ResultSet.Rows[0][0].(float64) + slowCount = int(cCount + pCount) + + itemResult["slow_elapsed_count"] = slowCount + + data = append(data, itemResult) + } + return data, nil } func (topology *provider) slowTranslationTrace(r *http.Request, params struct { @@ -2010,15 +2152,33 @@ func (topology *provider) slowTranslationTrace(r *http.Request, params struct { TerminusKey string `query:"terminusKey" validate:"required"` Operation string `query:"operation" validate:"required"` ServiceId string `query:"serviceId" validate:"required"` - Sort string `default:"DESC" query:"sort"` + Limit int64 `query:"limit" default:"100"` + Sort string `default:"duration:DESC" query:"sort"` }) interface{} { - if params.Sort != "ASC" && params.Sort != "DESC" { - return api.Errors.Internal(errors.New("not supported sort name")) + sortCondition := "" + if params.Sort == "timestamp:DESC" { + sortCondition = "timestamp DESC" + } else if params.Sort == "timestamp:ASC" { + sortCondition = "timestamp ASC" + } else if params.Sort == "duration:DESC" { + sortCondition = "trace_duration DESC" + } else if params.Sort == "duration:ASC" { + sortCondition = "trace_duration ASC" + } else { + sortCondition = "trace_duration DESC" + } + if params.Limit < 100 { + params.Limit = 100 + } + if params.Limit > 1000 { + params.Limit = 1000 } options := url.Values{} options.Set("start", strconv.FormatInt(params.Start, 10)) options.Set("end", strconv.FormatInt(params.End, 10)) - sql := fmt.Sprintf("SELECT trace_id::tag,format_time(timestamp,'2006-01-02 15:04:05'),round_float(if(lt(end_time::field-start_time::field,0),0,end_time::field-start_time::field)/1000000,2) FROM trace WHERE service_ids::field=$serviceId AND service_names::field=$serviceName AND terminus_keys::field=$terminusKey AND (http_paths::field=$operation OR dubbo_methods::field=$operation) ORDER BY timestamp %s", params.Sort) + sql := fmt.Sprintf("SELECT trace_id::tag,format_time(timestamp,'2006-01-02 15:04:05'),round_float(if(lt(end_time::field-start_time::field,0),0,end_time::field-start_time::field)/1000000,2) "+ + "FROM trace WHERE service_ids::field=$serviceId AND service_names::field=$serviceName AND terminus_keys::field=$terminusKey "+ + "AND (http_paths::field=$operation OR dubbo_methods::field=$operation OR db_statements::field=$operation OR topics::field=$operation) ORDER BY %s Limit %v", sortCondition, params.Limit) details, err := topology.metricq.Query(metricq.InfluxQL, sql, map[string]interface{}{ diff --git a/modules/msp/apm/trace/trace.service.go b/modules/msp/apm/trace/trace.service.go index 0a117e6dcaf..43e1949c8d7 100644 --- a/modules/msp/apm/trace/trace.service.go +++ b/modules/msp/apm/trace/trace.service.go @@ -125,6 +125,9 @@ func (s *traceService) handleSpanResponse(spanTree SpanTree) (*pb.GetSpansRespon services := map[string]void{} for _, span := range spanTree { services[span.Tags["service_name"]] = void{} + if span.ParentSpanId == span.Id { + span.ParentSpanId = "" + } tempDepth := calculateDepth(depth, span, spanTree) if tempDepth > depth { depth = tempDepth @@ -145,6 +148,9 @@ func (s *traceService) handleSpanResponse(spanTree SpanTree) (*pb.GetSpansRespon } func calculateDepth(depth int64, span *pb.Span, spanTree SpanTree) int64 { + if span.ParentSpanId == span.Id { + return 0 + } if span.ParentSpanId != "" && spanTree[span.ParentSpanId] != nil { depth += 1 calculateDepth(depth, spanTree[span.ParentSpanId], spanTree)