|
| 1 | +--- |
| 2 | +title: Real User Monitoring |
| 3 | +icon: Activity |
| 4 | +description: Configure browser-side real user monitoring for LibreChat. |
| 5 | +--- |
| 6 | + |
| 7 | +Real User Monitoring (RUM) sends browser performance and interaction telemetry to an observability backend. LibreChat supports HyperDX through the browser startup configuration served by the API. |
| 8 | + |
| 9 | +RUM is disabled by default. Enable it only after you have chosen an ingest endpoint and authentication mode. |
| 10 | + |
| 11 | +## HyperDX Setup |
| 12 | + |
| 13 | +For a local HyperDX collector, use: |
| 14 | + |
| 15 | +```bash filename=".env" |
| 16 | +RUM_ENABLED=true |
| 17 | +RUM_PROVIDER=hyperdx |
| 18 | +RUM_URL=http://localhost:4318 |
| 19 | +RUM_SERVICE_NAME=librechat-web |
| 20 | +RUM_ENVIRONMENT=development |
| 21 | +RUM_AUTH_MODE=publicToken |
| 22 | +RUM_PUBLIC_TOKEN=local-dev-token |
| 23 | +``` |
| 24 | + |
| 25 | +For hosted or production collectors, use an HTTPS collector URL: |
| 26 | + |
| 27 | +```bash filename=".env" |
| 28 | +RUM_ENABLED=true |
| 29 | +RUM_PROVIDER=hyperdx |
| 30 | +RUM_URL=https://rum.example.com/v1/traces |
| 31 | +RUM_SERVICE_NAME=librechat-web |
| 32 | +RUM_ENVIRONMENT=production |
| 33 | +``` |
| 34 | + |
| 35 | +## Authentication Modes |
| 36 | + |
| 37 | +### Public Token |
| 38 | + |
| 39 | +Use `publicToken` when your collector expects a browser-safe ingest token: |
| 40 | + |
| 41 | +```bash filename=".env" |
| 42 | +RUM_AUTH_MODE=publicToken |
| 43 | +RUM_PUBLIC_TOKEN=your-browser-ingest-token |
| 44 | +``` |
| 45 | + |
| 46 | +This is the easiest mode for OSS deployments because it does not depend on LibreChat user authentication. |
| 47 | + |
| 48 | +### User JWT |
| 49 | + |
| 50 | +Use `userJwt` when your collector is behind infrastructure that accepts the current LibreChat user JWT: |
| 51 | + |
| 52 | +```bash filename=".env" |
| 53 | +RUM_AUTH_MODE=userJwt |
| 54 | +RUM_AUTH_HEADER_SCHEME=Bearer |
| 55 | +RUM_URL=https://rum.example.com/otlp/v1/traces |
| 56 | +``` |
| 57 | + |
| 58 | +When `userJwt` is used, LibreChat only returns the RUM config to authenticated users. The user JWT is attached only to requests sent to the configured `RUM_URL`, so use this mode only with a trusted HTTPS collector endpoint. |
| 59 | + |
| 60 | +## Trace Propagation |
| 61 | + |
| 62 | +You can opt in to browser trace context propagation for your own HTTPS services: |
| 63 | + |
| 64 | +```bash filename=".env" |
| 65 | +RUM_TRACE_PROPAGATION_TARGETS=https://api.example.com,https://gateway.example.com |
| 66 | +``` |
| 67 | + |
| 68 | +Do not add third-party AI provider APIs to this list. LibreChat filters unsafe targets to avoid propagating browser trace headers to model providers. |
| 69 | + |
| 70 | +## Privacy Controls |
| 71 | + |
| 72 | +RUM uses conservative defaults: |
| 73 | + |
| 74 | +- Session replay is disabled by default. |
| 75 | +- Console capture is disabled by default. |
| 76 | +- Advanced network capture is disabled by default. |
| 77 | +- User attributes avoid names, emails, prompts, and message content. |
| 78 | + |
| 79 | +You can override these defaults if your deployment has appropriate consent and data-handling controls: |
| 80 | + |
| 81 | +```bash filename=".env" |
| 82 | +RUM_DISABLE_REPLAY=true |
| 83 | +RUM_CONSOLE_CAPTURE=false |
| 84 | +RUM_ADVANCED_NETWORK_CAPTURE=false |
| 85 | +RUM_SAMPLE_RATE=1 |
| 86 | +``` |
| 87 | + |
| 88 | +## Environment Variables |
| 89 | + |
| 90 | +<OptionTable |
| 91 | + options={[ |
| 92 | + ['RUM_ENABLED', 'boolean', 'Enable browser Real User Monitoring.', 'RUM_ENABLED=false'], |
| 93 | + [ |
| 94 | + 'RUM_PROVIDER', |
| 95 | + 'string', |
| 96 | + 'RUM provider. Currently supports `hyperdx`.', |
| 97 | + 'RUM_PROVIDER=hyperdx', |
| 98 | + ], |
| 99 | + [ |
| 100 | + 'RUM_URL', |
| 101 | + 'string', |
| 102 | + 'OTLP HTTP ingest URL for browser telemetry.', |
| 103 | + 'RUM_URL=http://localhost:4318', |
| 104 | + ], |
| 105 | + [ |
| 106 | + 'RUM_SERVICE_NAME', |
| 107 | + 'string', |
| 108 | + 'Service name attached to browser telemetry.', |
| 109 | + 'RUM_SERVICE_NAME=librechat-web', |
| 110 | + ], |
| 111 | + [ |
| 112 | + 'RUM_ENVIRONMENT', |
| 113 | + 'string', |
| 114 | + 'Environment name attached to browser telemetry.', |
| 115 | + 'RUM_ENVIRONMENT=production', |
| 116 | + ], |
| 117 | + [ |
| 118 | + 'RUM_AUTH_MODE', |
| 119 | + 'string', |
| 120 | + 'Authentication mode for browser telemetry: `publicToken` or `userJwt`.', |
| 121 | + 'RUM_AUTH_MODE=publicToken', |
| 122 | + ], |
| 123 | + [ |
| 124 | + 'RUM_PUBLIC_TOKEN', |
| 125 | + 'string', |
| 126 | + 'Browser-safe ingest token used when `RUM_AUTH_MODE=publicToken`.', |
| 127 | + 'RUM_PUBLIC_TOKEN=your-browser-ingest-token', |
| 128 | + ], |
| 129 | + [ |
| 130 | + 'RUM_AUTH_HEADER_SCHEME', |
| 131 | + 'string', |
| 132 | + 'Authorization header scheme used with `userJwt` mode.', |
| 133 | + 'RUM_AUTH_HEADER_SCHEME=Bearer', |
| 134 | + ], |
| 135 | + [ |
| 136 | + 'RUM_TRACE_PROPAGATION_TARGETS', |
| 137 | + 'string', |
| 138 | + 'Comma-separated HTTPS origins or URL prefixes that should receive browser trace context headers.', |
| 139 | + 'RUM_TRACE_PROPAGATION_TARGETS=https://api.example.com', |
| 140 | + ], |
| 141 | + ['RUM_DISABLE_REPLAY', 'boolean', 'Disable session replay capture.', 'RUM_DISABLE_REPLAY=true'], |
| 142 | + [ |
| 143 | + 'RUM_CONSOLE_CAPTURE', |
| 144 | + 'boolean', |
| 145 | + 'Enable browser console capture. Disabled by default.', |
| 146 | + 'RUM_CONSOLE_CAPTURE=false', |
| 147 | + ], |
| 148 | + [ |
| 149 | + 'RUM_ADVANCED_NETWORK_CAPTURE', |
| 150 | + 'boolean', |
| 151 | + 'Enable advanced network capture. Disabled by default.', |
| 152 | + 'RUM_ADVANCED_NETWORK_CAPTURE=false', |
| 153 | + ], |
| 154 | + [ |
| 155 | + 'RUM_SAMPLE_RATE', |
| 156 | + 'number', |
| 157 | + 'Client-side RUM sample rate between 0 and 1.', |
| 158 | + 'RUM_SAMPLE_RATE=1', |
| 159 | + ], |
| 160 | + ]} |
| 161 | +/> |
0 commit comments