├── .github ├── .gitkeep ├── workflows │ ├── check-links.yml │ ├── ci.yml │ └── cla.yml ├── CODEOWNERS ├── pull_request_template.md ├── actions │ └── setup │ │ └── action.yml └── dependabot.yml ├── .nvmrc ├── .npmrc ├── .env.example ├── examples ├── todolist │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ └── manifest.json │ ├── .env.example │ ├── .gitignore │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ ├── server │ │ └── instrumentation.js │ ├── index.d.ts │ ├── rsbuild.config.ts │ └── src │ │ ├── index.tsx │ │ └── app.tsx ├── nextjs │ ├── app │ │ ├── favicon.ico │ │ └── globals.css │ ├── public │ │ ├── vercel.svg │ │ ├── window.svg │ │ ├── file.svg │ │ ├── globe.svg │ │ └── next.svg │ ├── .env.example │ ├── package.json │ ├── .gitignore │ ├── tsconfig.json │ └── instrumentation-client.ts ├── electron │ ├── .gitignore │ ├── src │ │ ├── index.css │ │ ├── renderer.ts │ │ └── preload.ts │ ├── .env.example │ ├── tsconfig.json │ ├── webpack.renderer.config.ts │ ├── webpack.plugins.ts │ └── webpack.main.config.ts └── installing-npm │ ├── package.json │ ├── index.html │ ├── tsconfig.json │ ├── src │ ├── app.ts │ ├── index.ts │ └── instrumentation.ts │ └── rsbuild.config.ts ├── .lycheeignore ├── packages ├── web │ ├── tsconfig.json │ ├── src │ │ ├── upstream │ │ │ └── user-interaction │ │ │ │ ├── readme.md │ │ │ │ ├── version.ts │ │ │ │ ├── enums │ │ │ │ └── attribute-names.ts │ │ │ │ └── internal-types.ts │ │ ├── filters │ │ │ └── index.ts │ │ ├── otel-api-globals.ts │ │ ├── managers │ │ │ ├── index.ts │ │ │ ├── storage │ │ │ │ ├── index.ts │ │ │ │ ├── providers │ │ │ │ │ └── index.ts │ │ │ │ └── constants.ts │ │ │ └── session-manager │ │ │ │ ├── index.ts │ │ │ │ ├── constants.ts │ │ │ │ └── session-state.ts │ │ ├── types │ │ │ ├── index.ts │ │ │ └── type-guards │ │ │ │ ├── index.ts │ │ │ │ ├── string.ts │ │ │ │ └── error.ts │ │ ├── utils │ │ │ ├── is-safari.ts │ │ │ ├── index.ts │ │ │ ├── url.ts │ │ │ ├── is-trusted-event.ts │ │ │ ├── iframe.ts │ │ │ ├── detect-latest.ts │ │ │ ├── parse-version.ts │ │ │ ├── hash.ts │ │ │ └── observable.ts │ │ ├── version.ts │ │ ├── index-browser.ts │ │ ├── synthetics.ts │ │ └── splunk-web-tracer-provider.ts │ ├── tsconfig.test.json │ ├── tsconfig.cjs.json │ ├── tsconfig.esm.json │ ├── tsconfig.base.json │ └── tests │ │ ├── utils │ │ ├── index.ts │ │ ├── web-tracer-provider.ts │ │ ├── span.ts │ │ ├── span-capturer.ts │ │ └── memory-exporter.ts │ │ └── utils.test.ts ├── session-recorder │ ├── tsconfig.json │ ├── tsconfig.esm.json │ ├── tsconfig.cjs.json │ ├── tsconfig.base.json │ ├── webpack.lock │ └── src │ │ ├── type-guards │ │ ├── index.ts │ │ └── primitive-types.ts │ │ ├── api │ │ └── index.ts │ │ ├── session-replay │ │ ├── index.ts │ │ └── config.ts │ │ ├── version.ts │ │ ├── log │ │ ├── index.ts │ │ └── types.ts │ │ └── detect-latest.ts ├── integration-tests │ ├── src │ │ ├── tests │ │ │ ├── docload │ │ │ │ ├── assets │ │ │ │ │ ├── splunk.woff │ │ │ │ │ ├── css-font-img.css │ │ │ │ │ └── splunk-black.png │ │ │ │ ├── iframe.ejs │ │ │ │ ├── docload.ejs │ │ │ │ ├── docload-ignored.ejs │ │ │ │ └── docload-all.ejs │ │ │ ├── resource-observer │ │ │ │ ├── assets │ │ │ │ │ ├── image.png │ │ │ │ │ ├── splunk-black.png │ │ │ │ │ ├── test-alt.js │ │ │ │ │ └── test.js │ │ │ │ ├── resources-postload-disabled.ejs │ │ │ │ ├── resources-twice.ejs │ │ │ │ └── resources-twice-no-cache.ejs │ │ │ ├── privacy │ │ │ │ ├── privacy.ejs │ │ │ │ ├── privacy-mask-all-text-false.ejs │ │ │ │ ├── privacy-mask.ejs │ │ │ │ ├── privacy-exclude.ejs │ │ │ │ ├── privacy-unmask.ejs │ │ │ │ ├── privacy-mask-unmask.ejs │ │ │ │ └── privacy-length.ejs │ │ │ ├── server-timing │ │ │ │ └── index.ejs │ │ │ ├── cookies │ │ │ │ ├── iframe.ejs │ │ │ │ ├── cookies.iframe.ejs │ │ │ │ ├── cookies.ejs │ │ │ │ └── cookies-domain.ejs │ │ │ ├── init │ │ │ │ ├── no-beacon.ejs │ │ │ │ ├── attributes-no-globals.ejs │ │ │ │ ├── capture-errors.ejs │ │ │ │ └── attributes.ejs │ │ │ ├── visibility │ │ │ │ └── visibility.ejs │ │ │ ├── errors │ │ │ │ └── views │ │ │ │ │ ├── resource-4xx.ejs │ │ │ │ │ ├── js-syntax-error.ejs │ │ │ │ │ ├── unhandled-rejection.ejs │ │ │ │ │ ├── unhandled-rejection.undefined.ejs │ │ │ │ │ ├── module-error.ejs │ │ │ │ │ ├── unhandled-error.ejs │ │ │ │ │ ├── module.js │ │ │ │ │ ├── console-error.ejs │ │ │ │ │ ├── minified-file-errors.ejs │ │ │ │ │ ├── splunkrum-reporterror.ejs │ │ │ │ │ ├── script1.min.js │ │ │ │ │ └── script2.min.js │ │ │ ├── frustration-signals │ │ │ │ ├── rage-click-default.ejs │ │ │ │ └── rage-click.ejs │ │ │ ├── bots │ │ │ │ ├── bots-disabled.ejs │ │ │ │ └── bots-enabled.ejs │ │ │ ├── sampling │ │ │ │ └── sampling.ejs │ │ │ ├── automation-frameworks │ │ │ │ ├── automation-frameworks-disabled.ejs │ │ │ │ └── automation-frameworks-enabled.ejs │ │ │ ├── connectivity │ │ │ │ └── connectivity.ejs │ │ │ ├── user-interaction │ │ │ │ ├── mouse-document.ejs │ │ │ │ ├── mouse-bubble.ejs │ │ │ │ ├── forms.ejs │ │ │ │ ├── history.ejs │ │ │ │ ├── mouse.ejs │ │ │ │ ├── mouse-disabled.ejs │ │ │ │ ├── keyboard.ejs │ │ │ │ └── causality.ejs │ │ │ ├── cdn │ │ │ │ └── index.ejs │ │ │ ├── fetch │ │ │ │ ├── fetch.ejs │ │ │ │ ├── fetch-ignored.ejs │ │ │ │ └── fetch-post.ejs │ │ │ ├── context │ │ │ │ ├── fetch-then.ejs │ │ │ │ ├── messageport-cors-inner.ejs │ │ │ │ ├── location-hash.ejs │ │ │ │ ├── xhr-onload.ejs │ │ │ │ ├── framework │ │ │ │ │ ├── vue2.ejs │ │ │ │ │ ├── vue3.ejs │ │ │ │ │ ├── react-16.ejs │ │ │ │ │ └── react-latest.ejs │ │ │ │ ├── xhr-events.ejs │ │ │ │ ├── messageport-onmessage.ejs │ │ │ │ ├── set-timeout.ejs │ │ │ │ ├── messageport-addeventlistener.ejs │ │ │ │ ├── mutation-observer-textnode.ejs │ │ │ │ ├── xhr-events-removed.ejs │ │ │ │ └── messageport-cors.ejs │ │ │ ├── long-task │ │ │ │ ├── buffered.ejs │ │ │ │ └── index.ejs │ │ │ ├── native │ │ │ │ ├── native.ejs │ │ │ │ └── native.spec.ts │ │ │ ├── synthetics │ │ │ │ └── index.ejs │ │ │ ├── websocket │ │ │ │ ├── websocket-construct-errors.ejs │ │ │ │ ├── websocket-send-errors.ejs │ │ │ │ ├── websocket-ignored.ejs │ │ │ │ ├── websocket.ejs │ │ │ │ └── websocket-sub-protocol.ejs │ │ │ ├── xhr │ │ │ │ ├── xhr-basic.ejs │ │ │ │ └── xhr-ignored.ejs │ │ │ ├── webvitals │ │ │ │ ├── webvitals.ejs │ │ │ │ └── webvitals-specific-disabled.ejs │ │ │ ├── socketio │ │ │ │ ├── socketio.ejs │ │ │ │ └── socketio.before.ejs │ │ │ └── redacting-attributes │ │ │ │ ├── index.ejs │ │ │ │ └── index.spec.ts │ │ ├── version.ts │ │ ├── server │ │ │ ├── middlewares │ │ │ │ ├── index.ts │ │ │ │ ├── no-cache-middleware.ts │ │ │ │ ├── delay-middleware.ts │ │ │ │ └── server-timing-middleware.ts │ │ │ ├── utils.ts │ │ │ └── server-timing.ts │ │ └── utils │ │ │ └── test.ts │ └── tsconfig.json └── build-plugins │ ├── tsconfig.json │ ├── tsconfig.esm.json │ ├── tsconfig.cjs.json │ ├── tsconfig.base.json │ ├── src │ └── version.ts │ └── tests │ └── project │ ├── webpack.config.without-plugin.js │ ├── src │ ├── other-entry.js │ ├── common │ │ └── helpers.js │ └── index.js │ ├── webpack.config.without-source-maps-options.js │ ├── webpack-utils.js │ ├── webpack.config.no-source-maps.js │ ├── webpack.config.devtool.eval.js │ ├── webpack.config.devtool.source-map.js │ └── webpack.config.devtool.hidden-source-map.js ├── SECURITY.md ├── .editorconfig ├── pnpm-workspace.yaml ├── .markdownlint.json ├── tsconfig.eslint.json ├── .gitignore ├── tests ├── servers │ ├── index.ts │ ├── socket-io.ts │ └── websocket.ts └── global-setup.ts ├── turbo.json ├── tsconfig.json ├── .prettierrc.cjs ├── scripts └── utils │ ├── arguments.mts │ ├── index.mts │ ├── mimetypes.mts │ ├── generate-script-snippet.mts │ ├── get-package-roots.mts │ ├── cf-invalidation.mts │ └── upload-to-s3.mts ├── vitest.config.debug.mts └── .size-limit.cjs /.github/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v22.14.0 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | git-tag-version = false 2 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | CDN_DISTRIBUTION_ID=xxx 2 | CDN_BUCKET_NAME=xxx 3 | GITHUB_TOKEN=xxx 4 | -------------------------------------------------------------------------------- /examples/todolist/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /examples/nextjs/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/examples/nextjs/app/favicon.ico -------------------------------------------------------------------------------- /.lycheeignore: -------------------------------------------------------------------------------- 1 | http://localhost:9100/ 2 | %3C%25=%20assetPrefix%20%25%3E/.* 3 | https://www.npmjs.com/* 4 | https://bundlephobia.com/* 5 | -------------------------------------------------------------------------------- /examples/todolist/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/examples/todolist/public/favicon.ico -------------------------------------------------------------------------------- /examples/todolist/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/examples/todolist/public/logo192.png -------------------------------------------------------------------------------- /examples/todolist/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/examples/todolist/public/logo512.png -------------------------------------------------------------------------------- /examples/electron/.gitignore: -------------------------------------------------------------------------------- 1 | # Environment variables (contains secrets) 2 | .env 3 | 4 | # Webpack build output 5 | .webpack 6 | 7 | out/ 8 | -------------------------------------------------------------------------------- /examples/nextjs/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "include": ["src/**/*.ts"], 4 | "exclude": ["node_modules", "src/**/*.test.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/session-recorder/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "include": ["src/**/*.ts", "src/**/*.js"], 4 | "exclude": ["node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/assets/splunk.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/packages/integration-tests/src/tests/docload/assets/splunk.woff -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/assets/css-font-img.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: splunkerz; 3 | } 4 | 5 | @font-face { 6 | font-family: splunkerz; 7 | src: url('splunk.woff'); 8 | } 9 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/assets/splunk-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/packages/integration-tests/src/tests/docload/assets/splunk-black.png -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/resource-observer/assets/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/packages/integration-tests/src/tests/resource-observer/assets/image.png -------------------------------------------------------------------------------- /examples/electron/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 3 | margin: auto; 4 | max-width: 38rem; 5 | padding: 2rem; 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/resource-observer/assets/splunk-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalfx/splunk-otel-js-web/HEAD/packages/integration-tests/src/tests/resource-observer/assets/splunk-black.png -------------------------------------------------------------------------------- /packages/build-plugins/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "include": ["src/**/*.ts", "*.mts", "tests/**/*.ts", "../integration-test-node/**/*.ts"], 4 | "exclude": ["node_modules", "dist"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/web/src/upstream/user-interaction/readme.md: -------------------------------------------------------------------------------- 1 | Source: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-user-interaction 2 | 3 | Modified to remove dependency on zone.js 4 | -------------------------------------------------------------------------------- /packages/web/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "noEmit": true, 5 | "allowJs": true 6 | }, 7 | "include": ["src/**/*.test.ts"], 8 | "exclude": [] 9 | } 10 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/iframe.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | iframe 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | ## Reporting Security Issues 4 | 5 | Please _DO NOT_ report security vulnerabilities with public GitHub issue 6 | reports. Please [report security issues here](https://www.splunk.com/en_us/product-security/report.html). 7 | -------------------------------------------------------------------------------- /packages/build-plugins/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "ES6", 5 | "outDir": "./dist/esm", 6 | "rootDir": "src", 7 | "sourceMap": true 8 | }, 9 | "extends": "./tsconfig.base.json" 10 | } 11 | -------------------------------------------------------------------------------- /packages/build-plugins/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "CommonJS", 5 | "outDir": "./dist/cjs", 6 | "rootDir": "src", 7 | "sourceMap": true 8 | }, 9 | "extends": "./tsconfig.base.json" 10 | } 11 | -------------------------------------------------------------------------------- /examples/todolist/.env.example: -------------------------------------------------------------------------------- 1 | PUBLIC_REACT_APP_BACKEND=http://localhost:3001 2 | # Change the realm (us0) depending on your account region 3 | PUBLIC_REACT_APP_RUM_BEACON_URL=https://rum-ingest.us0.signalfx.com/v1/rum 4 | PUBLIC_REACT_APP_RUM_APP_NAME= 5 | PUBLIC_REACT_APP_RUM_TOKEN= 6 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent() %> 8 | 9 | 10 |

Privacy h1

11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/electron/.env.example: -------------------------------------------------------------------------------- 1 | # Splunk RUM Configuration 2 | # Copy this file to .env and fill in your values 3 | 4 | SPLUNK_RUM_REALM= 5 | SPLUNK_RUM_ACCESS_TOKEN= 6 | SPLUNK_RUM_APPLICATION_NAME=splunk-otel-electron-example 7 | SPLUNK_RUM_ENVIRONMENT=development 8 | SPLUNK_RUM_DEBUG=true 9 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/server-timing/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Server timing 6 | 7 | <%- renderAgent({}) %> 8 | 9 | 10 |

Server timing

11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/cookies/iframe.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Iframe 6 | 7 | <%- renderAgent({applicationName: 'iframe'}) %> 8 | 9 | 10 |

IFRAME

11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/init/no-beacon.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test init 6 | 7 | <%- renderAgent({beaconEndpoint: undefined}) %> 8 | 9 | 10 |

Init

11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/session-recorder/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "ESNext", 5 | "moduleResolution": "bundler", 6 | "outDir": "./dist/esm", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "extends": "./tsconfig.base.json" 11 | } 12 | -------------------------------------------------------------------------------- /packages/integration-tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["**/*.ts"], 3 | "compilerOptions": { 4 | "allowSyntheticDefaultImports": true, 5 | "target": "esnext", 6 | "moduleResolution": "nodenext", 7 | "module": "NodeNext", 8 | "strict": true, 9 | "noImplicitAny": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/session-recorder/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "NodeNext", 5 | "moduleResolution": "nodenext", 6 | "outDir": "./dist/cjs", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "extends": "./tsconfig.base.json" 11 | } 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 4 9 | indent_style = tab 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | max_line_length = 120 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - examples/**/* 3 | - packages/**/* 4 | 5 | onlyBuiltDependencies: 6 | - '@splunk/otel' 7 | - '@swc/core' 8 | - core-js 9 | - electron 10 | - electron-winstaller 11 | - esbuild 12 | - fs-xattr 13 | - macos-alias 14 | - protobufjs 15 | - sharp 16 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "line-length": false, 4 | "no-trailing-spaces": false, 5 | "blanks-around-lists": false, 6 | "blanks-around-headings": false, 7 | "commands-show-output": false, 8 | "no-inline-html": false, 9 | "first-line-h1": false, 10 | "no-hard-tabs": false 11 | } 12 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/cookies/cookies.iframe.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cookies 6 | 7 | 8 |

COOKIES WITH IFRAME

9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/nextjs/.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_SPLUNK_RUM_ACCESS_TOKEN= 2 | NEXT_PUBLIC_SPLUNK_RUM_APPLICATION_NAME= 3 | NEXT_PUBLIC_SPLUNK_RUM_DEPLOYMENT_ENVIROMENT= 4 | NEXT_PUBLIC_SPLUNK_RUM_BEACON_ENDPOINT= 5 | NEXT_PUBLIC_SPLUNK_RUM_SESSION_REPLAY_BEACON_ENDPOINT= 6 | NEXT_PUBLIC_SPLUNK_REALM= 7 | NEXT_PUBLIC_SPLUNK_CDN_VERSION= 8 | -------------------------------------------------------------------------------- /examples/installing-npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/npm", 3 | "private": true, 4 | "scripts": { 5 | "build": "rsbuild build", 6 | "start": "rsbuild dev", 7 | "clean": "rm -rf dist .turbo" 8 | }, 9 | "devDependencies": { 10 | "@rsbuild/core": "^1.6.11", 11 | "@splunk/otel-web": "workspace:*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/cookies/cookies.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cookies 6 | 7 | <%- renderAgent({debug: true}) %> 8 | 9 | 10 |

COOKIES

11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/visibility/visibility.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test visibility 6 | 7 | <%- renderAgent({debug: true, instrumentations: {visibility: true}}) %> 8 | 9 | 10 |

visibility

11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/cookies/cookies-domain.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cookies Domain 6 | 7 | <%- renderAgent({debug: true, cookieDomain: "127.0.0.1.nip.io"}) %> 8 | 9 | 10 |

COOKIES DOMAIN

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/init/attributes-no-globals.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test init 6 | 7 | <%- renderAgent({applicationName:'custom-app', deploymentEnvironment: 'custom-environment'}) %> 8 | 9 | 10 |

Attributes

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/resource-4xx.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({ allowInsecureBeacon: true }) %> 7 | 8 | 9 |

Dom parsing error simulation

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-mask-all-text-false.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: false 10 | } 11 | }) %> 12 | 13 | 14 |

Privacy h1

15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/web/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "NodeNext", 5 | "moduleResolution": "nodenext", 6 | "outDir": "./dist/cjs", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "extends": "./tsconfig.base.json", 11 | "include": ["src/**/*.ts"], 12 | "exclude": ["node_modules", "src/**/*.test.ts"] 13 | } 14 | -------------------------------------------------------------------------------- /packages/web/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "ESNext", 5 | "moduleResolution": "bundler", 6 | "outDir": "./dist/esm", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "extends": "./tsconfig.base.json", 11 | "include": ["src/**/*.ts"], 12 | "exclude": ["node_modules", "src/**/*.test.ts"] 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/frustration-signals/rage-click-default.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rage click disabled by default 6 | 7 | <%- renderAgent() %> 8 | 9 | 10 |

Rage click

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/nextjs/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/nextjs/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/installing-npm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Installing Splunk Real User Monitoring via NPM 6 | 7 | 8 |

Installing Splunk Real User Monitoring via NPM

9 |

Please see the description in the README.

10 |

You can now open the DevTools console to see spans as they are created.

11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-mask.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: false, 10 | sensitivityRules: [ 11 | { rule: 'mask', selector: 'h1' } 12 | ] 13 | } 14 | }) %> 15 | 16 | 17 |

Privacy h1

18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/bots/bots-disabled.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Bots disabled test 6 | 7 | <%- renderAgent({ debug: true, disableBots: true }) %> 8 | 9 | 10 |

Bots disabled test

11 |

12 |   
13 | 
14 | 
15 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/sampling/sampling.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Session sampling
 6 | 	<%- renderAgent() %>
 7 | 
 8 | 
 9 |   

Session sampling

10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/todolist/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-exclude.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: false, 10 | sensitivityRules: [ 11 | { rule: 'exclude', selector: 'body' } 12 | ] 13 | } 14 | }) %> 15 | 16 | 17 |

Privacy h1

18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-unmask.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: true, 10 | sensitivityRules: [{ 11 | rule: 'unmask', 12 | selector: 'h1' 13 | }] 14 | } 15 | }) %> 16 | 17 | 18 |

Privacy h1

19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/web/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "esModuleInterop": true, 7 | "noEmitOnError": true, 8 | "pretty": true, 9 | "resolveJsonModule": true, 10 | "target": "ESNext", 11 | "skipLibCheck": true, 12 | "strict": true 13 | }, 14 | "include": ["src/**/*.ts"], 15 | "exclude": ["node_modules"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/js-syntax-error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 10 | 11 | 12 |

Manual console.error

13 |

14 |   
15 | 
16 | 
17 | 


--------------------------------------------------------------------------------
/examples/electron/tsconfig.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"compilerOptions": {
 3 | 		"target": "ES6",
 4 | 		"allowJs": true,
 5 | 		"module": "commonjs",
 6 | 		"skipLibCheck": true,
 7 | 		"esModuleInterop": true,
 8 | 		"noImplicitAny": true,
 9 | 		"sourceMap": true,
10 | 		"baseUrl": ".",
11 | 		"outDir": "dist",
12 | 		"moduleResolution": "node",
13 | 		"resolveJsonModule": true,
14 | 		"paths": {
15 | 			"*": ["node_modules/*"]
16 | 		}
17 | 	},
18 | 	"include": ["src/**/*", "*.ts"]
19 | }
20 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/bots/bots-enabled.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Bots allowed test
 6 | 
 7 | 	<%- renderAgent({ debug: true }) %>
 8 | 
 9 | 	
10 | 
11 | 
12 |   

Bots allowed test

13 |

14 |   
15 | 
16 | 
17 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/init/capture-errors.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Test init
 6 | 
 7 | 	<%- renderAgent({instrumentations: {errors: false}}) %>
 8 | 
 9 | 
10 | 	

instrumentations.errors: false

11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-mask-unmask.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: false, 10 | sensitivityRules: [ 11 | { rule: 'mask', selector: 'body' }, 12 | { rule: 'unmask', selector: 'h1' } 13 | ] 14 | } 15 | }) %> 16 | 17 | 18 |

Privacy h1

19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/installing-npm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "incremental": true 15 | }, 16 | "include": ["**/*.ts"], 17 | "exclude": ["node_modules"] 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/docload.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test init 6 | 7 | <%- renderAgent({debug: true}) %> 8 | 9 | 10 |

Docload

11 | 12 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "esModuleInterop": false, 7 | "noEmitOnError": true, 8 | "pretty": true, 9 | "resolveJsonModule": true, 10 | "target": "ES2017", 11 | "types": ["vitest/global", "@vitest/browser/providers/playwright"], 12 | "noEmit": true, 13 | "allowJs": true 14 | }, 15 | "include": ["**/*.test.ts"], 16 | "exclude": ["node_modules"] 17 | } 18 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/privacy/privacy-length.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Privacy 6 | 7 | <%- renderAgent({ 8 | privacy: { 9 | maskAllText: true, 10 | sensitivityRules: [{ 11 | rule: 'unmask', 12 | selector: 'h1' 13 | }] 14 | } 15 | }) %> 16 | 17 | 18 |

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/automation-frameworks/automation-frameworks-disabled.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Automation frameworks disabled test 6 | 7 | <%- renderAgent({ debug: true, disableAutomationFrameworks: true }) %> 8 | 9 | 10 |

Automation frameworks disabled test

11 |

12 |   
13 | 
14 | 
15 | 


--------------------------------------------------------------------------------
/packages/session-recorder/tsconfig.base.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"compilerOptions": {
 3 | 		"allowJs": true,
 4 | 		"checkJs": false,
 5 | 		"esModuleInterop": true,
 6 | 		"forceConsistentCasingInFileNames": true,
 7 | 		"module": "ESNext",
 8 | 		"moduleResolution": "bundler",
 9 | 		"noEmitOnError": true,
10 | 		"pretty": true,
11 | 		"resolveJsonModule": true,
12 | 		"target": "ES2017",
13 | 		"skipLibCheck": true,
14 | 		"strict": true
15 | 	},
16 | 	"include": ["src/**/*.ts", "src/**/*.js"],
17 | 	"exclude": ["node_modules"]
18 | }
19 | 


--------------------------------------------------------------------------------
/examples/todolist/tsconfig.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"compilerOptions": {
 3 | 		"target": "ES2017",
 4 | 		"lib": ["dom", "dom.iterable", "esnext"],
 5 | 		"allowJs": true,
 6 | 		"skipLibCheck": true,
 7 | 		"strict": true,
 8 | 		"noEmit": true,
 9 | 		"esModuleInterop": true,
10 | 		"module": "esnext",
11 | 		"moduleResolution": "bundler",
12 | 		"resolveJsonModule": true,
13 | 		"isolatedModules": true,
14 | 		"jsx": "preserve",
15 | 		"incremental": true
16 | 	},
17 | 	"include": ["**/*.ts", "**/*.tsx"],
18 | 	"exclude": ["node_modules"]
19 | }
20 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/automation-frameworks/automation-frameworks-enabled.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Automation frameworks allowed test
 6 | 
 7 | 	<%- renderAgent({ debug: true }) %>
 8 | 
 9 | 	
10 | 
11 | 
12 |   

Automation frameworks allowed test

13 |

14 |   
15 | 
16 | 
17 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/errors/views/unhandled-rejection.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Errors test
 6 |   <%- renderAgent({}) %>
 7 |   
12 | 
13 | 
14 |   

Unhandled rejection

15 |

16 |   
17 | 
18 | 
19 | 


--------------------------------------------------------------------------------
/packages/session-recorder/webpack.lock:
--------------------------------------------------------------------------------
1 | {
2 |   "https://cdn.signalfx.com/o11y-gdi-rum/session-replay/v2.5.6/background-service.html": { "integrity": "sha512-nG+L/5fTm5UEe1j2+U09sQFvUNWfdiHM3MZ0PH/HE0inDrkxQ51lGTfgnaEoNto4BjlSG6oVfZ/pqBJ5Z0+l6Q==", "contentType": "text/html" },
3 |   "https://cdn.signalfx.com/o11y-gdi-rum/session-replay/v2.5.6/session-replay.module.legacy.min.js": { "integrity": "sha512-cJ/JOm8rupaV30csWfo6RdK6RHSbgIM4A/ryFY4Ql8oT8LjLivB4BwdpyBMy0zBNfun79OryUmmGTWKrdCBLRw==", "contentType": "text/javascript" },
4 |   "version": 1
5 | }
6 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/connectivity/connectivity.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Test connectivity
 6 | 
 7 | 	
16 | 
17 | 	<%- renderAgent({debug: true, instrumentations: {connectivity: true}}) %>
18 | 
19 | 
20 |     

Connectivity

21 | 22 | 23 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/docload/docload-ignored.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test init 6 | 7 | <%- renderAgent({}, true) %> 8 | 14 | 15 | 16 |

Docload

17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/unhandled-rejection.undefined.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 12 | 13 | 14 |

Unhandled rejection (undefined)

15 |

16 |   
17 | 
18 | 
19 | 


--------------------------------------------------------------------------------
/packages/build-plugins/tsconfig.base.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"compilerOptions": {
 3 | 		"allowJs": true,
 4 | 		"checkJs": false,
 5 | 		"forceConsistentCasingInFileNames": true,
 6 | 		"moduleResolution": "node",
 7 | 		"noEmitOnError": true,
 8 | 		"pretty": true,
 9 | 		"resolveJsonModule": true,
10 | 		"skipLibCheck": true,
11 | 		"target": "ES2017",
12 | 		"types": ["node"],
13 | 		"strict": true,
14 | 		"noImplicitAny": true,
15 | 		"allowSyntheticDefaultImports": true
16 | 	},
17 | 	"include": ["src/**/*.ts", "src/**/*.js"],
18 | 	"exclude": ["node_modules"]
19 | }
20 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/frustration-signals/rage-click.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 	
 4 | 		
 5 | 		Rage click
 6 | 
 7 | 		<%- renderAgent({
 8 | 			instrumentations: {
 9 | 				frustrationSignals: {
10 | 					rageClick: {
11 | 						count: 3,
12 | 						timeframeSeconds: 1,
13 | 						ignoreSelectors: ['#no-rage']
14 | 					}
15 | 				}
16 | 			}
17 | 		}) %>
18 | 	
19 | 	
20 | 		

Rage click

21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/mouse-document.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Event target 6 | <%- renderAgent() %> 7 | 8 | 9 | 10 |

Document target

11 | 12 | 13 | 14 |

15 |   
18 |   
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/examples/todolist/public/manifest.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"short_name": "React App",
 3 | 	"name": "Create React App Sample",
 4 | 	"icons": [
 5 | 		{
 6 | 			"src": "favicon.ico",
 7 | 			"sizes": "64x64 32x32 24x24 16x16",
 8 | 			"type": "image/x-icon"
 9 | 		},
10 | 		{
11 | 			"src": "logo192.png",
12 | 			"type": "image/png",
13 | 			"sizes": "192x192"
14 | 		},
15 | 		{
16 | 			"src": "logo512.png",
17 | 			"type": "image/png",
18 | 			"sizes": "512x512"
19 | 		}
20 | 	],
21 | 	"start_url": ".",
22 | 	"display": "standalone",
23 | 	"theme_color": "#000000",
24 | 	"background_color": "#ffffff"
25 | }
26 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/cdn/index.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	CDN test with an unhandled error
 6 | 
 7 | 	<%- renderAgent({}, false, null, 'latest' ) %>
 8 | 
 9 |   
15 | 
16 | 
17 |   

CDN test with an unhandled error

18 |

19 |   
20 | 
21 | 
22 | 


--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
 1 | artifacts/
 2 | dist/
 3 | build/
 4 | node_modules/
 5 | .idea/
 6 | .vscode/
 7 | .npm/
 8 | .nyc_output/
 9 | .DS_Store
10 | .rollup.cache/
11 | 
12 | # integration tests
13 | *.log
14 | tests_output/
15 | /.nightwatch_build_id
16 | /.http-mitm-proxy
17 | /html/
18 | 
19 | # contains secrets
20 | .env
21 | 
22 | .next
23 | 
24 | vitest-report
25 | __screenshots__
26 | 
27 | packages/build-plugins/html
28 | 
29 | test-results/
30 | playwright-report/
31 | blob-report/
32 | playwright/.cache/
33 | 
34 | .turbo
35 | 
36 | coverage
37 | 
38 | examples/electron/.webpack
39 | examples/electron/out
40 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/errors/views/module-error.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Errors test
 6 |   <%- renderAgent({}) %>
 7 |   
17 | 
18 | 
19 |   

Module error

20 |

21 |   
22 | 
23 | 
24 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/resource-observer/resources-postload-disabled.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Resource observer test
 6 |   <%- renderAgent({ instrumentations: { postload: false }}) %>
 7 | 
 8 | 
 9 |   

Resource observer test

10 | 11 | 12 | 13 |

14 |   
17 |   
18 | 
19 | 
20 | 


--------------------------------------------------------------------------------
/examples/nextjs/package.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"name": "@examples/next",
 3 | 	"private": true,
 4 | 	"scripts": {
 5 | 		"dev": "next dev",
 6 | 		"build": "next build",
 7 | 		"start": "next start",
 8 | 		"lint": "next lint",
 9 | 		"clean": "rm -rf .next .turbo"
10 | 	},
11 | 	"dependencies": {
12 | 		"next": "16.0.9",
13 | 		"react": "19.2.1",
14 | 		"react-dom": "19.2.1"
15 | 	},
16 | 	"devDependencies": {
17 | 		"@splunk/otel-web": "workspace:*",
18 | 		"@splunk/otel-web-session-recorder": "workspace:*",
19 | 		"@types/node": "24.10.1",
20 | 		"@types/react": "19.2.7",
21 | 		"@types/react-dom": "19.2.3",
22 | 		"typescript": "5.9.3"
23 | 	}
24 | }
25 | 


--------------------------------------------------------------------------------
/examples/nextjs/.gitignore:
--------------------------------------------------------------------------------
 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
 2 | 
 3 | # dependencies
 4 | /node_modules
 5 | /.pnp
 6 | .pnp.*
 7 | .yarn/*
 8 | !.yarn/patches
 9 | !.yarn/plugins
10 | !.yarn/releases
11 | !.yarn/versions
12 | 
13 | # testing
14 | /coverage
15 | 
16 | # next.js
17 | /.next/
18 | /out/
19 | 
20 | # production
21 | /build
22 | 
23 | # misc
24 | .DS_Store
25 | *.pem
26 | 
27 | # debug
28 | npm-debug.log*
29 | yarn-debug.log*
30 | yarn-error.log*
31 | .pnpm-debug.log*
32 | 
33 | # env file
34 | .env
35 | 
36 | # vercel
37 | .vercel
38 | 
39 | # typescript
40 | *.tsbuildinfo
41 | next-env.d.ts
42 | 


--------------------------------------------------------------------------------
/.github/workflows/check-links.yml:
--------------------------------------------------------------------------------
 1 | name: Check Links
 2 | 
 3 | on:
 4 |     push:
 5 |         branches: [main]
 6 |     pull_request:
 7 | 
 8 | jobs:
 9 |     linkChecker:
10 |         name: Link Checker
11 |         runs-on: ubuntu-latest
12 |         steps:
13 |             - uses: actions/checkout@v6.0.0
14 | 
15 |             - name: Link Checker
16 |               uses: lycheeverse/lychee-action@v2.7.0
17 |               with:
18 |                   fail: true
19 |                   args: "--verbose --no-progress './**/*.md' './**/*.html' --user-agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36'"
20 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/fetch/fetch.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	FETCH
 6 | 
 7 | 	<%- renderAgent({debug: true}) %>
 8 | 
 9 | 
10 | 	

FETCH

11 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/unhandled-error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 19 | 20 | 21 |

Unhandled error

22 |

23 |   
24 | 
25 | 
26 | 


--------------------------------------------------------------------------------
/examples/todolist/package.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"name": "@examples/todolist",
 3 | 	"private": true,
 4 | 	"type": "module",
 5 | 	"scripts": {
 6 | 		"backend": "node server/index.mjs",
 7 | 		"build": "rsbuild build",
 8 | 		"start": "rsbuild dev",
 9 | 		"clean": "rm -rf dist .turbo"
10 | 	},
11 | 	"devDependencies": {
12 | 		"@rsbuild/core": "^1.6.11",
13 | 		"@rsbuild/plugin-react": "^1.4.2",
14 | 		"@splunk/otel": "4.1.0",
15 | 		"@splunk/otel-web": "workspace:*",
16 | 		"@types/react": "^19.2.7",
17 | 		"@types/react-dom": "^19.2.3",
18 | 		"body-parser": "2.2.1",
19 | 		"cors": "2.8.5",
20 | 		"express": "5.2.1",
21 | 		"react": "19.2.1",
22 | 		"react-dom": "19.2.1"
23 | 	}
24 | }
25 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/context/fetch-then.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |   
 5 |   Fetch - then
 6 | 
 7 |   <%- renderAgent({
 8 |     context: {
 9 |       async: true
10 |     }
11 |   }) %>
12 | 
13 | 
14 |   

Fetch - then

15 | 16 | 17 | 18 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/messageport-cors-inner.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Iframe 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

Inner frame

15 | 16 |
17 | 18 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @signalfx/gdi-js-web-maintainers @signalfx/gdi-js-web-approvers @signalfx/gdi-js-maintainers @signalfx/gdi-js-approvers 2 | *.md @signalfx/gdi-docs @signalfx/gdi-js-web-maintainers @signalfx/gdi-js-web-approvers @signalfx/gdi-js-maintainers @signalfx/gdi-js-approvers 3 | *.rst @signalfx/gdi-docs @signalfx/gdi-js-web-maintainers @signalfx/gdi-js-web-approvers @signalfx/gdi-js-maintainers @signalfx/gdi-js-approvers 4 | docs/ @signalfx/gdi-docs @signalfx/gdi-js-web-maintainers @signalfx/gdi-js-web-approvers @signalfx/gdi-js-maintainers @signalfx/gdi-js-approvers 5 | README* @signalfx/gdi-docs @signalfx/gdi-js-web-maintainers @signalfx/gdi-js-web-approvers @signalfx/gdi-js-maintainers @signalfx/gdi-js-approvers 6 | -------------------------------------------------------------------------------- /examples/nextjs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "react-jsx", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/mouse-bubble.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mouse bubble test 6 | <%- renderAgent() %> 7 | 8 | 9 | 10 |

Mouse bubble test

11 | 12 |
13 | Text 14 |
15 | 16 |
17 | 18 |

19 |   
24 |   
25 | 
26 | 
27 | 


--------------------------------------------------------------------------------
/packages/web/src/filters/index.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export * from './node'
19 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/long-task/buffered.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Longtask tracking test
 6 |   
15 |   <%- renderAgent() %>
16 | 
17 | 
18 |   

Longtask tracking test

19 | 20 |

21 |   
22 | 
23 | 
24 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/user-interaction/forms.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Forms events test
 6 |   <%- renderAgent() %>
 7 |   
 8 | 
 9 | 
10 |   

Forms events test

11 | 12 |
13 | 14 |
15 | 16 |

17 |   
23 |   
24 | 
25 | 
26 | 


--------------------------------------------------------------------------------
/tests/servers/index.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export * from './socket-io'
19 | export * from './websocket'
20 | 


--------------------------------------------------------------------------------
/examples/installing-npm/src/app.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | console.log('installing-npm example works')
20 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/native/native.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |        
 5 |        Native
 6 |        
13 | 
14 |        <%- renderAgent({debug: true}) %>
15 | 
16 |        
22 | 
23 | 
24 |        

Native

25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/session-recorder/src/type-guards/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './primitive-types' 19 | -------------------------------------------------------------------------------- /examples/installing-npm/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import './instrumentation.js' 20 | import './app.js' 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/synthetics/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Splunk Synthetics integration 6 | 7 | 11 | <%- renderAgent() %> 12 | 13 | 14 |

Splunk Synthetics integration

15 |

16 |   
17 | 
18 |   
23 | 
24 | 
25 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/websocket/websocket-construct-errors.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Websocket
 6 | 
 7 | 	<%- renderAgent({instrumentations: {websocket: true}}) %>
 8 | 
 9 | 
10 | 	

Websocket construct errors

11 | 12 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /packages/web/src/otel-api-globals.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export { context, trace } from '@opentelemetry/api' 20 | -------------------------------------------------------------------------------- /packages/session-recorder/src/api/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './api-error' 19 | export * from './api-fetch' 20 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalDependencies": ["package.json", "pnpm-lock.yaml", "tsconfig.json", "eslint.config.js"], 4 | "tasks": { 5 | "build": { 6 | "cache": true, 7 | "dependsOn": ["clean", "^build"], 8 | "outputs": ["dist/**", ".next/**", "tests/project/dist/**"] 9 | }, 10 | "dev": { 11 | "cache": false, 12 | "persistent": true, 13 | "dependsOn": ["^wait"] 14 | }, 15 | "clean": { 16 | "cache": false 17 | }, 18 | "//#test:unit": { 19 | "cache": false, 20 | "dependsOn": ["@splunk/rum-build-plugins#build"] 21 | }, 22 | "test:e2e": { 23 | "cache": false, 24 | "dependsOn": ["^build"] 25 | }, 26 | "wait": { 27 | "cache": false 28 | } 29 | }, 30 | "ui": "tui" 31 | } 32 | -------------------------------------------------------------------------------- /packages/web/src/managers/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export * from './session-manager' 20 | export * from './storage' 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const variable = 1 19 | 20 | export default variable 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/resource-observer/assets/test-alt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | /* eslint-disable unicorn/no-empty-file */ 19 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/resource-observer/assets/test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | /* eslint-disable unicorn/no-empty-file */ 20 | -------------------------------------------------------------------------------- /packages/web/src/managers/storage/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export * from './constants' 20 | export * from './storage-manager' 21 | -------------------------------------------------------------------------------- /packages/web/src/types/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './config' 19 | export * from './type-guards' 20 | export * from './window' 21 | -------------------------------------------------------------------------------- /packages/web/src/types/type-guards/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './error' 19 | export * from './node' 20 | export * from './string' 21 | -------------------------------------------------------------------------------- /examples/nextjs/app/globals.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --background: #ffffff; 3 | --foreground: #171717; 4 | } 5 | 6 | @media (prefers-color-scheme: dark) { 7 | :root { 8 | --background: #0a0a0a; 9 | --foreground: #ededed; 10 | } 11 | } 12 | 13 | html, 14 | body { 15 | max-width: 100vw; 16 | overflow-x: hidden; 17 | } 18 | 19 | body { 20 | color: var(--foreground); 21 | background: var(--background); 22 | font-family: Arial, Helvetica, sans-serif; 23 | -webkit-font-smoothing: antialiased; 24 | -moz-osx-font-smoothing: grayscale; 25 | } 26 | 27 | * { 28 | box-sizing: border-box; 29 | padding: 0; 30 | margin: 0; 31 | } 32 | 33 | a { 34 | color: inherit; 35 | text-decoration: none; 36 | } 37 | 38 | @media (prefers-color-scheme: dark) { 39 | html { 40 | color-scheme: dark; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/todolist/README.md: -------------------------------------------------------------------------------- 1 | # Example todo application with a node.js backend 2 | 3 | This example todo application consists of React frontend app and express backend app. 4 | 5 | ## Try it yourself! 6 | 7 | After downloading this folder: 8 | 9 | 1. If you don't have one already [make a trial account to try out Splunk Observability Cloud](https://www.splunk.com/en_us/observability/o11y-cloud-free-trial.html) 10 | 2. Run `pnpm install` 11 | 3. Copy `.env.example` to `.env` 12 | 4. Fill out `PUBLIC_REACT_APP_RUM_*` with your ingest URL and RUM token 13 | 5. Start backend with `pnpm run backend` 14 | 6. Start frontend with `pnpm run start` 15 | 16 | Frontend instrumentation is done in `public/index.html` which is loaded at document load. It also demonstrates a few configuration options you can use. 17 | -------------------------------------------------------------------------------- /packages/web/src/utils/is-safari.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export const isSafari = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent) 20 | -------------------------------------------------------------------------------- /packages/web/src/version.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // this is an autogenerated file, see scripts/version-update.js 20 | export const VERSION = '1.2.0' 21 | -------------------------------------------------------------------------------- /packages/build-plugins/src/version.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // this is an autogenerated file, see scripts/version-update.js 20 | export const VERSION = '1.2.0' 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/console-error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 22 | 23 | 24 |

Manual console.error

25 |

26 |   
27 | 
28 | 
29 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/version.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | // this is an autogenerated file, see scripts/version-update.js
20 | export const VERSION = '1.2.0'
21 | 


--------------------------------------------------------------------------------
/packages/session-recorder/src/session-replay/index.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export * from './cdn-module'
19 | export * from './config'
20 | export * from './recorder'
21 | 


--------------------------------------------------------------------------------
/packages/session-recorder/src/version.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | // this is an autogenerated file, see scripts/version-update.js
20 | export const VERSION = '1.2.0'
21 | 


--------------------------------------------------------------------------------
/packages/web/src/utils/index.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export * from './detect-latest'
19 | export * from './text'
20 | export * from './traverse'
21 | export * from './url'
22 | 


--------------------------------------------------------------------------------
/packages/web/src/upstream/user-interaction/version.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | // this is autogenerated file, see scripts/version-update.js
20 | export const VERSION = '0.34.0'
21 | 


--------------------------------------------------------------------------------
/examples/todolist/server/instrumentation.js:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | import { start } from '@splunk/otel'
20 | 
21 | start({
22 | 	serviceName: 'RUM Todo Example Backend',
23 | })
24 | 


--------------------------------------------------------------------------------
/packages/web/src/managers/session-manager/index.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | export * from './constants'
20 | export * from './session-manager'
21 | export * from './session-state'
22 | 


--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"$schema": "https://json.schemastore.org/tsconfig",
 3 | 	"compilerOptions": {
 4 | 		"baseUrl": ".",
 5 | 		"moduleResolution": "NodeNext",
 6 | 		"noImplicitAny": true,
 7 | 		"module": "NodeNext",
 8 | 		"target": "esnext",
 9 | 		"inlineSourceMap": true,
10 | 		"inlineSources": true,
11 | 		"strict": true,
12 | 		"lib": ["ESNext", "DOM"],
13 | 		"declaration": true,
14 | 		"downlevelIteration": false,
15 | 		"skipLibCheck": true,
16 | 		"experimentalDecorators": true,
17 | 		"incremental": true,
18 | 		"noEmit": true,
19 | 		"allowJs": true,
20 | 		"esModuleInterop": true
21 | 	},
22 | 	"include": [
23 | 		"*.ts",
24 | 		"*.js",
25 | 		"*.cjs",
26 | 		".*.cjs",
27 | 		"*.mjs",
28 | 		"*.mts",
29 | 		"tests/**/*.ts",
30 | 		"scripts/**/*.ts",
31 | 		"scripts/**/*.mts"
32 | 	],
33 | 	"exclude": ["node_modules", "dist"]
34 | }
35 | 


--------------------------------------------------------------------------------
/examples/todolist/index.d.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import { SplunkRum } from '@splunk/otel-web'
19 | 
20 | declare global {
21 | 	interface Window {
22 | 		SplunkRum: typeof SplunkRum
23 | 	}
24 | }
25 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/docload/docload-all.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Test docload
 6 | 
 7 | 	<%- renderAgent({
 8 |     bufferTimeout: 200
 9 |   }) %>
10 |   
11 | 
12 | 
13 |   

Docload

14 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /packages/integration-tests/src/server/middlewares/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './delay-middleware' 19 | export * from './no-cache-middleware' 20 | export * from './server-timing-middleware' 21 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/minified-file-errors.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 8 | 9 |

Minified files with source map ids

10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.prettierrc.cjs: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | module.exports = { 19 | printWidth: 120, 20 | quoteProps: 'consistent', 21 | semi: false, 22 | singleQuote: true, 23 | trailingComma: 'all', 24 | useTabs: true, 25 | } 26 | -------------------------------------------------------------------------------- /examples/installing-npm/rsbuild.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { defineConfig } from '@rsbuild/core' 19 | 20 | export default defineConfig({ 21 | html: { 22 | template: './index.html', 23 | }, 24 | }) 25 | -------------------------------------------------------------------------------- /packages/session-recorder/src/log/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export { log } from './logger' 19 | export type { LogLevel, LogSource } from './types' 20 | 21 | export { createNamedLog, isLogLevel } from './utils' 22 | -------------------------------------------------------------------------------- /packages/web/src/managers/storage/providers/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export * from './base-storage-provider' 20 | export * from './cookie-storage-provider' 21 | export * from './local-storage-provider' 22 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/location-hash.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | location.hash 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

location.hash

15 | 16 | 17 | 18 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/web/src/types/type-guards/string.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export const hasToString = (val: unknown): val is { toString: () => string } => 19 | !!val && typeof (val as { toString?: unknown }).toString === 'function' 20 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/xhr-onload.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XHR - events 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

XHR - events

15 | 16 | 17 | 18 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/fetch/fetch-ignored.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ignore urls 6 | 7 | <%- renderAgent({}, true) %> 8 | 13 | 14 | 15 |

Ignore urls test

16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/websocket/websocket-send-errors.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Websocket 6 | 7 | <%- renderAgent({instrumentations: {websocket: true}}) %> 8 | 9 | 10 |

Websocket send errors

11 | 12 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.without-plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { getBaseConfig } = require('./webpack-utils') 19 | 20 | module.exports = { 21 | ...getBaseConfig(__filename), 22 | devtool: 'source-map', 23 | } 24 | -------------------------------------------------------------------------------- /scripts/utils/arguments.mts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export const getPositionalArguments = () => 19 | process.argv.filter( 20 | (arg, i) => 21 | // Skip the first two args (node and script), and any flags 22 | i >= 2 && !arg.startsWith('-'), 23 | ) 24 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/framework/vue2.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue 2 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 | 15 | 16 |

Vue 2

17 | 18 |
19 | 20 | 21 |
22 | 23 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/xhr/xhr-basic.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XHR 6 | 7 | <%- renderAgent() %> 8 | 9 | 10 |

XHR

11 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /packages/web/tests/utils/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export * from './init' 19 | export * from './memory-exporter' 20 | export * from './navigator' 21 | export * from './span' 22 | export * from './span-capturer' 23 | export * from './web-tracer-provider' 24 | -------------------------------------------------------------------------------- /packages/web/src/index-browser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { SplunkOtelWebType } from './index' 20 | 21 | declare global { 22 | interface Window { 23 | SplunkRum: SplunkOtelWebType | undefined 24 | } 25 | } 26 | 27 | export { default } from './index' 28 | -------------------------------------------------------------------------------- /packages/web/src/upstream/user-interaction/enums/attribute-names.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export enum AttributeNames { 20 | EVENT_TYPE = 'event_type', 21 | TARGET_ELEMENT = 'target_element', 22 | TARGET_XPATH = 'target_xpath', 23 | HTTP_URL = 'http.url', 24 | } 25 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/splunkrum-reporterror.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Errors test 6 | <%- renderAgent({}) %> 7 | 27 | 28 | 29 |

Manual console.error

30 |

31 |   
32 | 
33 | 
34 | 


--------------------------------------------------------------------------------
/packages/web/src/managers/storage/constants.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | import { SESSION_INACTIVITY_TIMEOUT_MS } from '../session-manager'
20 | 
21 | export const SESSION_STORAGE_KEY = '_splunk_rum_sid'
22 | export const SESSION_EXPIRATION_COOKIE_SEC = SESSION_INACTIVITY_TIMEOUT_MS / 1000
23 | 


--------------------------------------------------------------------------------
/packages/web/src/utils/url.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export const isExtensionUrl = (url: string): boolean =>
19 | 	['chrome-extension://', 'moz-extension://'].some((extensionPrefix) => url.startsWith(extensionPrefix))
20 | 
21 | export const isBlobUrl = (url: string) => url.startsWith('blob:')
22 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/resource-observer/resources-twice.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Resource observer test
 6 |   <%- renderAgent() %>
 7 | 
 8 | 
 9 |   

Resource observer test

10 | 11 | white 12 | 13 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | on: 3 | pull_request: 4 | types: [opened, synchronize] 5 | push: 6 | branches: [main] 7 | tags: [v*] 8 | 9 | permissions: read-all 10 | 11 | jobs: 12 | build: 13 | name: Build 14 | runs-on: ubuntu-latest 15 | permissions: read-all 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v6.0.0 19 | 20 | - name: Setup 21 | uses: ./.github/actions/setup 22 | 23 | - run: pnpm run version:check 24 | 25 | - name: Size check 26 | run: npm run size-limit 27 | 28 | - name: Lint code 29 | run: pnpm run lint 30 | 31 | - name: Lint docs 32 | run: pnpm run lint:markdown 33 | 34 | tests: 35 | name: Tests 36 | uses: ./.github/workflows/tests.yml 37 | secrets: inherit 38 | -------------------------------------------------------------------------------- /packages/web/src/upstream/user-interaction/internal-types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { HrTime } from '@opentelemetry/api' 20 | 21 | /** 22 | * interface to store information in weak map per span 23 | */ 24 | export interface SpanData { 25 | hrTimeLastTimeout?: HrTime 26 | taskCount: number 27 | } 28 | -------------------------------------------------------------------------------- /packages/web/tests/utils/web-tracer-provider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { SplunkWebTracerProvider } from '../../src/splunk-web-tracer-provider' 19 | 20 | export const createWebTracerProvider = (params?: ConstructorParameters[0]) => 21 | new SplunkWebTracerProvider(params) 22 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/resource-observer/resources-twice-no-cache.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Resource observer test 6 | <%- renderAgent() %> 7 | 8 | 9 |

Resource observer test

10 | 11 | white 12 | 13 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | _Replace this with a description of the PR. Explain the problem it solves and the proposed solution._ 4 | 5 | _List Github issue(s) which this PR fixes._ 6 | 7 | ## Type of change 8 | 9 | Delete options that are not relevant. 10 | 11 | - Bug fix (non-breaking change which fixes an issue) 12 | - New feature (non-breaking change which adds functionality) 13 | - Breaking change (fix or feature that would cause existing functionality to not work as expected) 14 | - Chore or internal change (changes not visible to the consumers of the package) 15 | - Documentation update 16 | 17 | # How has this been tested? 18 | 19 | Delete options that are not relevant. 20 | 21 | - Manual testing 22 | - Added unit tests 23 | - Added integration tests 24 | 25 | 32 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/long-task/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Longtask tracking test 6 | <%- renderAgent() %> 7 | 8 | 9 |

Longtask tracking test

10 | 11 | 12 | 13 |

14 |   
27 |   
28 | 
29 | 
30 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/context/framework/vue3.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |   
 5 |   Fetch - then
 6 | 
 7 |   <%- renderAgent({
 8 |     context: {
 9 |       async: true
10 |     }
11 |   }) %>
12 | 
13 |   
14 | 
15 | 
16 | 
17 |   

Vue 3

18 | 19 |
20 | 21 | 22 |
23 | 24 | 40 | 41 | -------------------------------------------------------------------------------- /packages/web/src/managers/session-manager/constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export const SESSION_ID_LENGTH = 32 19 | export const SESSION_DURATION_SECONDS = 4 * 60 * 60 // 4 hours 20 | export const SESSION_DURATION_MS = SESSION_DURATION_SECONDS * 1000 21 | export const SESSION_INACTIVITY_TIMEOUT_MS = 15 * 60 * 1000 // 15 minutes 22 | -------------------------------------------------------------------------------- /packages/web/src/synthetics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | declare global { 20 | interface Window { 21 | syntheticsRunId: string | undefined 22 | } 23 | } 24 | 25 | export const SYNTHETICS_RUN_ID_ATTRIBUTE = 'Synthetics-RunId' 26 | 27 | export function getSyntheticsRunId(): string | undefined { 28 | return window.syntheticsRunId 29 | } 30 | -------------------------------------------------------------------------------- /vitest.config.debug.mts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { defineConfig } from 'vitest/config' 19 | 20 | import config from './vitest.config.mjs' 21 | 22 | export default defineConfig({ 23 | test: { 24 | ...config.test, 25 | browser: { 26 | ...config.test?.browser, 27 | instances: [{ browser: 'chromium' }], 28 | }, 29 | }, 30 | }) 31 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/xhr-events.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XHR - events 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

XHR - events

15 | 16 | 17 | 18 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/electron/src/renderer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // IMPORTANT: Import instrumentation first, before any other imports 20 | // This ensures RUM agent is initialized before any user code runs 21 | import './instrumentation' 22 | import './index.css' 23 | 24 | console.log('👋 This message is being logged by "renderer.js", included via webpack') 25 | -------------------------------------------------------------------------------- /packages/web/src/types/type-guards/error.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export const isError = (maybeError: unknown): maybeError is Error => 19 | maybeError !== null && 20 | typeof maybeError === 'object' && 21 | (maybeError instanceof Error || 22 | maybeError.constructor.name?.endsWith('Error') || 23 | maybeError.constructor.name?.endsWith('Exception')) 24 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/fetch/fetch-post.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FETCH post 6 | 7 | <%- renderAgent({debug: true}) %> 8 | 9 | 10 |

FETCH post

11 | 12 |
13 | 14 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/webvitals/webvitals.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webvitals 6 | 7 | <%- renderAgent({debug: true}) %> 8 | 9 | 15 | 16 | 17 |

Webvitals

18 | 19 | 20 | Click me 21 | 22 |
Don't shift me : (
23 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/web/src/managers/session-manager/session-state.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export type SessionState = { 20 | expiresAt: number 21 | id: string 22 | startTime: number 23 | state: 'active' | 'native' | 'expired-inactivity' | 'expired-duration' 24 | } 25 | 26 | export type PersistedSessionState = Pick 27 | -------------------------------------------------------------------------------- /packages/web/src/utils/is-trusted-event.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export const isTrustedEvent = (eventToCheck: Event): boolean => { 20 | // Some old browsers do not have this property 21 | // See more at: 22 | // https://caniuse.com/?search=isTrusted 23 | if (eventToCheck.isTrusted === undefined) { 24 | return true 25 | } 26 | 27 | return eventToCheck.isTrusted 28 | } 29 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup' 2 | description: 'Checkout repository, setup node, install deps, build' 3 | runs: 4 | using: 'composite' 5 | steps: 6 | - name: Cache turbo build output 7 | uses: actions/cache@v4.2.3 8 | with: 9 | path: .turbo 10 | key: '${{ runner.os }}-turbo-${{ github.sha }}' 11 | restore-keys: | 12 | ${{ runner.os }}-turbo- 13 | 14 | - name: Install pnpm 15 | uses: pnpm/action-setup@v4.1.0 16 | with: 17 | version: 10.20.0 18 | 19 | - name: Setup 20 | uses: actions/setup-node@v4.3.0 21 | with: 22 | node-version: 24.11.0 23 | registry-url: 'https://registry.npmjs.org' 24 | cache: 'pnpm' 25 | 26 | - name: Install deps 27 | shell: bash 28 | run: pnpm install --frozen-lockfile 29 | 30 | - name: Build 31 | shell: bash 32 | run: pnpm run build 33 | -------------------------------------------------------------------------------- /examples/nextjs/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/src/other-entry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { otherHelperFunction, sharedHelperFunction } from './common/helpers' 19 | 20 | const result = sharedHelperFunction(1, 2) 21 | otherHelperFunction(result) 22 | 23 | window.globalFunctionFromOtherEntry = function () { 24 | console.log('executing function in other-entry.js', otherHelperFunction(5)) 25 | } 26 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/messageport-onmessage.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MessagePort - onmessage 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

MessagePort - onmessage

15 | 16 | 17 | 18 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/set-timeout.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | setTimeout 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

setTimeout

15 | 16 | 17 | 18 | 19 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/history.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | History events test 6 | <%- renderAgent() %> 7 | 8 | 9 | 10 |

History events test

11 | 12 | 13 | 14 | 15 | 16 |

17 |   
28 |   
29 | 
30 | 
31 | 


--------------------------------------------------------------------------------
/scripts/utils/index.mts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export * from './arguments.mjs'
19 | export * from './cf-invalidation.mjs'
20 | export * from './generate-release-links.mjs'
21 | export * from './generate-script-snippet.mjs'
22 | export * from './get-package-roots.mjs'
23 | export * from './github.mjs'
24 | export * from './mimetypes.mjs'
25 | export * from './upload-to-s3.mjs'
26 | export * from './versions.mjs'
27 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/user-interaction/mouse.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Mouse events test
 6 |   <%- renderAgent() %>
 7 |   
 8 | 
 9 | 
10 |   

Mouse events test

11 | 12 | 13 | 18 | 19 |

20 |   
29 |   
30 | 
31 | 
32 | 


--------------------------------------------------------------------------------
/packages/web/src/utils/iframe.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | export const safelyAccessFrameElementFromDocument = (documentNode: Document) => {
20 | 	let frameElement = null
21 | 	try {
22 | 		frameElement = documentNode.defaultView?.frameElement ?? null
23 | 	} catch {
24 | 		// Accessing frameElement from cross-origin iframe might throw Access Denied error in some browsers
25 | 	}
26 | 
27 | 	return frameElement
28 | }
29 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/context/messageport-addeventlistener.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |   
 5 |   MessagePort - addEventListener
 6 | 
 7 |   <%- renderAgent({
 8 |     context: {
 9 |       async: true
10 |     }
11 |   }) %>
12 | 
13 | 
14 |   

MessagePort - addEventListener

15 | 16 | 17 | 18 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/webvitals/webvitals-specific-disabled.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webvitals 6 | 7 | <%- renderAgent({debug: true, instrumentations: {webvitals: {lcp: false, cls: false}}}) %> 8 | 9 | 15 | 16 | 17 |

Webvitals

18 | 19 | 20 | Click me 21 | 22 |
Don't shift me : (
23 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.without-source-maps-options.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { SplunkRumWebpackPlugin } = require('@splunk/rum-build-plugins') 19 | 20 | const { getBaseConfig } = require('./webpack-utils') 21 | 22 | module.exports = { 23 | ...getBaseConfig(__filename), 24 | plugins: [ 25 | new SplunkRumWebpackPlugin({ 26 | applicationName: 'sample-app', 27 | version: '0.1.0', 28 | }), 29 | ], 30 | } 31 | -------------------------------------------------------------------------------- /packages/session-recorder/src/log/types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export type LogSource = 'console' | 'internal' 19 | 20 | export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'critical' 21 | 22 | export type MiddlewareFunction = (source: LogSource, level: LogLevel, message: string, ...data: unknown[]) => void 23 | 24 | export enum LogLevelNumber { 25 | DEBUG = 0, 26 | INFO = 1, 27 | WARN = 2, 28 | ERROR = 3, 29 | CRITICAL = 4, 30 | } 31 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/xhr/xhr-ignored.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ignore urls 6 | 7 | <%- renderAgent({}, true) %> 8 | 13 | 14 | 15 |

Ignore urls test

16 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/web/tests/utils/span.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { Span } from '@opentelemetry/api' 19 | 20 | import { createWebTracerProvider } from './web-tracer-provider' 21 | 22 | export const createSpan = (name: string) => { 23 | const webTracerProvider = createWebTracerProvider() 24 | const tracer = webTracerProvider.getTracer('test') 25 | const span = tracer.startSpan(name) 26 | 27 | return span as Span & { attributes: Record } 28 | } 29 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/socketio/socketio.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Socket.io 6 | 7 | <%- renderAgent({instrumentations: {socketio: true}}) %> 8 | 9 | 10 |

Socket.io

11 | 12 | 13 | 14 | 15 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/mouse-disabled.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mouse events test 6 | <%- renderAgent({ 7 | instrumentations: { 8 | interactions: { 9 | events: { 10 | click: false, 11 | mousedown: false, 12 | mouseup: false 13 | } 14 | } 15 | } 16 | }) %> 17 | 18 | 19 |

Mouse events test

20 | 21 | 22 | 23 | 24 |

25 |   
33 |   
34 | 
35 | 
36 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/socketio/socketio.before.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Socket.io
 6 | 
 7 |     
 8 | 	<%- renderAgent({instrumentations: {socketio: true}}) %>
 9 | 
10 | 
11 | 	

Socket.io

12 | 13 | 14 | 15 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack-utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const path = require('node:path') 19 | module.exports = { 20 | getBaseConfig: (configFilename) => ({ 21 | entry: { 22 | main: './src/index.js', 23 | other: './src/other-entry.js', 24 | }, 25 | mode: 'production', 26 | output: { 27 | filename: '[name].js', 28 | path: path.resolve(__dirname, 'dist/' + path.basename(configFilename).replaceAll('.', '-')), 29 | }, 30 | }), 31 | } 32 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/keyboard.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Keyboard events test 6 | <%- renderAgent({ 7 | instrumentations: { 8 | interactions: { 9 | events: { 10 | keydown: true, 11 | keyup: true 12 | } 13 | } 14 | } 15 | }) %> 16 | 17 | 18 |

Keyboard events test

19 |

20 | 
21 |   

22 |   
33 |   
34 | 
35 | 
36 | 


--------------------------------------------------------------------------------
/examples/todolist/rsbuild.config.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import { defineConfig } from '@rsbuild/core'
19 | import { pluginReact } from '@rsbuild/plugin-react'
20 | 
21 | export default defineConfig({
22 | 	html: {
23 | 		template: './public/index.html',
24 | 		templateParameters: {
25 | 			PUBLIC_REACT_APP_RUM_BEACON_URL: process.env.PUBLIC_REACT_APP_RUM_BEACON_URL,
26 | 			PUBLIC_REACT_APP_RUM_TOKEN: process.env.PUBLIC_REACT_APP_RUM_TOKEN,
27 | 		},
28 | 	},
29 | 	plugins: [pluginReact()],
30 | })
31 | 


--------------------------------------------------------------------------------
/examples/todolist/src/index.tsx:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | import { StrictMode } from 'react'
20 | import { createRoot } from 'react-dom/client'
21 | 
22 | import App from './app'
23 | 
24 | const container = document.querySelector('#root')
25 | 
26 | if (!container) {
27 | 	throw new Error('No container element found')
28 | }
29 | 
30 | const root = createRoot(container) // createRoot(container!) if you use TypeScript
31 | root.render(
32 | 	
33 | 		
34 | 	,
35 | )
36 | 


--------------------------------------------------------------------------------
/packages/build-plugins/tests/project/src/common/helpers.js:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export function sharedHelperFunction(value1, value2) {
19 | 	const result = value1 + value2
20 | 	return result
21 | }
22 | 
23 | export function sharedHelperFunctionThatThrowsError() {
24 | 	/* eslint-disable no-undef */
25 | 	return thisFunctionDoesNotExist()
26 | }
27 | 
28 | // eslint-disable-next-line unicorn/prefer-native-coercion-functions
29 | export function otherHelperFunction(value) {
30 | 	return String(value)
31 | }
32 | 


--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
 1 | version: 2
 2 | 
 3 | updates:
 4 |     - package-ecosystem: 'npm'
 5 |       directory: '/'
 6 |       schedule:
 7 |           interval: 'monthly'
 8 |       open-pull-requests-limit: 10
 9 |       groups:
10 |           size-limit:
11 |               patterns:
12 |                   - '@size-limit/*'
13 |                   - 'size-limit*'
14 |           playwright:
15 |               patterns:
16 |                   - '@playwright/*'
17 |                   - 'playwright*'
18 |           eslint:
19 |               patterns:
20 |                   - '@eslint/*'
21 |                   - '*eslint*'
22 |           vitest:
23 |               patterns:
24 |                   - '@vitest/*'
25 |                   - 'vitest*'
26 |           react:
27 |               patterns:
28 |                   - 'react'
29 |                   - 'react-dom'
30 |           opentelemetry:
31 |               patterns:
32 |                   - '@opentelemetry/*'
33 |           rsbuild:
34 |               patterns:
35 |                   - '@rsbuild/*'
36 | 
37 |     - package-ecosystem: 'github-actions'
38 |       directory: '/'
39 |       schedule:
40 |           interval: 'monthly'
41 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/context/mutation-observer-textnode.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |   
 5 |   Mutation Observer - textNode
 6 | 
 7 |   <%- renderAgent({
 8 |     context: {
 9 |       async: true
10 |     }
11 |   }) %>
12 | 
13 | 
14 |   

Mutation Observer - textNode

15 | 16 | 17 | 18 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /packages/session-recorder/src/session-replay/config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { mergeRecorderConfig } from './migrations/config-merge' 19 | import { migrateRRWebConfigToSplunkConfig } from './migrations/config-migration' 20 | import { RecorderPublicConfig } from './recorder' 21 | 22 | export const getSplunkRecorderConfig = (config: RecorderPublicConfig): RecorderPublicConfig => { 23 | const migratedRRWebConfig = migrateRRWebConfigToSplunkConfig(config) 24 | return mergeRecorderConfig(config, migratedRRWebConfig) 25 | } 26 | -------------------------------------------------------------------------------- /packages/web/tests/utils.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { describe, expect, it } from 'vitest' 20 | 21 | import { generateId } from '../src/utils' 22 | 23 | describe('generateId', () => { 24 | it('should generate IDs of 64 and 128 bits', () => { 25 | const id64 = generateId(64) 26 | const id128 = generateId(128) 27 | expect(id64.length).toBe(16) 28 | expect(id128.length).toBe(32) 29 | expect(id64.match('^[0-9a-z]+$')).toBeTruthy() 30 | expect(id128.match('^[0-9a-z]+$')).toBeTruthy() 31 | }) 32 | }) 33 | -------------------------------------------------------------------------------- /examples/electron/webpack.renderer.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import type { Configuration } from 'webpack' 19 | 20 | import { plugins } from './webpack.plugins' 21 | import { rules } from './webpack.rules' 22 | 23 | rules.push({ 24 | test: /\.css$/, 25 | use: [{ loader: 'style-loader' }, { loader: 'css-loader' }], 26 | }) 27 | 28 | export const rendererConfig: Configuration = { 29 | module: { 30 | rules, 31 | }, 32 | plugins, 33 | resolve: { 34 | extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'], 35 | }, 36 | } 37 | -------------------------------------------------------------------------------- /examples/electron/webpack.plugins.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import Dotenv from 'dotenv-webpack' 19 | import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin' 20 | const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') 21 | 22 | export const plugins = [ 23 | new ForkTsCheckerWebpackPlugin({ 24 | logger: 'webpack-infrastructure', 25 | }), 26 | new Dotenv({ 27 | defaults: false, 28 | path: '.env', 29 | safe: false, 30 | silent: false, 31 | }), 32 | ] 33 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/xhr-events-removed.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XHR - events 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

XHR - events

15 | 16 | 17 | 18 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /packages/web/src/utils/detect-latest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { isScriptElement } from '../types' 19 | 20 | export const isAgentLoadedViaLatestTag = () => { 21 | let isLatestTagUsed = false 22 | try { 23 | if (document.currentScript && isScriptElement(document.currentScript)) { 24 | const src = document.currentScript.src 25 | // Check for "latest" version in CDN URL 26 | isLatestTagUsed = /\/o11y-gdi-rum\/latest\//i.test(src) 27 | } 28 | } catch { 29 | // ignore 30 | } 31 | 32 | return isLatestTagUsed 33 | } 34 | -------------------------------------------------------------------------------- /tests/servers/socket-io.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { Server } from 'socket.io' 19 | 20 | export const initSocketIo = () => { 21 | const io = new Server({ 22 | cors: { 23 | origin: true, 24 | }, 25 | }) 26 | 27 | io.on('connection', (socket) => { 28 | socket.on('hello', () => { 29 | // Does nothing 30 | }) 31 | 32 | socket.on('ping', (...args) => { 33 | socket.emit('pong', ...args) 34 | }) 35 | }) 36 | 37 | io.listen(8980) 38 | 39 | return () => new Promise((resolve) => io.close(() => resolve())) 40 | } 41 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.no-source-maps.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { SplunkRumWebpackPlugin } = require('@splunk/rum-build-plugins') 19 | 20 | const { getBaseConfig } = require('./webpack-utils') 21 | 22 | module.exports = { 23 | ...getBaseConfig(__filename), 24 | plugins: [ 25 | new SplunkRumWebpackPlugin({ 26 | applicationName: 'sample-app', 27 | sourceMaps: { 28 | disableUpload: true, 29 | realm: 'us0', 30 | token: '', 31 | }, 32 | version: '0.1.0', 33 | }), 34 | ], 35 | } 36 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/messageport-cors.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MessagePort Iframe 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 |

MessagePort Iframe

15 | 16 | 17 | 18 |
19 | 20 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/init/attributes.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test init 6 | 7 | <%- renderAgent({applicationName:'custom-app', deploymentEnvironment: 'custom-environment', globalAttributes: {'key1': 'value1', 'key2': 'value2'}}) %> 8 | 9 | 10 |

Attributes

11 | 12 | 32 | changeAttributes 33 | resetAttributes 34 | 35 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/websocket/websocket-ignored.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Websocket 6 | 7 | <%- renderAgent({instrumentations: {websocket: true}}, true) %> 8 | 9 | 14 | 15 | 19 | 20 | 21 |

Websocket

22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/web/src/utils/parse-version.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export function parseVersion(version: string): { 20 | exactVersion: string 21 | majorVersion: string 22 | minorVersion: string 23 | } { 24 | // Remove prerelease tags like -beta.0, -alpha.5, -rc.1, etc. 25 | const cleanVersion = version.split('-')[0] 26 | const versionParts = cleanVersion.split('.') 27 | 28 | return { 29 | exactVersion: `v${cleanVersion}`, 30 | majorVersion: `v${versionParts[0]}`, 31 | minorVersion: `v${versionParts[0]}.${versionParts[1]}`, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/script1.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | document.querySelector('#button1').addEventListener('click', function () { 20 | throw new Error('Error from script1.js') 21 | }) 22 | window.sourceMapIds = window.sourceMapIds || {} 23 | let s = '' 24 | try { 25 | throw new Error('error') 26 | } catch (error) { 27 | s = (error.stack.match(/https?:\/\/[^\s]+?(?::\d+)?(?=:[\d]+:[\d]+)/) || [])[0] 28 | } 29 | if (s) { 30 | window.sourceMapIds[s] = '9663c60664c425cef3b141c167e9b324240ce10ae488726293892b7130266a6b' 31 | } 32 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/errors/views/script2.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | document.querySelector('#button2').addEventListener('click', function () { 20 | throw new Error('Error from script2.js') 21 | }) 22 | window.sourceMapIds = window.sourceMapIds || {} 23 | let s = '' 24 | try { 25 | throw new Error('error') 26 | } catch (error) { 27 | s = (error.stack.match(/https?:\/\/[^\s]+?(?::\d+)?(?=:[\d]+:[\d]+)/) || [])[0] 28 | } 29 | if (s) { 30 | window.sourceMapIds[s] = '9793573cdc2ab308a0b1996bea14253ec8832bc036210475ded0813cafa27066' 31 | } 32 | -------------------------------------------------------------------------------- /.size-limit.cjs: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | module.exports = [ 19 | { 20 | limit: '3 kB', 21 | name: 'artifacts/otel-api-globals.js', 22 | path: './packages/web/dist/artifacts/otel-api-globals.js', 23 | }, 24 | 25 | { 26 | limit: '81 kB', 27 | name: 'artifacts/splunk-otel-web.js', 28 | path: './packages/web/dist/artifacts/splunk-otel-web.js', 29 | }, 30 | 31 | { 32 | limit: '109 kB', 33 | name: 'artifacts/splunk-otel-web-session-recorder.js', 34 | path: './packages/session-recorder/dist/artifacts/splunk-otel-web-session-recorder.js', 35 | }, 36 | ] 37 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.devtool.eval.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { SplunkRumWebpackPlugin } = require('@splunk/rum-build-plugins') 19 | 20 | const { getBaseConfig } = require('./webpack-utils') 21 | 22 | module.exports = { 23 | ...getBaseConfig(__filename), 24 | devtool: 'eval', 25 | plugins: [ 26 | new SplunkRumWebpackPlugin({ 27 | applicationName: 'sample-app', 28 | sourceMaps: { 29 | disableUpload: true, 30 | realm: 'us0', 31 | token: '', 32 | }, 33 | version: '0.1.0', 34 | }), 35 | ], 36 | } 37 | -------------------------------------------------------------------------------- /packages/session-recorder/src/detect-latest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { isScriptElement } from './type-guards' 19 | 20 | export const isRecorderLoadedViaLatestTag = () => { 21 | let isLatestTagUsed = false 22 | try { 23 | if (document.currentScript && isScriptElement(document.currentScript)) { 24 | const src = document.currentScript.src 25 | // Check for "latest" version in CDN URL for session recorder 26 | isLatestTagUsed = /\/o11y-gdi-rum\/latest\//i.test(src) 27 | } 28 | } catch { 29 | // ignore 30 | } 31 | 32 | return isLatestTagUsed 33 | } 34 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.devtool.source-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { SplunkRumWebpackPlugin } = require('@splunk/rum-build-plugins') 19 | 20 | const { getBaseConfig } = require('./webpack-utils') 21 | 22 | module.exports = { 23 | ...getBaseConfig(__filename), 24 | devtool: 'source-map', 25 | plugins: [ 26 | new SplunkRumWebpackPlugin({ 27 | applicationName: 'sample-app', 28 | sourceMaps: { 29 | disableUpload: true, 30 | realm: 'us0', 31 | token: '', 32 | }, 33 | version: '0.1.0', 34 | }), 35 | ], 36 | } 37 | -------------------------------------------------------------------------------- /examples/todolist/src/app.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { useEffect } from 'react' 20 | 21 | import { TodoList } from './todo-list' 22 | 23 | function App() { 24 | useEffect(() => { 25 | const interval = setInterval(() => { 26 | void fetch(process.env.PUBLIC_REACT_APP_BACKEND + '/ping') 27 | }, 60_000) 28 | 29 | return () => { 30 | clearInterval(interval) 31 | } 32 | }) 33 | 34 | return ( 35 |
36 |

Great Todo App!

37 | 38 |
39 | ) 40 | } 41 | 42 | export default App 43 | -------------------------------------------------------------------------------- /packages/integration-tests/src/server/middlewares/no-cache-middleware.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { FastifyReply, FastifyRequest } from 'fastify' 20 | 21 | export const noCacheMiddleware = ( 22 | req: FastifyRequest<{ Querystring: { noCache?: string } }>, 23 | reply: FastifyReply, 24 | payload: unknown, 25 | done: (err?: Error) => void, 26 | ) => { 27 | if (typeof req.query.noCache === 'string') { 28 | reply.header('Cache-Control', 'no-store, max-age=0') 29 | reply.removeHeader('Etag') 30 | reply.removeHeader('Last-Modified') 31 | } 32 | 33 | done() 34 | } 35 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { sharedHelperFunction, sharedHelperFunctionThatThrowsError } from './common/helpers' 19 | 20 | function globalFunction() { 21 | const value1 = 1 22 | const value2 = 2 23 | console.log('running index.js of the build-plugins sample project', sharedHelperFunction(value1, value2)) 24 | } 25 | 26 | function globalFunctionThatThrowsError() { 27 | sharedHelperFunctionThatThrowsError() 28 | } 29 | 30 | window.globalFunction = globalFunction 31 | window.globalFunctionThatThrowsError = globalFunctionThatThrowsError 32 | -------------------------------------------------------------------------------- /packages/build-plugins/tests/project/webpack.config.devtool.hidden-source-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | const { SplunkRumWebpackPlugin } = require('@splunk/rum-build-plugins') 19 | 20 | const { getBaseConfig } = require('./webpack-utils') 21 | 22 | module.exports = { 23 | ...getBaseConfig(__filename), 24 | devtool: 'hidden-source-map', 25 | plugins: [ 26 | new SplunkRumWebpackPlugin({ 27 | applicationName: 'sample-app', 28 | sourceMaps: { 29 | disableUpload: true, 30 | realm: 'us0', 31 | token: '', 32 | }, 33 | version: '0.1.0', 34 | }), 35 | ], 36 | } 37 | -------------------------------------------------------------------------------- /packages/web/src/utils/hash.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | export async function hashSHA256(key: string): Promise { 20 | if (typeof crypto === 'undefined' || !crypto.subtle || !crypto.subtle.digest) { 21 | return null 22 | } 23 | 24 | try { 25 | const encoder = new TextEncoder() 26 | const data = encoder.encode(key) 27 | const hashBuffer = await crypto.subtle.digest('SHA-256', data) 28 | const hashArray = Array.from(new Uint8Array(hashBuffer)) 29 | return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('') 30 | } catch { 31 | return null 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/integration-tests/src/server/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | // dummy function that just takes template literals and return them back without any modification 19 | // the reason behind this is to imitate behaviour of css/html in js so the IDE properly highlights syntax 20 | const dummyTemplate = (strings: TemplateStringsArray, ...keys: string[]): string => { 21 | const result = [strings[0]] 22 | keys.forEach(function (key, i) { 23 | result.push(key, strings[i + 1]) 24 | }) 25 | return result.join('') 26 | } 27 | 28 | export const css = dummyTemplate 29 | export const html = dummyTemplate 30 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/user-interaction/causality.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mouse events test 6 | 7 | <%- renderAgent({ 8 | instrumentations: { 9 | webvitals: false 10 | } 11 | }) %> 12 | 13 | 14 |

Mouse events test

15 | 16 | 17 | 18 |

19 |   
35 |   
36 | 
37 | 
38 | 


--------------------------------------------------------------------------------
/packages/web/tests/utils/span-capturer.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | import { ReadableSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base'
20 | 
21 | export class SpanCapturer implements SpanProcessor {
22 | 	public readonly spans: ReadableSpan[] = []
23 | 
24 | 	clear(): void {
25 | 		this.spans.length = 0
26 | 	}
27 | 
28 | 	forceFlush(): Promise {
29 | 		return Promise.resolve()
30 | 	}
31 | 
32 | 	onEnd(span: ReadableSpan): void {
33 | 		this.spans.push(span)
34 | 	}
35 | 
36 | 	onStart(): void {}
37 | 
38 | 	shutdown(): Promise {
39 | 		return Promise.resolve()
40 | 	}
41 | }
42 | 


--------------------------------------------------------------------------------
/scripts/utils/mimetypes.mts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | 
19 | const mimetypes: Record = {
20 | 	'.html': 'text/html',
21 | 	'.js': 'application/javascript',
22 | 	'.js.map': 'application/octet-stream',
23 | 	'.tgz': 'application/x-gtar',
24 | 	'.txt': 'text/plain',
25 | }
26 | 
27 | export const getMimeType = (filename: string) => {
28 | 	const sortedExtensions = Object.keys(mimetypes).toSorted((a, b) => b.length - a.length)
29 | 	for (const ext of sortedExtensions) {
30 | 		if (filename.endsWith(ext)) {
31 | 			return mimetypes[ext]
32 | 		}
33 | 	}
34 | 	return 'application/octet-stream'
35 | }
36 | 


--------------------------------------------------------------------------------
/.github/workflows/cla.yml:
--------------------------------------------------------------------------------
 1 | name: 'CLA Assistant'
 2 | on:
 3 |     issue_comment:
 4 |         types: [created]
 5 |     pull_request_target:
 6 |         types: [opened, closed, synchronize]
 7 | 
 8 | permissions:
 9 |     actions: write
10 |     contents: read
11 |     pull-requests: write
12 |     statuses: write
13 | 
14 | jobs:
15 |     ContributorLicenseAgreement:
16 |         runs-on: ubuntu-latest
17 |         steps:
18 |             - name: 'CLA Assistant'
19 |               if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
20 |               uses: cla-assistant/github-action@v2.6.1
21 |               env:
22 |                   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 |                   PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_CLATOOL }}
24 |               with:
25 |                   remote-organization-name: splunk
26 |                   remote-repository-name: cla-agreement
27 |                   branch: main
28 |                   path-to-signatures: signatures/version1/cla.json
29 |                   path-to-document: https://github.com/splunk/cla-agreement/blob/main/CLA.md
30 |                   allowlist: dependabot[bot]
31 | 


--------------------------------------------------------------------------------
/examples/installing-npm/src/instrumentation.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import SplunkOtelWeb from '@splunk/otel-web'
19 | 
20 | SplunkOtelWeb.init({
21 | 	allowInsecureBeacon: true,
22 | 	applicationName: 'splunk-otel-web-example-npm',
23 | 	beaconEndpoint: 'http://localhost:9101/api/v2/spans',
24 | 	debug: true,
25 | 
26 | 	// uncomment to start sending to Splunk RUM backend
27 | 	// beaconEndpoint: 'https://rum-ingest.signalfx.com/api/v2/spans',
28 | 
29 | 	// get the token by going to https://app.signalfx.com/#/organization/current?selectedKeyValue=sf_section:accesstokens
30 | 	rumAccessToken: 'ABC123...789',
31 | })
32 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/redacting-attributes/index.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 |   
 5 |   Redacting attributes with exporter.onAttributesSerializing
 6 |   <%- renderAgent({}, true) %>
 7 |   
18 | 
19 | 
20 |   

Redacting attributes with exporter.onAttributesSerializing

21 |

22 | Please note that redaction is applied right before sending the data. 23 | Debug span preview in DevTools is not affected. 24 |

25 | 26 | 27 | 28 |

29 |   
32 |   
33 | 
34 | 
35 | 


--------------------------------------------------------------------------------
/examples/electron/webpack.main.config.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import type { Configuration } from 'webpack'
19 | 
20 | import { plugins } from './webpack.plugins'
21 | import { rules } from './webpack.rules'
22 | 
23 | export const mainConfig: Configuration = {
24 | 	/**
25 | 	 * This is the main entry point for your application, it's the first file
26 | 	 * that runs in the main process.
27 | 	 */
28 | 	entry: './src/index.ts',
29 | 	// Put your normal webpack config below here
30 | 	module: {
31 | 		rules,
32 | 	},
33 | 	plugins,
34 | 	resolve: {
35 | 		extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
36 | 	},
37 | }
38 | 


--------------------------------------------------------------------------------
/tests/global-setup.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import { initSocketIo, initWebSocketServer } from './servers'
19 | 
20 | let teardown = false
21 | let isRunning = false
22 | 
23 | export default function globalSetup() {
24 | 	if (isRunning) {
25 | 		return
26 | 	}
27 | 
28 | 	const closeSocketIoServer = initSocketIo()
29 | 	const closeWebSocketServer = initWebSocketServer()
30 | 
31 | 	isRunning = true
32 | 
33 | 	return async () => {
34 | 		if (teardown) {
35 | 			throw new Error('teardown called twice')
36 | 		}
37 | 
38 | 		teardown = true
39 | 
40 | 		await Promise.all([closeSocketIoServer(), closeWebSocketServer()])
41 | 	}
42 | }
43 | 


--------------------------------------------------------------------------------
/packages/web/tests/utils/memory-exporter.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import { SplunkZipkinExporter, ZipkinSpan } from '../../src/exporters/zipkin'
19 | 
20 | export const buildInMemorySplunkExporter = () => {
21 | 	const spans: ZipkinSpan[] = []
22 | 	const exporter = new SplunkZipkinExporter({
23 | 		beaconSender: () => {},
24 | 		url: '',
25 | 		xhrSender: (_, data) => {
26 | 			if (typeof data === 'string') {
27 | 				const newSpans = JSON.parse(data) as ZipkinSpan[]
28 | 				spans.splice(spans.length, 0, ...newSpans)
29 | 			}
30 | 		},
31 | 	})
32 | 
33 | 	return {
34 | 		exporter,
35 | 		getFinishedSpans: () => spans,
36 | 	}
37 | }
38 | 


--------------------------------------------------------------------------------
/scripts/utils/generate-script-snippet.mts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | export const generateScriptSnippet = ({
19 | 	filename,
20 | 	integrityValue,
21 | 	isVersionImmutable,
22 | 	publicUrl,
23 | }: {
24 | 	filename: string
25 | 	integrityValue: string
26 | 	isVersionImmutable: boolean
27 | 	publicUrl: string
28 | }) => {
29 | 	const lines = [`${filename}:`]
30 | 
31 | 	if (isVersionImmutable) {
32 | 		lines.push(``)
33 | 	} else {
34 | 		lines.push(``)
35 | 	}
36 | 
37 | 	return lines.join('\n')
38 | }
39 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/server/middlewares/delay-middleware.ts:
--------------------------------------------------------------------------------
 1 | /**
 2 |  *
 3 |  * Copyright 2020-2025 Splunk Inc.
 4 |  *
 5 |  * Licensed under the Apache License, Version 2.0 (the "License");
 6 |  * you may not use this file except in compliance with the License.
 7 |  * You may obtain a copy of the License at
 8 |  *
 9 |  * https://www.apache.org/licenses/LICENSE-2.0
10 |  *
11 |  * Unless required by applicable law or agreed to in writing, software
12 |  * distributed under the License is distributed on an "AS IS" BASIS,
13 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  * See the License for the specific language governing permissions and
15 |  * limitations under the License.
16 |  *
17 |  */
18 | import { FastifyRequest } from 'fastify'
19 | 
20 | const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
21 | 
22 | export const delayMiddleware = async (
23 | 	request: FastifyRequest<{
24 | 		Querystring: {
25 | 			delay?: string
26 | 		}
27 | 	}>,
28 | ) => {
29 | 	const delayParam = request.query?.delay
30 | 
31 | 	if (delayParam) {
32 | 		const delay = Number.parseInt(delayParam, 10)
33 | 		if (!Number.isNaN(delay) && delay > 0) {
34 | 			request.log.info(`Delaying request for ${delay}ms`)
35 | 			await sleep(delay)
36 | 		}
37 | 	}
38 | }
39 | 


--------------------------------------------------------------------------------
/packages/integration-tests/src/tests/websocket/websocket.ejs:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	Websocket
 6 | 
 7 | 	<%- renderAgent({instrumentations: {websocket: true}}) %>
 8 | 
 9 | 
10 | 	

Websocket

11 | 12 | 13 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/integration-tests/src/utils/test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { test as base } from '@playwright/test' 20 | 21 | import { RecordPage } from '../pages/record-page' 22 | 23 | type TestFixtures = { 24 | recordPage: RecordPage 25 | } 26 | 27 | export const test = base.extend({ 28 | recordPage: async ({ browser }, use) => { 29 | const recordingContext = await browser.newContext({ viewport: { height: 1080, width: 1920 } }) 30 | const recordPage = new RecordPage(await recordingContext.newPage(), recordingContext) 31 | await recordPage.mockNetwork() 32 | 33 | await use(recordPage) 34 | 35 | await recordingContext.close() 36 | }, 37 | }) 38 | -------------------------------------------------------------------------------- /packages/web/src/utils/observable.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { diag } from '@opentelemetry/api' 19 | 20 | export class Observable { 21 | private observers: Array<(data: T) => void> = [] 22 | 23 | notify(data: T) { 24 | this.observers.forEach((observer) => { 25 | try { 26 | observer(data) 27 | } catch (error) { 28 | diag.error('Observable: Error happened in subscriber', error) 29 | } 30 | }) 31 | } 32 | 33 | subscribe(f: (data: T) => void) { 34 | this.observers.push(f) 35 | 36 | return () => { 37 | const index = this.observers.indexOf(f) 38 | if (index !== -1) { 39 | this.observers.splice(index, 1) 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/servers/websocket.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import WebSocket, { WebSocketServer } from 'ws' 19 | 20 | export const initWebSocketServer = () => { 21 | const wsServer = new WebSocketServer({ 22 | port: 8979, 23 | }) 24 | 25 | wsServer.on('connection', (cx: WebSocket) => { 26 | cx.on('message', (msg: WebSocket.Data) => { 27 | // allow client to terminate the connection from the server to expand unit testing possibilities 28 | if (msg === 'close') { 29 | console.log('closing ws connection') 30 | cx.close() 31 | } 32 | 33 | cx.send('Response') 34 | }) 35 | }) 36 | 37 | return () => new Promise((resolve) => wsServer.close(() => resolve())) 38 | } 39 | -------------------------------------------------------------------------------- /examples/electron/src/preload.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | /** 20 | * Preload Script 21 | * 22 | * This script runs in an ISOLATED context (when contextIsolation is enabled). 23 | * It has access to Node.js APIs but runs in a separate JavaScript context 24 | * from the renderer process. 25 | * 26 | * IMPORTANT: DO NOT initialize Splunk RUM here! 27 | * - RUM must run in the actual renderer context (renderer.ts) 28 | * - Initializing RUM here would instrument the wrong context 29 | * - Your app would remain uninstrumented 30 | */ 31 | 32 | // Preload script content goes here 33 | // Currently empty as no Node.js APIs need to be exposed 34 | console.log('Preload script loaded') 35 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/websocket/websocket-sub-protocol.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Websocket 6 | 7 | <%- renderAgent({instrumentations: {websocket: true}}) %> 8 | 9 | 10 |

Websocket sub protocol

11 | 12 | 13 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /scripts/utils/get-package-roots.mts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { accessSync, readdirSync } from 'node:fs' 19 | import path from 'node:path' 20 | 21 | export const getPackageRoots = () => { 22 | const appRoot = process.cwd() 23 | const packagesDir = path.resolve(appRoot, 'packages') 24 | 25 | return readdirSync(packagesDir, { withFileTypes: true }) 26 | .filter((dirent) => { 27 | if (!dirent.isDirectory()) { 28 | return false 29 | } 30 | 31 | try { 32 | accessSync(path.resolve(packagesDir, dirent.name, 'package.json')) 33 | return true 34 | } catch { 35 | return false 36 | } 37 | }) 38 | .map((dirent) => path.resolve(packagesDir, dirent.name)) 39 | } 40 | -------------------------------------------------------------------------------- /scripts/utils/cf-invalidation.mts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { CloudFrontClient, CreateInvalidationCommand } from '@aws-sdk/client-cloudfront' 19 | 20 | const cfClient = new CloudFrontClient({ region: process.env.AWS_REGION ?? 'us-east-1' }) 21 | 22 | export const invalidateCloudFrontFiles = async (distributionId: string, invalidationRef: string) => { 23 | const { Invalidation } = await cfClient.send( 24 | new CreateInvalidationCommand({ 25 | DistributionId: distributionId, 26 | InvalidationBatch: { 27 | CallerReference: invalidationRef, 28 | Paths: { 29 | Items: ['/o11y-gdi-rum/*'], 30 | Quantity: 1, 31 | }, 32 | }, 33 | }), 34 | ) 35 | return Invalidation 36 | } 37 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/native/native.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { expect } from '@playwright/test' 19 | 20 | import { test } from '../../utils/test' 21 | 22 | test.describe('native', () => { 23 | test('native session id integration', async ({ recordPage }) => { 24 | await recordPage.goTo('/native/native.ejs') 25 | 26 | await recordPage.waitForSpans((spans) => spans.some((s) => s.name === 'documentFetch')) 27 | const receivedSpans = recordPage.receivedSpans 28 | 29 | expect( 30 | receivedSpans.every((span) => span.tags['splunk.rumSessionId'] === '12341234123412341234123412341234'), 31 | ).toBe(true) 32 | expect(recordPage.receivedErrorSpans).toHaveLength(0) 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /examples/nextjs/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/session-recorder/src/type-guards/primitive-types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | export const isString = (maybeString: unknown): maybeString is string => typeof maybeString === 'string' 19 | 20 | export function isObject(obj: unknown): obj is object { 21 | return typeof obj == 'object' && !Array.isArray(obj) && obj !== null 22 | } 23 | 24 | export function isNumber(value: unknown): value is number { 25 | return typeof value == 'number' 26 | } 27 | 28 | export function isBoolean(value: unknown): value is boolean { 29 | return typeof value == 'boolean' 30 | } 31 | 32 | export const isScriptElement = (maybeScriptElement: Node): maybeScriptElement is HTMLScriptElement => 33 | maybeScriptElement.nodeName === 'SCRIPT' 34 | -------------------------------------------------------------------------------- /examples/nextjs/instrumentation-client.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import SplunkOtelWeb from '@splunk/otel-web' 19 | import SplunkSessionRecorder from '@splunk/otel-web-session-recorder' 20 | 21 | SplunkOtelWeb.init({ 22 | applicationName: process.env.NEXT_PUBLIC_SPLUNK_RUM_APPLICATION_NAME, 23 | beaconEndpoint: process.env.NEXT_PUBLIC_SPLUNK_RUM_BEACON_ENDPOINT, 24 | deploymentEnvironment: process.env.NEXT_PUBLIC_SPLUNK_RUM_DEPLOYMENT_ENVIROMENT, 25 | rumAccessToken: process.env.NEXT_PUBLIC_SPLUNK_RUM_ACCESS_TOKEN, 26 | }) 27 | 28 | SplunkSessionRecorder.init({ 29 | beaconEndpoint: process.env.NEXT_PUBLIC_SPLUNK_RUM_SESSION_REPLAY_BEACON_ENDPOINT, 30 | rumAccessToken: process.env.NEXT_PUBLIC_SPLUNK_RUM_ACCESS_TOKEN, 31 | }) 32 | -------------------------------------------------------------------------------- /packages/integration-tests/src/server/middlewares/server-timing-middleware.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { FastifyReply, FastifyRequest } from 'fastify' 19 | 20 | import { setServerTimingHeader } from '../server-timing' 21 | 22 | export const serverTimingMiddleware = ( 23 | req: FastifyRequest<{ Querystring: { serverTiming?: string } }>, 24 | reply: FastifyReply, 25 | payload: unknown, 26 | done: (err?: Error) => void, 27 | ) => { 28 | if (req.url.includes('no-server-timings')) { 29 | done() 30 | return 31 | } 32 | 33 | if (typeof req.query.serverTiming === 'string') { 34 | reply.header('Server-Timing', req.query.serverTiming) 35 | } else { 36 | setServerTimingHeader(reply) 37 | } 38 | 39 | done() 40 | } 41 | -------------------------------------------------------------------------------- /packages/integration-tests/src/server/server-timing.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { FastifyReply } from 'fastify' 19 | 20 | const generateHex = (length: number) => 21 | [...Array.from({ length }).keys()].map(() => Math.floor(Math.random() * 16).toString(16)).join('') 22 | 23 | export const generateServerTiming = () => { 24 | const traceId = generateHex(32) 25 | const spanId = generateHex(16) 26 | const formatted = `traceparent;desc="00-${traceId}-${spanId}-01"` 27 | return { 28 | header: formatted, 29 | spanId, 30 | traceId, 31 | } 32 | } 33 | 34 | export const setServerTimingHeader = (reply: FastifyReply, serverTiming = generateServerTiming()) => { 35 | reply.header('Server-Timing', serverTiming.header) 36 | } 37 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/redacting-attributes/index.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { expect } from '@playwright/test' 19 | 20 | import { test } from '../../utils/test' 21 | 22 | test.describe('redacting-attributes', () => { 23 | test('with custom exporter', async ({ recordPage }) => { 24 | await recordPage.goTo('/redacting-attributes/index.ejs') 25 | 26 | await recordPage.locator('#btnClick').click() 27 | 28 | await recordPage.waitForSpans((spans) => spans.some((s) => s.name === 'click')) 29 | const receivedSpans = recordPage.receivedSpans 30 | const clickSpans = receivedSpans.filter((span) => span.name === 'click') 31 | 32 | expect(clickSpans.every((s) => s.tags['http.url'] === '[redacted]')) 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /packages/web/src/splunk-web-tracer-provider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | import { context, propagation, trace } from '@opentelemetry/api' 20 | import { WebTracerProvider as BaseWebTracerProvider } from '@opentelemetry/sdk-trace-web' 21 | 22 | export class SplunkWebTracerProvider extends BaseWebTracerProvider { 23 | shutdown(): Promise { 24 | return new Promise((resolve) => { 25 | // TODO: upstream 26 | // note: BasicTracerProvider registers the propagator given to it in config 27 | // if the global propagator is the same as the one we registered, then we should deregister it 28 | propagation.disable() 29 | context.disable() 30 | trace.disable() 31 | resolve() 32 | }).then(() => super.shutdown()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /scripts/utils/upload-to-s3.mts: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2020-2025 Splunk Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3' 19 | 20 | const s3Client = new S3Client({ region: process.env.AWS_REGION ?? 'us-east-1' }) 21 | 22 | export const uploadToS3 = ({ 23 | bucketName, 24 | buffer, 25 | contentType, 26 | isImmutable, 27 | key, 28 | }: { 29 | bucketName: string 30 | buffer: Uint8Array 31 | contentType: string 32 | isImmutable: boolean 33 | key: string 34 | }) => 35 | s3Client.send( 36 | new PutObjectCommand({ 37 | ACL: 'public-read', 38 | Body: buffer, 39 | Bucket: bucketName, 40 | CacheControl: isImmutable ? 'public, max-age=31536000, immutable' : 'max-age=3600', 41 | ContentType: contentType, 42 | Key: `cdn/${key}`, 43 | }), 44 | ) 45 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/framework/react-16.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | React 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 | 15 | 16 | 17 | 18 |

React

19 |
20 | 21 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /packages/integration-tests/src/tests/context/framework/react-latest.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | React 6 | 7 | <%- renderAgent({ 8 | context: { 9 | async: true 10 | } 11 | }) %> 12 | 13 | 14 | 15 | 16 | 17 | 18 |

React

19 |
20 | 21 | 53 | 54 | 55 | 56 | 57 | 58 | --------------------------------------------------------------------------------