Skip to content

Commit

Permalink
chore: default to ingesting console logs as searchable logs (#17773)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 4, 2023
1 parent b3748a2 commit a348b25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions plugin-server/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ export function getDefaultConfig(): PluginsServerConfig {
SESSION_RECORDING_PARALLEL_CONSUMPTION: false,
POSTHOG_SESSION_RECORDING_REDIS_HOST: undefined,
POSTHOG_SESSION_RECORDING_REDIS_PORT: undefined,
// by default a very restricted list of teams, so we can slowly roll out
MAX_TEAM_TO_ALLOW_SESSION_RECORDING_CONSOLE_LOGS_INGESTION: 2,
SESSION_RECORDING_CONSOLE_LOGS_INGESTION_ENABLED: true,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const consoleLogEventsCounter = new Counter({
// am going to leave this duplication and then collapse it when/if we add a performance events ingester
export class ConsoleLogsIngester {
producer?: RdKafkaProducer
max_allowed_team: number
enabled: boolean
constructor(
private readonly serverConfig: PluginsServerConfig,
private readonly persistentHighWaterMarker: OffsetHighWaterMarker
) {
this.max_allowed_team = serverConfig.MAX_TEAM_TO_ALLOW_SESSION_RECORDING_CONSOLE_LOGS_INGESTION
this.enabled = serverConfig.SESSION_RECORDING_CONSOLE_LOGS_INGESTION_ENABLED
}

public async consumeBatch(messages: IncomingRecordingMessage[]) {
Expand Down Expand Up @@ -82,6 +82,10 @@ export class ConsoleLogsIngester {
}

public async consume(event: IncomingRecordingMessage): Promise<Promise<number | null | undefined>[] | void> {
if (!this.enabled) {
return
}

const warn = (text: string, labels: Record<string, any> = {}) =>
status.warn('⚠️', `[console-log-events-ingester] ${text}`, {
offset: event.metadata.offset,
Expand Down Expand Up @@ -119,10 +123,6 @@ export class ConsoleLogsIngester {
return drop('high_water_mark')
}

if (event.team_id > this.max_allowed_team) {
return drop('team_above_max_allowed')
}

try {
const consoleLogEvents = gatherConsoleLogEvents(event.team_id, event.session_id, event.events)

Expand Down
3 changes: 1 addition & 2 deletions plugin-server/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ export interface PluginsServerConfig {
SESSION_RECORDING_REDIS_PREFIX: string
SESSION_RECORDING_PARTITION_REVOKE_OPTIMIZATION: boolean
SESSION_RECORDING_PARALLEL_CONSUMPTION: boolean
// team ids greater than this won't ingest console logs separately, allows controlled rollout by team
MAX_TEAM_TO_ALLOW_SESSION_RECORDING_CONSOLE_LOGS_INGESTION: number
SESSION_RECORDING_CONSOLE_LOGS_INGESTION_ENABLED: boolean

// Dedicated infra values
SESSION_RECORDING_KAFKA_HOSTS: string | undefined
Expand Down

0 comments on commit a348b25

Please sign in to comment.