This query aggregates the workspace_agent_stats and workspace_app_stats data into a single table for efficient storage and querying. Half-hour buckets are used to store the data, and the minutes are summed for each user and template combination. The result is stored in the template_usage_stats table
(ctx context.Context)
| 1426 | // used to store the data, and the minutes are summed for each user and template |
| 1427 | // combination. The result is stored in the template_usage_stats table. |
| 1428 | UpsertTemplateUsageStats(ctx context.Context) error |
| 1429 | // UpsertUserAIProviderKey preserves the original id and created_at when the |
| 1430 | // user/provider pair already exists. On conflict, callers provide id and |
| 1431 | // created_at for the insert path only. |
no outgoing calls