fix: drop stale instance_id filter from search and scope route stats by app
The exchange search silently filtered by the in-memory agent registry's current instance IDs on top of application_id. Historical exchanges written by previous agent instances (or any instance not currently registered, e.g. after a server restart before agents heartbeat back) were hidden from results even though they matched the application filter. Fix: drop the applicationId -> instanceIds resolution in SearchController. Rely on application_id = ? in ClickHouseSearchIndex; keep explicit instanceIds filtering only when a client passes them. Related cleanup: the agentIds parameter on StatsStore.statsForRoute / timeseriesForRoute was silently discarded inside ClickHouseStatsStore, so per-route stats aggregated across any apps sharing a routeId. Replace with String applicationId and add application_id to the stats_1m_route filters so per-route stats are correctly scoped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,8 +22,8 @@ import java.util.List;
|
||||
* @param routeId exact match on route_id
|
||||
* @param instanceId exact match on instance_id
|
||||
* @param processorType matches processor_types array via has()
|
||||
* @param applicationId application ID filter (resolved to instanceIds server-side)
|
||||
* @param instanceIds list of instance IDs (resolved from application, used for IN clause)
|
||||
* @param applicationId exact match on application_id
|
||||
* @param instanceIds list of instance IDs for an IN clause (only set when drilling down to specific agents)
|
||||
* @param offset pagination offset (0-based)
|
||||
* @param limit page size (default 50, max 500)
|
||||
* @param sortField column to sort by (default: startTime)
|
||||
|
||||
@@ -45,12 +45,12 @@ public class SearchService {
|
||||
return statsStore.statsForApp(from, to, applicationId, environment);
|
||||
}
|
||||
|
||||
public ExecutionStats stats(Instant from, Instant to, String routeId, List<String> agentIds) {
|
||||
return statsStore.statsForRoute(from, to, routeId, agentIds, null);
|
||||
public ExecutionStats statsForRoute(Instant from, Instant to, String routeId, String applicationId) {
|
||||
return statsStore.statsForRoute(from, to, routeId, applicationId, null);
|
||||
}
|
||||
|
||||
public ExecutionStats stats(Instant from, Instant to, String routeId, List<String> agentIds, String environment) {
|
||||
return statsStore.statsForRoute(from, to, routeId, agentIds, environment);
|
||||
public ExecutionStats statsForRoute(Instant from, Instant to, String routeId, String applicationId, String environment) {
|
||||
return statsStore.statsForRoute(from, to, routeId, applicationId, environment);
|
||||
}
|
||||
|
||||
public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount) {
|
||||
@@ -69,14 +69,14 @@ public class SearchService {
|
||||
return statsStore.timeseriesForApp(from, to, bucketCount, applicationId, environment);
|
||||
}
|
||||
|
||||
public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount,
|
||||
String routeId, List<String> agentIds) {
|
||||
return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, agentIds, null);
|
||||
public StatsTimeseries timeseriesForRoute(Instant from, Instant to, int bucketCount,
|
||||
String routeId, String applicationId) {
|
||||
return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, applicationId, null);
|
||||
}
|
||||
|
||||
public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount,
|
||||
String routeId, List<String> agentIds, String environment) {
|
||||
return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, agentIds, environment);
|
||||
public StatsTimeseries timeseriesForRoute(Instant from, Instant to, int bucketCount,
|
||||
String routeId, String applicationId, String environment) {
|
||||
return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, applicationId, environment);
|
||||
}
|
||||
|
||||
// ── Dashboard-specific queries ────────────────────────────────────────
|
||||
|
||||
@@ -16,8 +16,8 @@ public interface StatsStore {
|
||||
// Per-app stats (stats_1m_app)
|
||||
ExecutionStats statsForApp(Instant from, Instant to, String applicationId, String environment);
|
||||
|
||||
// Per-route stats (stats_1m_route), optionally scoped to specific agents
|
||||
ExecutionStats statsForRoute(Instant from, Instant to, String routeId, List<String> agentIds, String environment);
|
||||
// Per-route stats (stats_1m_route), optionally scoped to an application
|
||||
ExecutionStats statsForRoute(Instant from, Instant to, String routeId, String applicationId, String environment);
|
||||
|
||||
// Per-processor stats (stats_1m_processor)
|
||||
ExecutionStats statsForProcessor(Instant from, Instant to, String routeId, String processorType);
|
||||
@@ -28,9 +28,9 @@ public interface StatsStore {
|
||||
// Per-app timeseries
|
||||
StatsTimeseries timeseriesForApp(Instant from, Instant to, int bucketCount, String applicationId, String environment);
|
||||
|
||||
// Per-route timeseries, optionally scoped to specific agents
|
||||
// Per-route timeseries, optionally scoped to an application
|
||||
StatsTimeseries timeseriesForRoute(Instant from, Instant to, int bucketCount,
|
||||
String routeId, List<String> agentIds, String environment);
|
||||
String routeId, String applicationId, String environment);
|
||||
|
||||
// Per-processor timeseries
|
||||
StatsTimeseries timeseriesForProcessor(Instant from, Instant to, int bucketCount,
|
||||
|
||||
Reference in New Issue
Block a user