Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-ears-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/browser': patch
---

feat: Add rrweb replay config
19 changes: 18 additions & 1 deletion packages/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,24 @@ HyperDX.init({
```
- `disableReplay` - (Optional) Whether to disable session replay (default `false`)
- `recordCanvas` - (Optional) Whether to record canvas elements (default `false`)
- `sampling` - (Optional) The sampling [config](https://github.com/rrweb-io/rrweb/blob/5fbb904edb653f3da17e6775ee438d81ef0bba83/docs/recipes/optimize-storage.md?plain=1#L22) in the session recording
- `sampling` - (Optional) The sampling [config](https://github.com/rrweb-io/rrweb/blob/5fbb904edb653f3da17e6775ee438d81ef0bba83/docs/recipes/optimize-storage.md?plain=1#L22) in the session recording
- `replay` - (Optional) A passthrough for the underlying rrweb recorder
options, including `hooks` for observing events as rrweb captures them.
Explicit options (`maskAllInputs`, `recordCanvas`, `sampling`, etc.) take
precedence over the same fields set here. Example:
```js
HyperDX.init({
apiKey: '<YOUR_API_KEY_HERE>',
service: 'my-frontend-app',
replay: {
hooks: {
mutation: (...mutations) => {
// consumer-defined observation / filtering logic
},
},
},
});
```

## Additional Configuration

Expand Down
5 changes: 5 additions & 0 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type ErrorBoundaryComponent = any; // TODO: Define ErrorBoundary type
type Instrumentations = RumOtelWebConfig['instrumentations'];
type IgnoreUrls = RumOtelWebConfig['ignoreUrls'];

type ReplayConfig = Omit<RumRecorderConfig, 'apiKey' | 'url' | 'debug'>;

type BrowserSDKConfig = {
advancedNetworkCapture?: boolean;
apiKey: string;
Expand All @@ -29,6 +31,7 @@ type BrowserSDKConfig = {
maskAllText?: boolean;
maskClass?: string;
recordCanvas?: boolean;
replay?: ReplayConfig;
sampling?: RumRecorderConfig['sampling'];
service: string;
tracePropagationTargets?: (string | RegExp)[];
Expand Down Expand Up @@ -64,6 +67,7 @@ class Browser {
maskAllText = false,
maskClass,
recordCanvas = false,
replay,
sampling,
service,
tracePropagationTargets,
Expand Down Expand Up @@ -127,6 +131,7 @@ class Browser {

if (disableReplay !== true) {
SessionRecorder.init({
...replay,
apiKey,
blockClass,
debug,
Expand Down
Loading