Rename session event, scope to errors (#4761)
parent
7a47656816
commit
ce0bf867ff
|
@ -12,7 +12,7 @@ import {tryFetchGates} from '#/lib/statsig/statsig'
|
||||||
import {getAge} from '#/lib/strings/time'
|
import {getAge} from '#/lib/strings/time'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders'
|
import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders'
|
||||||
import {addSessionEventLog} from './logging'
|
import {addSessionErrorLog} from './logging'
|
||||||
import {
|
import {
|
||||||
configureModerationForAccount,
|
configureModerationForAccount,
|
||||||
configureModerationForGuest,
|
configureModerationForGuest,
|
||||||
|
@ -195,7 +195,9 @@ async function prepareAgent(
|
||||||
const account = agentToSessionAccountOrThrow(agent)
|
const account = agentToSessionAccountOrThrow(agent)
|
||||||
agent.setPersistSessionHandler(event => {
|
agent.setPersistSessionHandler(event => {
|
||||||
onSessionChange(agent, account.did, event)
|
onSessionChange(agent, account.did, event)
|
||||||
addSessionEventLog(account.did, event)
|
if (event !== 'create' && event !== 'update') {
|
||||||
|
addSessionErrorLog(account.did, event)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return {agent, account}
|
return {agent, account}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,12 +71,12 @@ let nextMessageIndex = 0
|
||||||
const MAX_SLICE_LENGTH = 1000
|
const MAX_SLICE_LENGTH = 1000
|
||||||
|
|
||||||
// Not gated.
|
// Not gated.
|
||||||
export function addSessionEventLog(did: string, event: AtpSessionEvent) {
|
export function addSessionErrorLog(did: string, event: AtpSessionEvent) {
|
||||||
try {
|
try {
|
||||||
if (!Statsig.initializeCalled() || !Statsig.getStableID()) {
|
if (!Statsig.initializeCalled() || !Statsig.getStableID()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Statsig.logEvent('session:event', null, {did, event})
|
Statsig.logEvent('session:error', null, {did, event})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue