未验证 提交 ba6d49ad 编写于 作者: Z zhang-wei 提交者: GitHub

Update the timestamp field type for LogQuery (#6335)

上级 5e8f1eb5
......@@ -17,6 +17,7 @@ Release Notes.
* Metrics combination API supports abandoning results.
* Add a new concept "Event" and its implementations to collect events.
* Add some defensive codes for NPE and bump up Kubernetes client version to expose exception stack trace.
* Update the `timestamp` field type for `LogQuery`.
#### UI
Update selector scroller to show in all pages.
......
......@@ -33,7 +33,7 @@ public class Log {
private String endpointId;
private String endpointName;
private String traceId;
private String timestamp;
private Long timestamp;
private ContentType contentType = ContentType.NONE;
private String content;
private final List<KeyValue> tags;
......
Subproject commit e0d3698dcd776230646acaeb219841adea193acf
Subproject commit 42d6783d8c1a0d0d4c2b28e58dc1f47dd554964e
......@@ -150,7 +150,7 @@ public class LogQueryEsDAO extends EsDAO implements ILogQueryDAO {
log.setEndpointId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID));
log.setEndpointName((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_NAME));
log.setTraceId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.TRACE_ID));
log.setTimestamp(searchHit.getSourceAsMap().get(AbstractLogRecord.TIMESTAMP).toString());
log.setTimestamp(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.TIMESTAMP)).longValue());
log.setContentType(ContentType.instanceOf(
((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT_TYPE)).intValue()));
log.setContent((String) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT));
......
......@@ -150,7 +150,7 @@ public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO {
log.setEndpointId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID));
log.setEndpointName((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_NAME));
log.setTraceId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.TRACE_ID));
log.setTimestamp(searchHit.getSourceAsMap().get(AbstractLogRecord.TIMESTAMP).toString());
log.setTimestamp(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.TIMESTAMP)).longValue());
log.setContentType(ContentType.instanceOf(
((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT_TYPE)).intValue()));
log.setContent((String) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT));
......
......@@ -166,7 +166,7 @@ public class LogQuery implements ILogQueryDAO {
log.setEndpointId((String) data.get(ENDPOINT_ID));
log.setEndpointName((String) data.get(ENDPOINT_NAME));
log.setTraceId((String) data.get(TRACE_ID));
log.setTimestamp(data.get(TIMESTAMP).toString());
log.setTimestamp(((Number) data.get(TIMESTAMP)).longValue());
log.setContentType(
ContentType.instanceOf(((Number) data.get(AbstractLogRecord.CONTENT_TYPE)).intValue()));
log.setContent((String) data.get(AbstractLogRecord.CONTENT));
......
......@@ -186,7 +186,7 @@ public class H2LogQueryDAO implements ILogQueryDAO {
log.setEndpointId(resultSet.getString(ENDPOINT_ID));
log.setEndpointName(resultSet.getString(ENDPOINT_NAME));
log.setTraceId(resultSet.getString(TRACE_ID));
log.setTimestamp(resultSet.getString(TIMESTAMP));
log.setTimestamp(resultSet.getLong(TIMESTAMP));
log.setContentType(ContentType.instanceOf(resultSet.getInt(CONTENT_TYPE)));
log.setContent(resultSet.getString(CONTENT));
String dataBinaryBase64 = resultSet.getString(TAGS_RAW_DATA);
......
......@@ -72,11 +72,11 @@ public class BrowserErrorLogMatcher extends AbstractMatcher<BrowserErrorLog> {
}
if (nonNull(getLine())) {
doVerify(getLine(), String.valueOf(log.getLine()));
doVerify(getLine(), log.getLine());
}
if (nonNull(getCol())) {
doVerify(getCol(), String.valueOf(log.getCol()));
doVerify(getCol(), log.getCol());
}
if (nonNull(getStack())) {
......@@ -88,7 +88,7 @@ public class BrowserErrorLogMatcher extends AbstractMatcher<BrowserErrorLog> {
}
if (nonNull(getFirstReportedError())) {
doVerify(getFirstReportedError(), String.valueOf(log.isFirstReportedError()));
doVerify(getFirstReportedError(), log.isFirstReportedError());
}
}
}
......@@ -34,7 +34,7 @@ public class DashboardConfigurationMatcher extends AbstractMatcher<DashboardConf
doVerify(this.name, configuration.getName());
doVerify(this.type, String.valueOf(configuration.getType()));
doVerify(this.configuration, configuration.getConfiguration());
doVerify(this.activated, String.valueOf(configuration.isActivated()));
doVerify(this.disabled, String.valueOf(configuration.isDisabled()));
doVerify(this.activated, configuration.isActivated());
doVerify(this.disabled, configuration.isDisabled());
}
}
......@@ -33,7 +33,7 @@ public class Log {
private String endpointName;
private String endpointId;
private String traceId;
private String timestamp;
private Long timestamp;
private String contentType;
private String content;
private List<KeyValue> tags;
......
......@@ -93,7 +93,7 @@ public class TraceMatcher extends AbstractMatcher<Trace> {
private void verifyDuration(Trace trace) {
final String expected = this.getDuration();
final String actual = String.valueOf(trace.getDuration());
final int actual = trace.getDuration();
doVerify(expected, actual);
}
......
......@@ -33,6 +33,18 @@ public abstract class AbstractMatcher<T> {
public abstract void verify(T t);
protected void doVerify(String expected, int actual) {
this.doVerify(expected, String.valueOf(actual));
}
protected void doVerify(String expected, long actual) {
this.doVerify(expected, String.valueOf(actual));
}
protected void doVerify(String expected, boolean actual) {
this.doVerify(expected, String.valueOf(actual));
}
protected void doVerify(String expected, String actual) {
Matcher matcher = NN_MATCHER.matcher(expected);
if (matcher.find()) {
......
......@@ -51,7 +51,7 @@ public class TestLogsMatcher {
.setEndpointName("/traffic")
.setEndpointId("ZTJl.1_L3RyYWZmaWM=")
.setTraceId("ac81b308-0d66-4c69-a7af-a023a536bd3e")
.setTimestamp("1609665785987")
.setTimestamp(1609665785987L)
.setContentType("TEXT")
.setContent("log")
.setTags(
......@@ -63,7 +63,7 @@ public class TestLogsMatcher {
.setEndpointName("/traffic")
.setEndpointId("ZTJl.1_L3RyYWZmaWM=")
.setTraceId("ac81b308-0d66-4c69-a7af-a023a536bd3e")
.setTimestamp("1609665785987")
.setTimestamp(1609665785987L)
.setContentType("TEXT")
.setContent("log")
.setTags(
......
......@@ -21,7 +21,7 @@ logs:
endpointName: /traffic
endpointId: not null
traceId: "ac81b308-0d66-4c69-a7af-a023a536bd3e"
timestamp: not null
timestamp: gt 0
contentType: TEXT
content: log
tags:
......
......@@ -19,7 +19,7 @@ logs:
serviceInstanceName: not null
serviceInstanceId: not null
traceId: not null
timestamp: not null
timestamp: gt 0
contentType: TEXT
content: not null
tags:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册