Add feature column to microdollar usage API responses#362
Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
Open
Add feature column to microdollar usage API responses#362kiloconnect[bot] wants to merge 1 commit intomainfrom
kiloconnect[bot] wants to merge 1 commit intomainfrom
Conversation
- Add feature (feature_name) to user-level usage API (profile/usage) - Add feature to organization-level usage API (get and getTimeSeries endpoints) - Join with microdollar_usage_metadata and feature tables to get feature info - Update UsageDetailByDay type to include feature field Built for [Brendan](https://kilo-code.slack.com/archives/C0AF922FTB4/p1771511489370519?thread_ts=1771499545.031009&cid=C0AF922FTB4) by [Kilo for Slack](https://kilo.ai/features/slack-integration)
| const selectFields = { | ||
| date: sql<string>`DATE(${microdollar_usage.created_at})`, | ||
| ...(groupByModel && { model: microdollar_usage.model }), | ||
| feature: sql<string>`${feature.feature}`.as('feature'), |
Contributor
Author
There was a problem hiding this comment.
WARNING: Incorrect type annotation — sql<string> should be sql<string | null> since this comes from a leftJoin. When there's no matching microdollar_usage_metadata or feature row, the value will be null at runtime, but TypeScript will believe it's string.
Suggested change
| feature: sql<string>`${feature.feature}`.as('feature'), | |
| feature: sql<string | null>`${feature.feature}`.as('feature'), |
Contributor
Author
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (3 files)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the (feature_name) column to the microdollar usage API responses for both organization-level and user-level usage.
Changes Made:
User-level usage API ():
Organization-level usage API ():
Type definition ():
How it works:
The already exists in the table which links to the lookup table. This PR joins these tables to expose the feature name (e.g., vscode-extension, jetbrains-extension, cli, slack, kilo-claw, cloud-agent, code-review) in the usage API responses.
Built for Brendan by Kilo for Slack