Merge branch 'session-event-twk' into session-stress
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user