Fix NPE in log query by traceId. (#11764)

This commit is contained in:
Chen Ziyan 2024-01-12 20:13:23 +08:00 committed by GitHub
parent da0205bc58
commit e004762dfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -18,6 +18,7 @@
* Support Service Hierarchy auto matching.
* Add `namespace` suffix for `K8S_SERVICE_NAME_RULE/ISTIO_SERVICE_NAME_RULE` and `metadata-service-mapping.yaml` as default.
* Allow using a dedicated port for ALS receiver.
* Fix log query by traceId in `JDBCLogQueryDAO`.
#### UI

View File

@ -101,12 +101,17 @@ public class JDBCLogQueryDAO implements ILogQueryDAO {
tags.stream().map(Tag::getKey).filter(not(searchableTagKeys::contains)).collect(toSet()));
return new Logs();
}
List<String> tables;
if (nonNull(duration)) {
tables = tableHelper.getTablesForRead(
LogRecord.INDEX_NAME,
duration.getStartTimeBucket(),
duration.getEndTimeBucket()
);
} else {
tables = tableHelper.getTablesWithinTTL(LogRecord.INDEX_NAME);
}
final var tables = tableHelper.getTablesForRead(
LogRecord.INDEX_NAME,
duration.getStartTimeBucket(),
duration.getEndTimeBucket()
);
final var logs = new ArrayList<Log>();
for (final var table : tables) {