mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
chore: add aibridge data to telemetry (#20449)
- Adds a new table to keep track of which payloads have already been reported since we only report for the last clock hour - Adds a query to gather and aggregate all the data by provider/model/client Relates to https://github.com/coder/coder-telemetry-server/issues/27
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- name: InsertTelemetryLock :exec
|
||||
-- Inserts a new lock row into the telemetry_locks table. Replicas should call
|
||||
-- this function prior to attempting to generate or publish a heartbeat event to
|
||||
-- the telemetry service.
|
||||
-- If the query returns a duplicate primary key error, the replica should not
|
||||
-- attempt to generate or publish the event to the telemetry service.
|
||||
INSERT INTO
|
||||
telemetry_locks (event_type, period_ending_at)
|
||||
VALUES
|
||||
($1, $2);
|
||||
|
||||
-- name: DeleteOldTelemetryLocks :exec
|
||||
-- Deletes old telemetry locks from the telemetry_locks table.
|
||||
DELETE FROM
|
||||
telemetry_locks
|
||||
WHERE
|
||||
period_ending_at < @period_ending_at_before::timestamptz;
|
||||
Reference in New Issue
Block a user