diff --git a/CHANGES.md b/CHANGES.md index 38d86fabe357960b92e2ae2bc25243fa13263f8e..96a7a2c3741350d38c16a87ba536683111542eb4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,6 +52,7 @@ Significantly cost less CPU in low payload.** - Support set separated gRPC/Jetty ip:port for receiver, default still use core settings. - Fix JVM receiver bug. - Fix wrong dest service in mesh analysis. +- Fix search doesn't work as expected. - Refactor `ScopeDeclaration` annotation. - Refactor register lock mechanism. - Add SmartSql component for .NET diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java index 0fc3fc650b65ad89d8fb98fb721dc012e6f08f18..acbec882476a46eddfdf0f3b498497569e7819bc 100644 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java @@ -54,6 +54,11 @@ public class AlarmQuery implements GraphQLQueryResolver { long startTimeBucket = DurationUtils.INSTANCE.startTimeDurationToSecondTimeBucket(duration.getStep(), duration.getStart()); long endTimeBucket = DurationUtils.INSTANCE.endTimeDurationToSecondTimeBucket(duration.getStep(), duration.getEnd()); - return getQueryService().getAlarm(scope.getScopeId(), keyword, paging, startTimeBucket, endTimeBucket); + Integer scopeId = null; + if (scope != null) { + scopeId = scope.getScopeId(); + } + + return getQueryService().getAlarm(scopeId, keyword, paging, startTimeBucket, endTimeBucket); } } diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol index a005dd1024c2b7e68fbcab5795824634cb81cde8..02ddbfa8d84865e1a85a25f49933307970d0ab71 160000 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol @@ -1 +1 @@ -Subproject commit a005dd1024c2b7e68fbcab5795824634cb81cde8 +Subproject commit 02ddbfa8d84865e1a85a25f49933307970d0ab71 diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java index 156bf436244c1d3731ae3f7b70c2eaeb077488dc..47a7ad45e24f3e407777ce963e1c4e7b73179f9a 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java @@ -120,7 +120,7 @@ public class StorageEsInstaller extends ModelInstaller { JsonObject matchColumn = new JsonObject(); matchColumn.addProperty("type", "text"); matchColumn.addProperty("analyzer", "oap_analyzer"); - properties.add(columnDefine.getColumnName().getName(), matchColumn); + properties.add(matchCName, matchColumn); } else { JsonObject column = new JsonObject(); column.addProperty("type", columnTypeEsMapping.transform(columnDefine.getType())); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AlarmQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AlarmQueryEsDAO.java index 5db788d28133b4b6a8fbc49e26d59fbc77ef69fd..3c0a3041710a6ec8e4ca32449e04a34e7dd1ef39 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AlarmQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AlarmQueryEsDAO.java @@ -54,7 +54,7 @@ public class AlarmQueryEsDAO extends EsDAO implements IAlarmQueryDAO { if (!Strings.isNullOrEmpty(keyword)) { String matchCName = MatchCNameBuilder.INSTANCE.build(AlarmRecord.ALARM_MESSAGE); - boolQueryBuilder.must().add(QueryBuilders.matchQuery(matchCName, keyword)); + boolQueryBuilder.must().add(QueryBuilders.matchPhraseQuery(matchCName, keyword)); } sourceBuilder.query(boolQueryBuilder); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java index 8a31bf7f2c3b90197cb19991dd9a66b649ae39b9..600eb4e58ab86ac481015eef78238b1773bce0bb 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java @@ -20,25 +20,15 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch.query; import com.google.common.base.Strings; import java.io.IOException; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collections; -import java.util.List; +import java.util.*; import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord; -import org.apache.skywalking.oap.server.core.query.entity.BasicTrace; -import org.apache.skywalking.oap.server.core.query.entity.QueryOrder; -import org.apache.skywalking.oap.server.core.query.entity.Span; -import org.apache.skywalking.oap.server.core.query.entity.TraceBrief; -import org.apache.skywalking.oap.server.core.query.entity.TraceState; +import org.apache.skywalking.oap.server.core.query.entity.*; import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO; import org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.oap.server.library.util.BooleanUtils; -import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.EsDAO; +import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.*; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.RangeQueryBuilder; +import org.elasticsearch.index.query.*; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.sort.SortOrder; @@ -80,7 +70,8 @@ public class TraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { boolQueryBuilder.must().add(rangeQueryBuilder); } if (!Strings.isNullOrEmpty(endpointName)) { - mustQueryList.add(QueryBuilders.matchPhraseQuery(SegmentRecord.ENDPOINT_NAME, endpointName)); + String matchCName = MatchCNameBuilder.INSTANCE.build(SegmentRecord.ENDPOINT_NAME); + mustQueryList.add(QueryBuilders.matchPhraseQuery(matchCName, endpointName)); } if (serviceId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.SERVICE_ID, serviceId)); diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AlarmQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AlarmQueryDAO.java index dc8a4011d75db9dce39b201a237bba77898458a7..5bcf69cecaf45125ae96ef0c64fe72f3554fdb9a 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AlarmQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AlarmQueryDAO.java @@ -46,7 +46,9 @@ public class H2AlarmQueryDAO implements IAlarmQueryDAO { sql.append("from ").append(AlarmRecord.INDEX_NAME).append(" where "); sql.append(" 1=1 "); sql.append(" and ").append(AlarmRecord.SCOPE).append(" = ?"); - parameters.add(scopeId.intValue()); + if (Objects.nonNull(scopeId)) { + parameters.add(scopeId.intValue()); + } if (startTB != 0 && endTB != 0) { sql.append(" and ").append(AlarmRecord.TIME_BUCKET).append(" >= ?"); parameters.add(startTB); diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLAlarmQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLAlarmQueryDAO.java index 3c67196435093f5ae7383c32d94bc893cc927e6c..7647b72a1674b581f7775daf2b67894ca973af30 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLAlarmQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLAlarmQueryDAO.java @@ -46,7 +46,9 @@ public class MySQLAlarmQueryDAO implements IAlarmQueryDAO { sql.append("from ").append(AlarmRecord.INDEX_NAME).append(" where "); sql.append(" 1=1 "); sql.append(" and ").append(AlarmRecord.SCOPE).append(" = ?"); - parameters.add(scopeId.intValue()); + if (Objects.nonNull(scopeId)) { + parameters.add(scopeId.intValue()); + } if (startTB != 0 && endTB != 0) { sql.append(" and ").append(AlarmRecord.TIME_BUCKET).append(" >= ?"); parameters.add(startTB); diff --git a/skywalking-ui b/skywalking-ui index b6b3f9b0022c7e8c997abad5f7b8363cf5345181..e58119dbb6a1dabfb5d921df5efd636b51399d9e 160000 --- a/skywalking-ui +++ b/skywalking-ui @@ -1 +1 @@ -Subproject commit b6b3f9b0022c7e8c997abad5f7b8363cf5345181 +Subproject commit e58119dbb6a1dabfb5d921df5efd636b51399d9e