From ce0bf867ff3b50a495d8db242a7f55371bffeadc Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 9 Jul 2024 23:03:59 +0100 Subject: [PATCH] Rename session event, scope to errors (#4761) --- src/state/session/agent.ts | 6 ++++-- src/state/session/logging.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts index d31b5588..4456ab0b 100644 --- a/src/state/session/agent.ts +++ b/src/state/session/agent.ts @@ -12,7 +12,7 @@ import {tryFetchGates} from '#/lib/statsig/statsig' import {getAge} from '#/lib/strings/time' import {logger} from '#/logger' import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders' -import {addSessionEventLog} from './logging' +import {addSessionErrorLog} from './logging' import { configureModerationForAccount, configureModerationForGuest, @@ -195,7 +195,9 @@ async function prepareAgent( const account = agentToSessionAccountOrThrow(agent) agent.setPersistSessionHandler(event => { onSessionChange(agent, account.did, event) - addSessionEventLog(account.did, event) + if (event !== 'create' && event !== 'update') { + addSessionErrorLog(account.did, event) + } }) return {agent, account} } diff --git a/src/state/session/logging.ts b/src/state/session/logging.ts index ab67785c..9a703957 100644 --- a/src/state/session/logging.ts +++ b/src/state/session/logging.ts @@ -71,12 +71,12 @@ let nextMessageIndex = 0 const MAX_SLICE_LENGTH = 1000 // Not gated. -export function addSessionEventLog(did: string, event: AtpSessionEvent) { +export function addSessionErrorLog(did: string, event: AtpSessionEvent) { try { if (!Statsig.initializeCalled() || !Statsig.getStableID()) { return } - Statsig.logEvent('session:event', null, {did, event}) + Statsig.logEvent('session:error', null, {did, event}) } catch (e) { console.error(e) }