Skip to content

Commit

Permalink
fix(session-replay): id increment (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joozty authored Nov 12, 2024
1 parent c205f18 commit 314e922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/next-ssr-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped using [`create-nex

## Instrumenting with Splunk RUM using NPM installation method

Next.js uses [static generation](https://nextjs.org/docs/basic-features/pages#pre-rendering) by default to generate the output HTML for most pages. As static generation is done using the node.js runtime, it isn't compatible with RUM. Check that RUM is only imported and activated in the browser environment.
Next.js uses static generation by default to generate the output HTML for most pages. As static generation is done using the node.js runtime, it isn't compatible with RUM. Check that RUM is only imported and activated in the browser environment.

1. Install Splunk RUM for Browser: `npm install @splunk/otel-web --save`
2. Create file `src/instrument.js` that imports `@splunk/otel-web` and calls `SplunkOtelWeb.init()`. You can use the Data Setup guided setup in Splunk Observability to get the correct values for your organization.
Expand Down
5 changes: 3 additions & 2 deletions packages/session-recorder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ const SplunkRumRecorder = {
}

const time = event.timestamp
eventCounter += 1
const eventI = eventCounter
eventCounter += 1

// Research found that stringifying the rr-web event here is
// more efficient for otlp + gzip exporting

Expand All @@ -226,13 +227,13 @@ const SplunkRumRecorder = {
for (let i = 0; i < totalC; i++) {
const start = i * MAX_CHUNK_SIZE
const end = (i + 1) * MAX_CHUNK_SIZE
logCounter += 1
const log = convert(decoder.decode(body.slice(start, end)), time, {
'rr-web.offset': logCounter,
'rr-web.event': eventI,
'rr-web.chunk': i + 1,
'rr-web.total-chunks': totalC,
})
logCounter += 1
if (debug) {
console.log(log)
}
Expand Down

0 comments on commit 314e922

Please sign in to comment.