Skip to main content
Version: 2.2.0

Configuration

This document outlines the configuration options for the MSR (Multi-Session Replay) module. These settings allow you to customize the behavior of the frontend modlet, backend server, and integration components.

Frontend Modlet Configuration

Environment Variables

Configure the MSR modlet through environment variables in your web-base project's .env file:

Environment VariableExample ValueDescription
MSR_URLhttp://msr.127.0.0.1.nip.ioBase URL for MSR backend API endpoints
IAMS_AAS_URLhttp://iams-aas.127.0.0.1.nip.ioAuthorization service endpoint for MSR authentication

Component Configuration

MultiSessionReplay Component Props

The main replay component accepts the following configuration props:

interface MultiSessionReplayProps {
lobbyTitle: string; // Title shown in lobby screen
lobbyDescription: string; // Description text in lobby
lobbyButtonText: string; // Text for lobby start button
playbackWindowMinutes?: number; // Default playback window (default: 120)
startBufferMinutes?: number; // Buffer earliest selectable time (default: playbackWindowMinutes)
endBufferMinutes?: number; // Buffer latest selectable time (default: playbackWindowMinutes)
performanceOptions?: MsrPerformanceOptions; // Performance tuning options
blurTargetElement?: HTMLElement; // Element to blur during modals
errorHandling?: ErrorHandlingConfig; // Custom error handling configuration
}
PropTypeRequiredDefaultDescription
lobbyTitlestringYes-Title displayed in the lobby screen when component first loads
lobbyDescriptionstringYes-Description text shown in the lobby to explain the replay feature
lobbyButtonTextstringYes-Text for the button that starts the replay session selection
playbackWindowMinutesnumberNo120Duration in minutes for each replay session. Determines how long from the selected start time the replay will cover
startBufferMinutesnumberNoplaybackWindowMinutesSafety buffer (minutes) applied to earliest selectable time. Prevents selecting times too close to data cleanup boundaries
endBufferMinutesnumberNoplaybackWindowMinutesSafety buffer (minutes) applied to latest selectable time. Prevents selecting times where CDC data may not yet exist
performanceOptionsMsrPerformanceOptionsNoSee Performance OptionsFine-tune replay performance for specific hardware and use cases
blurTargetElementHTMLElementNoundefinedOptional DOM element to apply blur effect when MSR dialogs are open (useful for backdrop effects)
errorHandlingErrorHandlingConfigNoDefault Sonner toast configCustom error handling configuration. Allows overriding default error display behavior with custom handlers

Playback Range Buffers

New in v1.3.0: MSR includes configurable safety buffers to prevent users from selecting times too close to data boundaries:

  • startBufferMinutes: Applies a buffer to the earliest selectable time to prevent selection too close to data cleanup boundaries
  • endBufferMinutes: Applies a buffer to the latest selectable time to prevent selection where CDC data may not yet exist
  • Both buffers default to the playbackWindowMinutes value for consistent safety margins
  • Buffers are applied to the date/time picker UI components automatically

Performance Options Configuration

Fine-tune replay performance for your specific use case:

interface MsrPerformanceOptions {
pollWindowMs?: number; // Time window for fetching CDC data (default: 3000)
frameRate?: number; // Rendering rate in FPS (default: 30)
maxBufferSize?: number; // Max buffered changes (default: 1,000,000)
minPollingInterval?: number; // Min interval between requests (default: 100)
}

Configuration Examples

Basic Component Usage

src/routes/my-replay/+page.svelte
<script>
import { MultiSessionReplay } from '$lib/aoh/msr/components/MultiSessionReplay';
</script>

<MultiSessionReplay
lobbyTitle="System Replay"
lobbyDescription="Review historical system state changes"
lobbyButtonText="Start Replay Session"
playbackWindowMinutes={480}
/>

Performance Optimized Configuration

src/routes/my-replay/+page.svelte
<script>
import { MultiSessionReplay } from '$lib/aoh/msr/components/MultiSessionReplay';

const highPerformanceOptions = {
pollWindowMs: 1000, // Faster polling for high-frequency data
frameRate: 60, // Smooth animation
maxBufferSize: 2000000, // Larger buffer for bursty data
minPollingInterval: 50 // Reduced minimum interval
};
</script>

<MultiSessionReplay
lobbyTitle="Real-time Analysis"
lobbyDescription="High-frequency data replay"
lobbyButtonText="Begin Analysis"
playbackWindowMinutes={60}
performanceOptions={highPerformanceOptions}
/>

Low Resource Configuration

src/routes/my-replay/+page.svelte
<script>
const lowResourceOptions = {
pollWindowMs: 5000, // Slower polling to reduce load
frameRate: 15, // Lower frame rate
maxBufferSize: 500000, // Smaller buffer
minPollingInterval: 200 // Higher minimum interval
};
</script>

<MultiSessionReplay
lobbyTitle="Lightweight Replay"
lobbyDescription="Resource-efficient replay mode"
lobbyButtonText="Start Session"
playbackWindowMinutes={120}
performanceOptions={lowResourceOptions}
/>

Buffered Time Range Configuration

src/routes/my-replay/+page.svelte
<MultiSessionReplay
lobbyTitle="System Analysis"
lobbyDescription="Historical data replay with safety buffers"
lobbyButtonText="Start Analysis"
playbackWindowMinutes={240}
startBufferMinutes={60} // 1-hour buffer from earliest time
endBufferMinutes={30} // 30-minute buffer from latest time
/>

Error Handling Configuration

The MSR includes a comprehensive error handling system with customizable behavior:

interface ErrorHandlingConfig {
/**
* Custom error handler function
* If not provided, uses the default Sonner toast implementation
*/
onError?: ErrorHandler;

/**
* Global error handling options
*/
defaultOptions?: ErrorHandlerOptions;
}

interface ErrorHandlerOptions {
showToast?: boolean; // Show error toast notification (default: true)
logError?: boolean; // Log error to console (default: true)
throwError?: boolean; // Re-throw error for upstream handling (default: false)
}

By default, MSR uses Sonner toast notifications for user-friendly error messages with correlation IDs for support. You can customize this behavior:

Custom error handling example
<script>
import { MultiSessionReplay } from '$lib/aoh/msr/components/MultiSessionReplay';

const customErrorHandling = {
onError: async (error, context, options) => {
// Custom error handling logic
log.error({ error.code, error.message }, 'MSR Error');
// Send to custom error tracking service
trackError(error.correlationId, context);
},
defaultOptions: {
showToast: false, // Disable default toasts
logError: true,
throwError: false
}
};
</script>

<MultiSessionReplay
lobbyTitle="System Replay"
lobbyDescription="Review historical changes"
lobbyButtonText="Start Session"
errorHandling={customErrorHandling}
/>

Filtering Configuration

The MSR component supports filtering to exclude stale or irrelevant data.

  • stateFilterConfig (MsrStateFilterConfig): Applies when loading initial state at the selected timestamp
  • playbackFilterConfig (MsrPlaybackFilterConfig): Applies while polling for events during playback

Both configurations have the shape:

interface MsrStateFilterConfig {
tables: string[];
getMinTimestamp: (context: {
targetTimestamp: Date;
playbackStartTime: Date;
playbackEndTime: Date;
}) => Date;
}

interface MsrPlaybackFilterConfig {
tables: string[];
getMinTimestamp: (context: {
targetTimestamp: Date;
playbackStartTime: Date;
playbackEndTime: Date;
eventWindowStart: Date;
eventWindowEnd: Date;
}) => Date;
}

Examples (dayjs):

Filter out old state (7 days) and logs (1 day)
<script>
import dayjs from 'dayjs';
</script>

<MultiSessionReplay
lobbyTitle="Replay"
lobbyDescription="Historical system replay"
lobbyButtonText="Start"
stateFilterConfig={{
tables: ['patients', 'medications'],
getMinTimestamp: ({ targetTimestamp }) => dayjs(targetTimestamp).subtract(7, 'day').toDate()
}}
playbackFilterConfig={{
tables: ['audit_logs', 'activity_logs'],
getMinTimestamp: ({ targetTimestamp }) => dayjs(targetTimestamp).subtract(1, 'day').toDate()
}}
/>

Notes:

  • Filters are optional; omit to fetch all data
  • One minTimestamp applies to all specified tables in a given config
  • Callbacks re-run when the user changes the target time
  • State filters reduce initial load size; playback filters reduce polling payloads

Backend Server Environment Variables

Environment Variable

The following environment variables are available for configuring the MSR backend server.

Environment VariableExample ValueDescription
LOG_LEVELinfoLogging level: debug, info, warn, error
APP_PORT8080Port for the backend server to listen on
DATABASE_USERmsr_userDatabase username
DATABASE_PASSWORDsecretDatabase password
DATABASE_HOSTlocalhostDatabase host address
DATABASE_PORT5432Database port number
DATABASE_NAMEmsr_dbName of the database
DATABASE_SCHEMApublicDatabase schema to use
DATABASE_SSL_MODEdisableDatabase connection ssl mode: disable, require, verify-ca, verify-full
DATABASE_MAX_CONNS10Maximum number of open database connections
DATABASE_MAX_IDLE_CONNS10Maximum number of idle database connections
DATABASE_MAX_CONN_LIFETIME10mMaximum lifetime of a database connection (e.g., 10m, 1h)
IAMS_KEYCLOAK_URLhttp://iams-keycloak.127.0.0.1.nip.io/realms/aohURL of the Keycloak realm for authentication
CLEANUP_SERVICE_ENABLEDtrueEnable/disable automatic CDC cleanup service (set to false in development)

Configuration Table

The following configuration is stored in the database for the MSR backend server. These values can be modified at runtime without requiring a service restart. Changes take effect on the next scheduled maintenance cycle or immediately for session limits.

Core Configuration Settings

Config keyExample valueConfig typeDescription
MAX_PLAYBACK_RANGE7INTEGERMaximum number of previous days available for replay. Determines snapshot cutoff point and affects available date range in UI.
MAX_ACTIVE_SESSIONS5INTEGERMaximum number of concurrent active replay sessions. If limit is reached, new sessions receive an error prompting them to close existing sessions.
DATA_RETENTION_CRON_EXPRESSION0 3 * * *STRINGCron expression for complete maintenance cycle: refreshes snapshots at cutoff point and removes old CDC events. Default: daily at 3am.
EARLIEST_VALID_TIMESTAMP1900-01-01T00:00:00ZSTRINGAbsolute earliest timestamp for replay data (ISO 8601 format). Set to deployment date for new systems to prevent empty replays. Default effectively disabled.

Performance Tuning Configuration

Config keyExample valueConfig typeDescription
QUERY_WORK_MEM_MB256INTEGERMemory allocation in MB for hash joins and sorting in replay queries. Higher values improve performance for large datasets. Default: 256MB.
COLUMNSTORE_COMPRESSION_AGE_DAYS1INTEGERAge in days before cdc_event chunks compress to columnstore format. Recent data stays uncompressed for fast inserts. Default: 1 day.
CAGG_REFRESH_INTERVAL_HOURS1INTEGERHow often continuous aggregate refreshes (in hours). More frequent refreshes will yield faster query times at the expense storage space. Default: 1 hour.
CAGG_REFRESH_LAG_DAYS1INTEGERHow far behind current time the CAGG refreshes (in days). Prevents refreshing actively-inserting chunks. Default: 1 day.
Configuration Relationships

Several configuration values are interdependent:

  • CAGG retention is automatically calculated as MAX_PLAYBACK_RANGE + 1 day
  • CAGG columnstore compression is calculated as CAGG retention + 1 day
  • All cutoff calculations are dynamic and based on current MAX_PLAYBACK_RANGE value
  • EARLIEST_VALID_TIMESTAMP serves as an absolute minimum, even if MAX_PLAYBACK_RANGE would allow earlier dates