mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-13 08:02:47 +00:00
* feat(telemetry): add generic feature_usage table and batched logging endpoint Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(telemetry): log AI session usage events and document them in telemetry settings Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): use escape sequence instead of literal NUL bytes in buffer key Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): validate dimensions, decouple retention, keepalive flush Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): allowlist feature-usage dimensions and index retention scans Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): pin tool-name allowlist and deploy session attribution Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(telemetry): route AI chat usage through feature_usage and drop ai_chat_usage Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(telemetry): slim dimension validation to registered kinds plus key shape Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): backfill ai_chat_usage into feature_usage before dropping it Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): disclose provider and model identifiers in telemetry settings text Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(telemetry): issue all flush chunks before awaiting so pagehide keeps them Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: update ee-repo-ref to 6306c072a50937ea9af44a5bcf42345543207486 This commit updates the EE repository reference after PR #672 was merged in windmill-ee-private. Previous ee-repo-ref: 964f242a0eb44db7f7d26636cc8d76aeabea2b73 New ee-repo-ref: 6306c072a50937ea9af44a5bcf42345543207486 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
23 lines
1.2 KiB
SQL
23 lines
1.2 KiB
SQL
-- AI chat usage telemetry now flows through the generic feature_usage table
|
|
-- (ai_chat/message and ai_chat/model events). Backfill the accumulated rows so
|
|
-- no reporting window is lost, then drop the old table. Day-bucketing uses the
|
|
-- chat's first-message date; values are filtered to the identifier shape the
|
|
-- logging endpoint enforces.
|
|
INSERT INTO feature_usage (feature, kind, key, entity_id, day, value, updated_at)
|
|
SELECT 'ai_chat', 'message', mode, session_id, created_at::date, message_count, created_at
|
|
FROM ai_chat_usage
|
|
WHERE mode ~ '^[A-Za-z0-9_:./-]{1,100}$'
|
|
AND session_id ~ '^[A-Za-z0-9_:./-]{1,50}$'
|
|
ON CONFLICT (feature, kind, key, entity_id, day)
|
|
DO UPDATE SET value = feature_usage.value + EXCLUDED.value;
|
|
|
|
INSERT INTO feature_usage (feature, kind, key, entity_id, day, value, updated_at)
|
|
SELECT 'ai_chat', 'model', provider || ':' || model, session_id, created_at::date, message_count, created_at
|
|
FROM ai_chat_usage
|
|
WHERE (provider || ':' || model) ~ '^[A-Za-z0-9_:./-]{1,100}$'
|
|
AND session_id ~ '^[A-Za-z0-9_:./-]{1,50}$'
|
|
ON CONFLICT (feature, kind, key, entity_id, day)
|
|
DO UPDATE SET value = feature_usage.value + EXCLUDED.value;
|
|
|
|
DROP TABLE ai_chat_usage;
|