Skip to content

Commit

Permalink
use signalfx cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
potty committed Jan 31, 2025
1 parent 55015f0 commit d71ce35
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/session-recorder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type { SplunkOtelWebType } from '@splunk/otel-web'
import { loadRecorderBrowserScript } from './session-replay/load'
import { getSessionReplayPlainGlobal } from './session-replay/utils'
import { SessionReplayPlain as SessionReplayPlainType } from './session-replay/types'
import { SESSION_REPLAY_BACKGROUND_SERVICE_URL } from './session-replay/constants'

interface BasicTracerProvider extends TracerProvider {
readonly resource: Resource
Expand Down Expand Up @@ -159,7 +160,7 @@ const SplunkRumRecorder = {

sessionReplay = new SessionReplayPlain({
features: {
backgroundServiceSrc: 'https://domain.com/web/latest/background-service.html',
backgroundServiceSrc: SESSION_REPLAY_BACKGROUND_SERVICE_URL,
cacheAssets: false,
iframes: false,
imageBitmap: false,
Expand Down
23 changes: 23 additions & 0 deletions packages/session-recorder/src/session-replay/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
*
* Copyright 2020-2025 Splunk Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const SESSION_REPLAY_VERSION_TAG = 'v1.30.0'
const SESSION_REPLAY_CDN_BASE_URL = `https://cdn.signalfx.com/o11y-gdi-rum/session-replay/${SESSION_REPLAY_VERSION_TAG}`

export const SESSION_REPLAY_BROWSER_SCRIPT_URL = `${SESSION_REPLAY_CDN_BASE_URL}/session-replay.browser.min.js`
export const SESSION_REPLAY_BROWSER_LEGACY_SCRIPT_URL = `${SESSION_REPLAY_CDN_BASE_URL}/session-replay.browser.legacy.min.js`
export const SESSION_REPLAY_BACKGROUND_SERVICE_URL = `${SESSION_REPLAY_CDN_BASE_URL}/background-service.html`
5 changes: 3 additions & 2 deletions packages/session-recorder/src/session-replay/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
*
*/
import { isRequiredAPISupported } from './required-api-check.js'
import { SESSION_REPLAY_BROWSER_SCRIPT_URL, SESSION_REPLAY_BROWSER_LEGACY_SCRIPT_URL } from './constants'

export const loadRecorderBrowserScript = async () => {
const recorderScriptUrl: string = isRequiredAPISupported()
? 'https://domain.com/web/latest/session-replay.browser.min.js'
: 'https://domain.com/web/latest/session-replay.browser.legacy.min.js'
? SESSION_REPLAY_BROWSER_SCRIPT_URL
: SESSION_REPLAY_BROWSER_LEGACY_SCRIPT_URL

// const currentScript = document.currentScript as HTMLScriptElement | null
// if (currentScript) {
Expand Down

0 comments on commit d71ce35

Please sign in to comment.