Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(session-replay): id increment #892

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link return 404 and link checker in CI fails. I decided to remove it. This example needs to remove anyway.

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
Copy link
Member Author

@Joozty Joozty Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image


// 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
Loading