Skip to content

Commit 314e922

Browse files
authored
fix(session-replay): id increment (#892)
1 parent c205f18 commit 314e922

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

examples/next-ssr-example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped using [`create-nex
44

55
## Instrumenting with Splunk RUM using NPM installation method
66

7-
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.
7+
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.
88

99
1. Install Splunk RUM for Browser: `npm install @splunk/otel-web --save`
1010
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.

packages/session-recorder/src/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ const SplunkRumRecorder = {
215215
}
216216

217217
const time = event.timestamp
218-
eventCounter += 1
219218
const eventI = eventCounter
219+
eventCounter += 1
220+
220221
// Research found that stringifying the rr-web event here is
221222
// more efficient for otlp + gzip exporting
222223

@@ -226,13 +227,13 @@ const SplunkRumRecorder = {
226227
for (let i = 0; i < totalC; i++) {
227228
const start = i * MAX_CHUNK_SIZE
228229
const end = (i + 1) * MAX_CHUNK_SIZE
229-
logCounter += 1
230230
const log = convert(decoder.decode(body.slice(start, end)), time, {
231231
'rr-web.offset': logCounter,
232232
'rr-web.event': eventI,
233233
'rr-web.chunk': i + 1,
234234
'rr-web.total-chunks': totalC,
235235
})
236+
logCounter += 1
236237
if (debug) {
237238
console.log(log)
238239
}

0 commit comments

Comments
 (0)