Skip to content

Commit 72a8abf

Browse files
Justin Torreclaude
authored andcommitted
fix: Rate limit tab now correctly filters to only rate-limited requests
The rate limit filter was looking up a property filter by label, which failed when the Helicone-Rate-Limit-Status property hadn't been used yet. This caused the filter node to be an empty object ({}) that matched all requests instead of only rate-limited ones. Fixed by building the filter node directly using the known property structure. Use empty object {} when not filtering (valid FilterNode type) instead of "all" string which causes backend validation errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 80619cf commit 72a8abf

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

web/components/templates/requests/useRequestsPageV2.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ const useRequestsPageV2 = (
7272
};
7373
}
7474

75-
const rateLimitFilterMapIndex = filterMap.findIndex(
76-
(filter: any) => filter.label?.trim() === "Helicone-Rate-Limit-Status",
77-
);
78-
79-
let rateLimitFilterNode: FilterNode = {} as FilterLeaf;
80-
if (rateLimited && rateLimitFilterMapIndex !== -1) {
81-
rateLimitFilterNode = filterUITreeToFilterNode(filterMap, {
82-
filterMapIdx: rateLimitFilterMapIndex,
83-
operatorIdx: 0,
84-
value: "rate_limited",
85-
});
86-
}
75+
// Build rate limit filter directly instead of looking it up in filterMap
76+
// This ensures it works even if the property hasn't been used yet
77+
// Use empty object {} to match all when not filtering by rate limited
78+
const rateLimitFilterNode: FilterNode = rateLimited
79+
? {
80+
request_response_rmt: {
81+
properties: {
82+
"Helicone-Rate-Limit-Status": {
83+
equals: "rate_limited",
84+
},
85+
},
86+
},
87+
}
88+
: {};
8789

8890
// sort the model by name
8991
models?.data?.sort((a, b) => a.model.localeCompare(b.model));

0 commit comments

Comments
 (0)