fix: ai filter on ratelimits namespace id is showing bad#3004
fix: ai filter on ratelimits namespace id is showing bad#3004MichaelUnkey merged 12 commits intomainfrom
Conversation
…-ai-filter-on-ratelimitsnamespace_id-is-showing-bad
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
📝 WalkthroughWalkthroughThis pull request introduces an Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LogsLLMSearch
participant SearchActions
participant SearchExampleTooltip
User->>LogsLLMSearch: Open search interface
LogsLLMSearch->>SearchActions: Pass exampleQueries prop
SearchActions->>SearchExampleTooltip: Forward exampleQueries
User->>SearchExampleTooltip: Select example query
SearchExampleTooltip->>LogsLLMSearch: Return selected query
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (12)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-search/index.tsx (1)
47-54: Fix typo in example query textThere's a typo in the first example query: "Shwo" should be "Show".
- { id: "failed-requests", text: "Shwo failed requests today" }, + { id: "failed-requests", text: "Show failed requests today" },Adding example queries is a good enhancement for improving user experience with the search functionality.
apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-search/index.tsx (1)
44-51: Fix the typo in the example queryThere's a typo in the first example query: "Shwo" should be "Show".
- { id: "failed-requests", text: "Shwo failed requests today" }, + { id: "failed-requests", text: "Show failed requests today" },apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-search/index.tsx (1)
47-51: Grammar issue in the first example queryThe first example query "Show all identifiers that is test" has a grammatical error. Since you're referring to "identifiers" (plural), you should use "are" instead of "is".
- exampleQueries={[ - { id: "identifier-is", text: "Show all identifiers that is test" }, - { id: "identifier-contains", text: "Show all identifiers that include cust_" }, - { id: "recent-customers", text: "Show all identifiers for customer in the last 1h" }, - ]} + exampleQueries={[ + { id: "identifier-is", text: "Show all identifiers that are test" }, + { id: "identifier-contains", text: "Show all identifiers that include cust_" }, + { id: "recent-customers", text: "Show all identifiers for customer in the last 1h" }, + ]}Alternatively, use the singular form:
+ { id: "identifier-is", text: "Show all identifiers that match test" },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/audit/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/logs/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/components/logs/llm-search/components/search-actions.tsx(3 hunks)apps/dashboard/components/logs/llm-search/components/search-example-tooltip.tsx(1 hunks)apps/dashboard/components/logs/llm-search/index.tsx(3 hunks)apps/dashboard/lib/trpc/routers/audit/llm-search/utils.ts(1 hunks)apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts(1 hunks)apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
apps/dashboard/components/logs/llm-search/components/search-actions.tsx (1)
apps/dashboard/components/logs/llm-search/components/search-example-tooltip.tsx (1) (1)
SearchExampleTooltip(9-56)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Test Packages / Test ./internal/clickhouse
- GitHub Check: Build / Build
- GitHub Check: Test Agent Local / test_agent_local
- GitHub Check: Test Go API Local / Test
- GitHub Check: autofix
- GitHub Check: Test API / API Test Local
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (13)
apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx (1)
49-53: LGTM! Good example queriesThe example queries provided are relevant and helpful for users searching through API logs. They cover common use cases like rate-limited requests and recent activity.
apps/dashboard/app/(app)/audit/components/controls/components/logs-search/index.tsx (1)
47-51: LGTM! Appropriate examples for audit logsThese example queries are well-suited for the audit logs context, providing users with relevant examples for exploring key creation, ratelimit events, and role deletions.
apps/dashboard/app/(app)/logs/components/controls/components/logs-search/index.tsx (1)
47-51: LGTM! Examples cover common log search scenariosThe example queries provided cover common log search scenarios, such as failed requests, auth errors, and specific API paths. These will help guide users in constructing effective searches.
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts (1)
14-17: Improved error handling for missing OpenAI configurationGood enhancement! This change provides a clear error message when OpenAI isn't properly configured, making it easier for users to understand and resolve the issue.
apps/dashboard/components/logs/llm-search/components/search-actions.tsx (3)
5-5: LGTM: Adding exampleQueries propThe addition of this optional prop enhances the component's flexibility, allowing for context-specific example queries.
19-19: LGTM: Destructuring the new propProperly destructuring the newly added prop to make it available within the component.
48-50: LGTM: Passing example queries to tooltip componentCorrectly passing the exampleQueries prop to the SearchExampleTooltip, enabling dynamic example queries based on context.
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1)
33-36: Improved error handling for missing OpenAI configurationThis is a good improvement to error handling, providing clear feedback when OpenAI isn't configured correctly. The consistent approach across different parts of the application helps maintain a uniform user experience.
apps/dashboard/components/logs/llm-search/index.tsx (2)
12-12: Well-typed prop addition for example queriesThe type definition for the new
exampleQueriesprop is clear and follows best practices.
26-26: Correctly implemented prop passingGood job passing the
exampleQueriesprop down to theSearchActionscomponent. This maintains the component hierarchy and ensures that the example queries are available where needed.Also applies to: 159-160
apps/dashboard/lib/trpc/routers/audit/llm-search/utils.ts (1)
17-22: Improved error handling for missing OpenAI configurationThe change from returning
nullto throwing a specificTRPCErrorwith a "PRECONDITION_FAILED" code and informative message is excellent. This provides clearer feedback to users when their OpenAI API key is misconfigured.This change will help users more quickly identify and resolve configuration issues, especially given the explanatory error message.
apps/dashboard/components/logs/llm-search/components/search-example-tooltip.tsx (2)
6-6: Well-typed prop addition for SearchExampleTooltipGood addition of the optional
exampleQueriesprop to the component's props interface.
9-14: Good implementation of default fallback for examplesThe implementation correctly uses the nullish coalescing operator (
??) to provide default example queries when none are specified. This maintains backward compatibility while enabling context-specific examples.
apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-search/index.tsx
Outdated
Show resolved
Hide resolved
apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx
Show resolved
Hide resolved
apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx
Outdated
Show resolved
Hide resolved
|
If you don’t know what they’re used for, please challenge their existence by asking about it @ogzhanolguncu should know what’s up with those |
…-ai-filter-on-ratelimitsnamespace_id-is-showing-bad
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/components/logs-search/index.tsx (1)
47-51: Fix typo in example query and improve the guidance.There's a typo in the second example query - "startes" should be "starts". Additionally, consider making the example queries more specific and clearly demonstrate the available search capabilities to help users.
exampleQueries={[ "Show rate limited outcomes", - "Show identity that startes with test_", + "Show identity that starts with test_", "Show name that starts with test_ in the last hour", ]}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/audit/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/logs/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-search/index.tsx(1 hunks)apps/dashboard/components/logs/llm-search/components/search-actions.tsx(3 hunks)apps/dashboard/components/logs/llm-search/components/search-example-tooltip.tsx(2 hunks)apps/dashboard/components/logs/llm-search/index.tsx(3 hunks)apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts(1 hunks)apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/dashboard/app/(app)/logs/components/controls/components/logs-search/index.tsx
- apps/dashboard/components/logs/llm-search/components/search-actions.tsx
- apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/components/logs-search/index.tsx
- apps/dashboard/app/(app)/ratelimits/_components/controls/components/logs-search/index.tsx
- apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/components/logs-search/index.tsx
- apps/dashboard/app/(app)/audit/components/controls/components/logs-search/index.tsx
- apps/dashboard/app/(app)/apis/_components/controls/components/logs-search/index.tsx
- apps/dashboard/components/logs/llm-search/index.tsx
- apps/dashboard/components/logs/llm-search/components/search-example-tooltip.tsx
🧰 Additional context used
🧬 Code Definitions (2)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts (1)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts (1) (1)
getStructuredSearchFromLLM(7-78)
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts (2)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts (1) (1)
getStructuredSearchFromLLM(7-78)apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1) (1)
getStructuredSearchFromLLM(26-97)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Test Go API Local / Test
- GitHub Check: Test Packages / Test ./packages/cache
- GitHub Check: Test Packages / Test ./packages/api
- GitHub Check: Test Packages / Test ./internal/keys
- GitHub Check: Test Packages / Test ./internal/billing
- GitHub Check: Test Agent Local / test_agent_local
- GitHub Check: autofix
- GitHub Check: Build / Build
- GitHub Check: Test API / API Test Local
🔇 Additional comments (2)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts (1)
30-37: Error handling improvement looks great!The updated test correctly verifies that the function now throws a
TRPCErrorwith the appropriate code and message when OpenAI is not configured. This aligns with the implementation change in the utility function and provides clearer error messaging for users.apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts (1)
46-53: Consistent error handling implementation is good!The test has been correctly updated to verify the new error handling behavior when OpenAI is not configured. This change ensures consistency with the same pattern implemented in other modules, providing uniform error messaging across the application.
What does this PR do?
Eng-1626
Fixes # (issue)
If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists
Type of change
How should this be tested?
Wording for suggestions makes sense in its context, and functions as expected
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit
New Features
Bug Fixes