-
Notifications
You must be signed in to change notification settings - Fork 188
✨[RUM-14826] Add source code context to feature operations #4297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,12 +35,8 @@ export interface VitalOptions { | |
| * Duration vital options | ||
| */ | ||
|
|
||
| export interface DurationVitalOptions extends VitalOptions { | ||
| /** | ||
| * Handling stack (internal use only) | ||
| */ | ||
| handlingStack?: string | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export interface DurationVitalOptions extends VitalOptions {} | ||
|
|
||
| export interface FeatureOperationOptions extends VitalOptions { | ||
| operationKey?: string | ||
|
|
@@ -121,14 +117,14 @@ export function startVitalCollection( | |
| function addOperationStepVital( | ||
| name: string, | ||
| stepType: 'start' | 'end', | ||
| options?: FeatureOperationOptions, | ||
| options?: FeatureOperationOptions & { handlingStack?: string }, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn’t add handlingStack to FeatureOperationOptions because FeatureOperationOptions is publicly exposed.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe not in the scope of this PR but we should probably remove it from other public options.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'll make a followup pr |
||
| failureReason?: FailureReason | ||
| ) { | ||
| if (!isExperimentalFeatureEnabled(ExperimentalFeature.FEATURE_OPERATION_VITAL)) { | ||
| return | ||
| } | ||
|
|
||
| const { operationKey, context, description } = options || {} | ||
| const { operationKey, context, description, handlingStack } = options || {} | ||
|
|
||
| const vital: OperationStepVital = { | ||
| name, | ||
|
|
@@ -139,14 +135,15 @@ export function startVitalCollection( | |
| startClocks: clocksNow(), | ||
| context: sanitize(context), | ||
| description, | ||
| handlingStack, | ||
| } | ||
| lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processVital(vital)) | ||
| } | ||
|
|
||
| return { | ||
| addOperationStepVital, | ||
| addDurationVital, | ||
| startDurationVital: (name: string, options: DurationVitalOptions = {}) => { | ||
| startDurationVital: (name: string, options: DurationVitalOptions & { handlingStack?: string } = {}) => { | ||
| const ref = startDurationVital(customVitalsState, name, options) | ||
| const vitalState = customVitalsState.vitalsByReference.get(ref) | ||
| if (vitalState) { | ||
|
|
@@ -163,7 +160,7 @@ export function startVitalCollection( | |
| export function startDurationVital( | ||
| { vitalsByName, vitalsByReference }: CustomVitalsState, | ||
| name: string, | ||
| options: DurationVitalOptions = {} | ||
| options: DurationVitalOptions & { handlingStack?: string } = {} | ||
| ) { | ||
| const vital = { | ||
| id: generateUUID(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startFeatureOperation()now enriches only thestartstep withhandlingStack, butsucceedFeatureOperation()/failFeatureOperation()still calladdOperationStepVital(..., 'end', options)without it. Because source-code context resolution readsdomainContext.handlingStackto set per-eventservice/version(packages/rum-core/src/domain/contexts/sourceCodeContext.ts), end-step vital events from microfrontend code paths will not be enriched and will fall back to default attribution, producing inconsistent metadata within the same feature operation.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature operation event is reduced in the backend with the start and end events. It keeps the start handlingStack event which is what we want.