Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* BanyanDB: fix dropping a measure, as removing a runtime rule or changing a metric's function with `allowStorageChange` does, leaving its pre-built TopN aggregations behind on the dropped measure. The drop deleted a TopN aggregation named after the measure, but each is named after its `bydb-topn.yml` rule, so none was deleted, and a measure created again under the same name found the old ones in place and kept their old definition. It now deletes every TopN aggregation whose source is the dropped measure, and when one fails to delete it stops before the measure, so the removal fails and is tried again instead of leaving that aggregation behind.
* Fix the trace and Zipkin queries putting an event of eBPF profiling on the wrong span, or losing it. A server-side event (a request read, or a response written, on the server, attached to the client's span through its trace context) belongs on the server's span, while the client-side events of that span stay on it; but the span an event went to was remembered by the span the event named alone, so every event of a span followed its first one. On a Zipkin trace, a span that took both its own events and the server-side events of its client span was also rebuilt twice, keeping only one of the two sets. Each event now goes to the span of its own side.
* Fix span-attached events of eBPF profiling overwriting each other. An event's storage ID was its segment ID, start time and name. Rover sends a Zipkin event with an empty segment ID, so two Zipkin events with the same name and start time, in any two traces, had one ID, and so could two SkyWalking events on different spans of one segment. Elasticsearch kept only the one written last, and JDBC, whose row key is the same ID, cannot hold both. The ID now also carries the trace ID and span ID.
* Fix JDBC trace profiling queries failing when a task has no profiled segments: the empty segment-ID list now returns an empty result without generating an invalid SQL `IN ()` clause.
* Add the `query-server` module, so the native query APIs can have their own port, apart from the ports agents report to. Set `SW_QUERY_SERVER_REST_PORT` to a port greater than 0, and GraphQL (`/graphql`), the AI agent conversation view and files (`/ai-agent/conversations/*`), and `/status/config/ttl` move from the core REST port (default `12800`) to it, with their own host, context path and TLS settings (`SW_QUERY_SERVER_REST_*`). Point the UI's `queryUrl`, `swctl --base-url` and other GraphQL clients at the new port. With the default `0`, nothing changes. Together with `receiver-sharing-server`, no agent or query traffic is left on the core ports.

#### UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public List<SegmentRecord> queryByTraceId(String traceId, @Nullable Duration dur
@SneakyThrows
@Override
public List<SegmentRecord> queryBySegmentIdList(List<String> segmentIdList, @Nullable Duration duration) throws IOException {
if (CollectionUtils.isEmpty(segmentIdList)) {
return Collections.emptyList();
}
final var tables = tableHelper.getTablesWithinTTL(SegmentRecord.INDEX_NAME);
final var segmentRecords = new ArrayList<SegmentRecord>();
final ArrayList<String> conditions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -100,6 +101,16 @@ void queryBySegmentIdList_shouldUseInClause() throws Exception {
assertThat(sql).doesNotContain(" or ");
}

@Test
void queryBySegmentIdList_withEmptyList_shouldReturnEmptyWithoutQuerying() throws Exception {
when(tableHelper.getTablesWithinTTL(SegmentRecord.INDEX_NAME))
.thenReturn(Collections.singletonList(TABLE));

assertThat(dao.queryBySegmentIdList(Collections.emptyList(), null)).isEmpty();

verifyNoInteractions(jdbcClient);
}

@Test
void queryByTraceIdWithInstanceId_shouldProduceValidSqlWithBothInClauses() throws Exception {
when(tableHelper.getTablesWithinTTL(SegmentRecord.INDEX_NAME))
Expand Down
Loading