@sentry/replay
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -1,2 +0,2 @@ | ||
import { Scope, Breadcrumb } from '@sentry/types'; | ||
import { Breadcrumb, Scope } from '@sentry/types'; | ||
export declare function handleScope(scope: Scope): Breadcrumb; |
@@ -1,2 +0,2 @@ | ||
import { RecordingEvent } from './types'; | ||
import { RecordingEvent, WorkerRequest } from './types'; | ||
interface CreateEventBufferParams { | ||
@@ -23,3 +23,9 @@ useCompression: boolean; | ||
private eventBufferItemLength; | ||
private _id; | ||
constructor(worker: Worker); | ||
/** | ||
* Read-only incrementing counter | ||
*/ | ||
get id(): number; | ||
postMessage(args: WorkerRequest): void; | ||
init(): void; | ||
@@ -30,4 +36,5 @@ destroy(): void; | ||
sendEventToWorker(event: RecordingEvent): void; | ||
finishRequest: (id: number) => Promise<Uint8Array>; | ||
finish(): Promise<Uint8Array>; | ||
} | ||
export {}; |
@@ -1,6 +0,6 @@ | ||
import { DsnComponents, Event, Integration, Breadcrumb } from '@sentry/types'; | ||
import { Breadcrumb, DsnComponents, Event, Integration } from '@sentry/types'; | ||
import { Session } from './session/Session'; | ||
import { ReplayPerformanceEntry } from './createPerformanceEntry'; | ||
import { IEventBuffer } from './eventBuffer'; | ||
import type { InstrumentationType, RecordingEvent, RecordingConfig, ReplaySpan, ReplayRequest, SentryReplayPluginOptions, SentryReplayConfiguration } from './types'; | ||
import { Session } from './session/Session'; | ||
import type { InstrumentationType, RecordingConfig, RecordingEvent, ReplayRequest, ReplaySpan, SentryReplayConfiguration, SentryReplayPluginOptions } from './types'; | ||
/** | ||
@@ -57,2 +57,5 @@ * Returns true to return control to calling function, otherwise continue with normal batching | ||
private needsCaptureReplay; | ||
/** | ||
* Captured state when integration is first initialized | ||
*/ | ||
private initialState; | ||
@@ -62,3 +65,12 @@ session: Session | undefined; | ||
constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now | ||
useCompression, captureOnlyOnError, recordingConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...recordingOptions }, }?: SentryReplayConfiguration); | ||
useCompression, captureOnlyOnError, replaysSamplingRate, recordingConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...recordingOptions }, }?: SentryReplayConfiguration); | ||
/** | ||
* Because we create a transaction in `setupOnce`, we can potentially create a | ||
* transaction before some native SDK integrations have run and applied their | ||
* own global event processor. An example is: | ||
* https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts | ||
* | ||
* So we call `this.setup` in next event loop as a workaround to wait for | ||
* other global event processors to finish | ||
*/ | ||
setupOnce(): void; | ||
@@ -65,0 +77,0 @@ /** |
@@ -7,2 +7,7 @@ import { Session } from './Session'; | ||
stickySession: boolean; | ||
/** | ||
* The sampling rate of the Session. See integration configuration comments | ||
* for `replaysSamplingRate`. | ||
*/ | ||
samplingRate?: number; | ||
} | ||
@@ -14,3 +19,3 @@ /** | ||
*/ | ||
export declare function createSession({ stickySession, }: CreateSessionParams): Session; | ||
export declare function createSession({ stickySession, samplingRate, }: CreateSessionParams): Session; | ||
export {}; |
@@ -15,2 +15,7 @@ import { Session } from './Session'; | ||
currentSession?: Session; | ||
/** | ||
* The sampling rate of the Session. See integration configuration comments | ||
* for `replaysSamplingRate`. | ||
*/ | ||
samplingRate?: number; | ||
} | ||
@@ -20,3 +25,3 @@ /** | ||
*/ | ||
export declare function getSession({ expiry, currentSession, stickySession, }: GetSessionParams): { | ||
export declare function getSession({ expiry, currentSession, stickySession, samplingRate, }: GetSessionParams): { | ||
type: string; | ||
@@ -23,0 +28,0 @@ session: Session; |
@@ -12,8 +12,13 @@ interface SessionObject { | ||
/** | ||
* Sequence ID specific to replay updates | ||
* Segment ID for replay events | ||
*/ | ||
sequenceId: number; | ||
segmentId: number; | ||
/** | ||
* Is the session sampled? | ||
*/ | ||
sampled: boolean; | ||
} | ||
interface SessionOptions { | ||
stickySession?: boolean; | ||
samplingRate?: number; | ||
} | ||
@@ -36,3 +41,3 @@ export declare class Session { | ||
*/ | ||
private _sequenceId; | ||
private _segmentId; | ||
/** | ||
@@ -42,4 +47,8 @@ * Previous session ID | ||
private _previousSessionId; | ||
readonly options: Required<SessionOptions>; | ||
constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions); | ||
/** | ||
* Is the Session sampled? | ||
*/ | ||
private _sampled; | ||
readonly options: Required<Pick<SessionOptions, 'stickySession'>>; | ||
constructor(session?: Partial<SessionObject>, { stickySession, samplingRate }?: SessionOptions); | ||
get id(): string; | ||
@@ -49,8 +58,10 @@ get started(): number; | ||
set lastActivity(newDate: number); | ||
get sequenceId(): number; | ||
set sequenceId(id: number); | ||
get segmentId(): number; | ||
set segmentId(id: number); | ||
get previousSessionId(): string; | ||
set previousSessionId(id: string); | ||
get sampled(): boolean; | ||
set sampled(_isSampled: boolean); | ||
toJSON(): SessionObject; | ||
} | ||
export {}; |
@@ -0,3 +1,3 @@ | ||
import { record } from 'rrweb'; | ||
import type { eventWithTime } from 'rrweb/typings/types'; | ||
import { record } from 'rrweb'; | ||
export declare type RecordingEvent = eventWithTime; | ||
@@ -21,2 +21,3 @@ export declare type RecordingConfig = Parameters<typeof record>[0]; | ||
export interface WorkerRequest { | ||
id: number; | ||
method: string; | ||
@@ -29,2 +30,3 @@ args: any[]; | ||
export interface WorkerResponse { | ||
id: number; | ||
method: string; | ||
@@ -61,2 +63,6 @@ success: boolean; | ||
captureOnlyOnError?: boolean; | ||
/** | ||
* The sampling rate for replays. 1.0 will record all replays, 0 will record none. | ||
*/ | ||
replaysSamplingRate?: number; | ||
} | ||
@@ -63,0 +69,0 @@ export interface SentryReplayConfiguration extends SentryReplayPluginOptions { |
{ | ||
"name": "@sentry/replay", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "User replays for Sentry", | ||
@@ -20,2 +20,4 @@ "main": "dist/index.js", | ||
"prepack": "yarn build:prod", | ||
"size": "yarn build:prod && size-limit", | ||
"size-limit-build": "yarn pack", | ||
"start:demo": "yarn build:dev && cd demo && yarn start", | ||
@@ -43,13 +45,16 @@ "test": "yarn jest" | ||
"@sentry/browser": "^7.7.0", | ||
"@size-limit/preset-big-lib": "^7.0.8", | ||
"@types/jest": "^28.1.1", | ||
"@types/node": "^16.0.0", | ||
"@types/pako": "^2.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.14.0", | ||
"@typescript-eslint/parser": "^5.14.0", | ||
"@typescript-eslint/eslint-plugin": "^5.31.0", | ||
"@typescript-eslint/parser": "^5.31.0", | ||
"eslint": "^8.10.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"husky": ">=6", | ||
"jest": "^28.1.1", | ||
"jest-environment-jsdom": "^28.1.1", | ||
"jsdom-worker": "^0.2.1", | ||
"lint-staged": ">=10", | ||
@@ -60,2 +65,3 @@ "prettier": "^2.5.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"size-limit": "^7.0.8", | ||
"ts-jest": "^28.0.4", | ||
@@ -76,9 +82,15 @@ "ts-node": "^10.7.0", | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx}": "yarn eslint --cache --fix" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "dist/index.js", | ||
"limit": "4500ms" | ||
} | ||
], | ||
"volta": { | ||
"node": "16.15.1", | ||
"yarn": "1.22.19" | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx}": "yarn eslint --cache --fix" | ||
} | ||
} |
@@ -49,1 +49,17 @@ # sentry-replay | ||
## Configuration | ||
| key | type | default | description | | ||
| --- | ---- | ------- | ----------- | | ||
| flushMinDelay | number | 5000 | The minimum time to wait (in ms) before sending the recording payload. The payload is sent if `flushMinDelay` ms have elapsed between two events. | | ||
| flushMaxDelay | number | 15000 | The maximum time to wait (in ms) when sending the recording payload. The payload is sent if events occur at an interval less than `flushMinDelay` and `flushMaxDelay` ms have elapsed since the last time a payload was sent. | | ||
| initialFlushDelay | number | 5000 | The amount of time to wait (in ms) before sending the initial recording payload. This helps drop recordings where users visit and close the page quickly. | | ||
| stickySession | boolean | false | Keep track of the user across page loads. Note a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. | | ||
| useCompression | boolean | true | Uses `WebWorkers` (if available) to compress the recording payload before uploading to Sentry. | | ||
| captureOnlyOnError | boolean | false | Only capture the recording when an error happens. | | ||
| replaysSamplingRate | number | 1.0 | The rate at which to sample replays. (1.0 will collect all replays, 0 will collect no replays). | | ||
| maskAllInputs | boolean | true | Mask all `<input>` elements | | ||
| blockClass | string | `'sr-block'` | Redact all elements with the class name `sr-block` | | ||
| ignoreClass | string | `'sr-ignore'` | Ignores all elements with the class name `sr-ignore` | | ||
| maskTextClass | string | `'sr-mask'` | Mask all elements with the class name `sr-ignore` | |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
666507
136
6765
65
29
3