未验证 提交 a9d34e3b 编写于 作者: 静夜思朝颜's avatar 静夜思朝颜 提交者: GitHub

Remove unnecessary parameter in the profile log query (#4549)

* Remove unnecessary parameter in the profile log query

* Replace gone images
Co-authored-by: NMrproliu <mrproliu@lagou.com>
Co-authored-by: Nkezhenxu94 <kezhenxu94@163.com>
上级 2e9f0016
......@@ -162,7 +162,7 @@ public class ProfileTaskQueryService implements Service {
final List<ProfileTask> tasks = getProfileTaskDAO().getTaskList(serviceId, endpointName, null, null, null);
// query all and filter on task to match logs
List<ProfileTaskLog> taskLogList = getProfileTaskLogQueryDAO().getTaskLogList(null);
List<ProfileTaskLog> taskLogList = getProfileTaskLogQueryDAO().getTaskLogList();
if (taskLogList == null) {
taskLogList = Collections.emptyList();
}
......
......@@ -30,9 +30,7 @@ public interface IProfileTaskLogQueryDAO extends DAO {
/**
* search all task log list in appoint profile task id
*
* @param taskId profile task id, maybe null
*/
List<ProfileTaskLog> getTaskLogList(final String taskId) throws IOException;
List<ProfileTaskLog> getTaskLogList() throws IOException;
}
......@@ -45,16 +45,12 @@ public class ProfileTaskLogEsDAO extends EsDAO implements IProfileTaskLogQueryDA
}
@Override
public List<ProfileTaskLog> getTaskLogList(String taskId) throws IOException {
public List<ProfileTaskLog> getTaskLogList() throws IOException {
final SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource();
final BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
sourceBuilder.query(boolQueryBuilder);
if (taskId != null) {
boolQueryBuilder.must().add(QueryBuilders.termQuery(ProfileTaskLogRecord.TASK_ID, taskId));
}
sourceBuilder.sort(ProfileTaskLogRecord.OPERATION_TIME, SortOrder.DESC);
sourceBuilder.size(queryMaxSize);
......
......@@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.apm.util.StringUtil;
import org.apache.skywalking.oap.server.core.profile.ProfileTaskLogRecord;
import org.apache.skywalking.oap.server.core.query.entity.ProfileTaskLog;
import org.apache.skywalking.oap.server.core.query.entity.ProfileTaskLogOperationType;
......@@ -35,7 +34,6 @@ import org.influxdb.dto.QueryResult;
import org.influxdb.querybuilder.SelectQueryImpl;
import org.influxdb.querybuilder.WhereQueryImpl;
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
@Slf4j
......@@ -49,7 +47,7 @@ public class ProfileTaskLogQuery implements IProfileTaskLogQueryDAO {
}
@Override
public List<ProfileTaskLog> getTaskLogList(String taskId) throws IOException {
public List<ProfileTaskLog> getTaskLogList() throws IOException {
WhereQueryImpl<SelectQueryImpl> query = select()
.function("top", ProfileTaskLogRecord.OPERATION_TIME, fetchTaskLogMaxSize)
.column("id")
......@@ -60,10 +58,6 @@ public class ProfileTaskLogQuery implements IProfileTaskLogQueryDAO {
.from(client.getDatabase(), ProfileTaskLogRecord.INDEX_NAME)
.where();
if (StringUtil.isNotEmpty(taskId)) {
query.and(eq(ProfileTaskLogRecord.TASK_ID, taskId));
}
QueryResult.Series series = client.queryForSingleSeries(query);
if (log.isDebugEnabled()) {
log.debug("SQL: {} result set: {}", query.getCommand(), series);
......
......@@ -41,15 +41,11 @@ public class H2ProfileTaskLogQueryDAO implements IProfileTaskLogQueryDAO {
}
@Override
public List<ProfileTaskLog> getTaskLogList(String taskId) throws IOException {
public List<ProfileTaskLog> getTaskLogList() throws IOException {
final StringBuilder sql = new StringBuilder();
final ArrayList<Object> condition = new ArrayList<>(1);
sql.append("select * from ").append(ProfileTaskLogRecord.INDEX_NAME).append(" where 1=1 ");
if (taskId != null) {
sql.append(" and ").append(ProfileTaskLogRecord.TASK_ID).append(" = ?");
}
sql.append("ORDER BY ").append(ProfileTaskLogRecord.OPERATION_TIME).append(" DESC ");
try (Connection connection = h2Client.getConnection()) {
......
......@@ -14,7 +14,7 @@
# limitations under the License.
ARG SW_AGENT_JDK_VERSION=8
ARG AGENT_JDK_BASE=adoptopenjdk/openjdk${SW_AGENT_JDK_VERSION}:alpine-slim
ARG AGENT_JDK_BASE=adoptopenjdk/openjdk${SW_AGENT_JDK_VERSION}:alpine
FROM ${AGENT_JDK_BASE}
......
......@@ -14,7 +14,7 @@
# limitations under the License.
ARG SW_AGENT_JDK_VERSION=8
ARG AGENT_JDK_BASE=adoptopenjdk/openjdk${SW_AGENT_JDK_VERSION}:alpine-slim
ARG AGENT_JDK_BASE=adoptopenjdk/openjdk${SW_AGENT_JDK_VERSION}:alpine
FROM ${AGENT_JDK_BASE}
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM adoptopenjdk/openjdk8:alpine-slim
FROM adoptopenjdk/openjdk8:alpine
WORKDIR /h2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册