Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ describe('serializeRumConfiguration', () => {
trackLongTasks: true,
remoteConfigurationId: '123',
remoteConfiguration: { id: '123', sync: false },
remoteConfigurationProxy: 'config',
plugins: [{ name: 'foo', getConfigurationTelemetry: () => ({ bar: true }) }],
trackFeatureFlagsForEvents: ['vital'],
profilingSampleRate: 42,
Expand All @@ -840,7 +839,6 @@ describe('serializeRumConfiguration', () => {
| 'workerUrl'
| 'allowedTracingUrls'
| 'excludedActivityUrls'
| 'remoteConfigurationProxy'
| 'allowedGraphQlUrls'
? `use_${CamelToSnakeCase<Key>}`
: Key extends 'trackLongTasks'
Expand Down Expand Up @@ -884,7 +882,6 @@ describe('serializeRumConfiguration', () => {
plugins: [{ name: 'foo', bar: true }],
track_feature_flags_for_events: ['vital'],
remote_configuration_id: '123',
use_remote_configuration_proxy: true,
profiling_sample_rate: 42,
track_resource_headers: 'default_headers',
})
Expand Down
8 changes: 0 additions & 8 deletions packages/rum-core/src/domain/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ export interface RumInitConfiguration extends InitConfiguration {
*/
remoteConfiguration?: { id: string; sync?: boolean; required?: boolean } | undefined

/**
* [Internal option] set a proxy URL for the remote configuration
*
* @internal
*/
remoteConfigurationProxy?: string | undefined

// tracing options
/**
* A list of request URLs used to inject tracing headers.
Expand Down Expand Up @@ -683,7 +676,6 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) {
track_feature_flags_for_events: configuration.trackFeatureFlagsForEvents,
remote_configuration_id: getRemoteConfigurationId(configuration),
profiling_sample_rate: configuration.profilingSampleRate,
use_remote_configuration_proxy: !!configuration.remoteConfigurationProxy,
track_resource_headers: getTrackResourceHeadersTelemetryValue(configuration.trackResourceHeaders),
...baseSerializedConfiguration,
} satisfies RawTelemetryConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,13 @@ describe('remoteConfiguration', () => {
)
})

it('should return the remote configuration proxy', () => {
expect(buildEndpoint({ remoteConfigurationProxy: '/config' } as RumInitConfiguration)).toEqual('/config')
it('should use the proxy when configured', () => {
const remoteConfigurationId = '0e008b1b-8600-4709-9d1d-f4edcfdf5587'
expect(
buildEndpoint({ proxy: 'https://proxy.io/config', remoteConfigurationId } as RumInitConfiguration)
).toEqual(
`https://proxy.io/config?ddforward=${encodeURIComponent(`/v1/${remoteConfigurationId}.json`)}&ddforwardSubdomain=sdk-configuration`
)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,9 @@ export function getRemoteConfigurationId(configuration: RumInitConfiguration): s
}

export function buildEndpoint(configuration: RumInitConfiguration) {
if (configuration.remoteConfigurationProxy) {
return configuration.remoteConfigurationProxy
}
const id = getRemoteConfigurationId(configuration)!
return buildEndpointUrl({
proxy: configuration.proxy,
site: configuration.site,
path: `/${REMOTE_CONFIGURATION_VERSION}/${encodeURIComponent(id)}.json`,
subdomain: 'sdk-configuration',
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/lib/framework/createTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function declareTest(title: string, setupOptions: SetupOptions, factory: SetupFa
const browserLogs = new BrowserLogsManager()

const testContext = createTestContext(servers, page, context, browserLogs, browserName, baseUrl.href)
servers.intake.bindServerApp(createIntakeServerApp(testContext.intakeRegistry))
servers.intake.bindServerApp(createIntakeServerApp(testContext.intakeRegistry, setupOptions.remoteConfiguration))

const setup = factory(setupOptions, servers)
servers.base.bindServerApp(createMockServerApp(servers, setup, setupOptions))
Expand Down
1 change: 0 additions & 1 deletion test/e2e/lib/framework/pageSetups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ export function formatConfiguration(
{
...initConfiguration,
proxy: servers.intake.origin,
remoteConfigurationProxy: `${servers.base.origin}/config`,
},
(_key, value) => {
if (isJsonIncompatibleValue(value)) {
Expand Down
10 changes: 7 additions & 3 deletions test/e2e/lib/framework/serverApps/intake.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import express from 'express'
import cors from 'cors'
import type { RemoteConfiguration } from '@datadog/browser-rum-core'
import { createIntakeProxyMiddleware } from '../intakeProxyMiddleware.ts'
import type { IntakeRegistry } from '../intakeRegistry'

export function createIntakeServerApp(intakeRegistry: IntakeRegistry) {
export function createIntakeServerApp(intakeRegistry: IntakeRegistry, remoteConfiguration?: RemoteConfiguration) {
const app = express()
let debuggerProbes: object[] = []

app.use(cors())

app.post('/', createIntakeProxyMiddleware({ onRequest: (request) => intakeRegistry.push(request) }))

// Quota admission check — always admit in the test environment.
// Triggered via proxy-as-string with ddforwardSubdomain=quota.
app.get('/', (req, res) => {
// Quota admission check — always admit in the test environment.
// Triggered via proxy-as-string with ddforwardSubdomain=quota.
if (req.query.ddforwardSubdomain === 'quota') {
res.json({ data: { id: 'test', type: 'profiling-quota', attributes: { admitted: true, reason: 'quota_ok' } } })
} else if (req.query.ddforwardSubdomain === 'sdk-configuration') {
// Remote configuration fetch — proxied via ddforwardSubdomain=sdk-configuration.
res.send(JSON.stringify(remoteConfiguration))
} else {
res.status(404).end()
}
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/lib/framework/serverApps/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { workerSetup } from '../pageSetups'
export const LARGE_RESPONSE_MIN_BYTE_SIZE = 100_000

export function createMockServerApp(servers: Servers, setup: string, setupOptions?: SetupOptions): MockServerApp {
const { remoteConfiguration, worker } = setupOptions ?? {}
const { worker } = setupOptions ?? {}
const app = express()
let largeResponseBytesWritten = 0

Expand Down Expand Up @@ -227,10 +227,6 @@ export function createMockServerApp(servers: Servers, setup: string, setupOption
res.sendFile(getTestAppBundlePath('microfrontend', filePath))
})

app.get('/config', (_req, res) => {
res.send(JSON.stringify(remoteConfiguration))
})

return Object.assign(app, {
getLargeResponseWroteSize() {
return largeResponseBytesWritten
Expand Down
Loading