Skip to content

Commit 8d830e1

Browse files
BenoitZugmeyerrgaignault
authored andcommitted
🔉 report missing configuration options (#3832)
* update rum-events-schema * report missing configuration options as telemetry
1 parent 35e2f8b commit 8d830e1

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

‎packages/rum-core/src/domain/configuration/configuration.spec.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -595,22 +595,23 @@ describe('serializeRumConfiguration', () => {
595595
remoteConfigurationProxy: 'config',
596596
plugins: [{ name: 'foo', getConfigurationTelemetry: () => ({ bar: true }) }],
597597
trackFeatureFlagsForEvents: ['vital'],
598-
profilingSampleRate: 0,
598+
profilingSampleRate: 42,
599599
propagateTraceBaggage: true,
600600
}
601601

602602
type MapRumInitConfigurationKey<Key extends string> = Key extends keyof InitConfiguration
603603
? MapInitConfigurationKey<Key>
604-
: Key extends 'workerUrl' | 'allowedTracingUrls' | 'excludedActivityUrls' | 'allowedGraphQlUrls'
604+
: Key extends
605+
| 'workerUrl'
606+
| 'allowedTracingUrls'
607+
| 'excludedActivityUrls'
608+
| 'remoteConfigurationProxy'
609+
| 'allowedGraphQlUrls'
605610
? `use_${CamelToSnakeCase<Key>}`
606611
: Key extends 'trackLongTasks'
607612
? 'track_long_task' // oops
608-
: Key extends
609-
| 'applicationId'
610-
| 'subdomain'
611-
| 'remoteConfigurationProxy'
612-
| 'profilingSampleRate'
613-
| 'propagateTraceBaggage'
613+
: // The following options are not reported as telemetry. Please avoid adding more of them.
614+
Key extends 'applicationId' | 'subdomain'
614615
? never
615616
: CamelToSnakeCase<Key>
616617
// By specifying the type here, we can ensure that serializeConfiguration is returning an
@@ -626,6 +627,7 @@ describe('serializeRumConfiguration', () => {
626627
session_replay_sample_rate: 60,
627628
trace_sample_rate: 50,
628629
trace_context_injection: TraceContextInjection.ALL,
630+
propagate_trace_baggage: true,
629631
use_allowed_tracing_urls: true,
630632
use_allowed_graph_ql_urls: true,
631633
use_track_graph_ql_payload: false,
@@ -645,6 +647,8 @@ describe('serializeRumConfiguration', () => {
645647
plugins: [{ name: 'foo', bar: true }],
646648
track_feature_flags_for_events: ['vital'],
647649
remote_configuration_id: '123',
650+
use_remote_configuration_proxy: true,
651+
profiling_sample_rate: 42,
648652
})
649653
})
650654
})

‎packages/rum-core/src/domain/configuration/configuration.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) {
440440
start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,
441441
trace_sample_rate: configuration.traceSampleRate,
442442
trace_context_injection: configuration.traceContextInjection,
443+
propagate_trace_baggage: configuration.propagateTraceBaggage,
443444
action_name_attribute: configuration.actionNameAttribute,
444445
use_allowed_tracing_urls: isNonEmptyArray(configuration.allowedTracingUrls),
445446
use_allowed_graph_ql_urls: isNonEmptyArray(configuration.allowedGraphQlUrls),
@@ -468,6 +469,8 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) {
468469
})),
469470
track_feature_flags_for_events: configuration.trackFeatureFlagsForEvents,
470471
remote_configuration_id: configuration.remoteConfigurationId,
472+
profiling_sample_rate: configuration.profilingSampleRate,
473+
use_remote_configuration_proxy: !!configuration.remoteConfigurationProxy,
471474
...baseSerializedConfiguration,
472475
} satisfies RawTelemetryConfiguration
473476
}

0 commit comments

Comments
 (0)