Skip to content
Merged
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
1 change: 0 additions & 1 deletion packages/core/src/tools/experimentalFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { objectHasValue } from './utils/objectUtils'
// eslint-disable-next-line no-restricted-syntax
export enum ExperimentalFeature {
TRACK_INTAKE_REQUESTS = 'track_intake_requests',
FEATURE_OPERATION_VITAL = 'feature_operation_vital',
TOO_MANY_REQUESTS_INVESTIGATION = 'too_many_requests_investigation',
SESSION_RENEWAL_DEBUG_CONTEXT = 'session_renewal_debug_context',
}
Expand Down
34 changes: 22 additions & 12 deletions packages/rum-core/src/boot/rumPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,33 +517,43 @@ export interface RumPublicApi extends PublicApi {
stopDurationVital: (name: string, options?: DurationVitalOptions) => void

/**
* start a feature operation
* Start a feature operation.
*
* Call {@link succeedFeatureOperation} or {@link failFeatureOperation} with the same name (and optional
* `operationKey`) to send a RUM vital event marking the end of the operation.
*
* @category Vital - Feature Operation
* @param name - Name of the operation step
* @param options - Options for the operation step (operationKey, context, description)
* @hidden // TODO: replace by @since when GA
* @param name - Name of the operation
* @param options - Options for the operation (operationKey, context, description)
* @example
* ```ts
* datadogRum.startFeatureOperation('checkout')
* // ... perform the operation
* datadogRum.succeedFeatureOperation('checkout')
* ```
*/
startFeatureOperation: (name: string, options?: FeatureOperationOptions) => void

/**
* succeed a feature operation
* Mark a feature operation as successful.
*
* Sends a RUM vital event marking the end of the operation started with {@link startFeatureOperation}.
*
* @category Vital - Feature Operation
* @param name - Name of the operation step
* @param options - Options for the operation step (operationKey, context, description)
* @hidden // TODO: replace by @since when GA
* @param name - Name of the operation
* @param options - Options for the operation (operationKey, context, description)
*/
succeedFeatureOperation: (name: string, options?: FeatureOperationOptions) => void

/**
* fail a feature operation
* Mark a feature operation as failed.
*
* Sends a RUM vital event marking the end of the operation started with {@link startFeatureOperation}.
*
* @category Vital - Feature Operation
* @param name - Name of the operation step
* @param name - Name of the operation
* @param failureReason - Reason for the failure
* @param options - Options for the operation step (operationKey, context, description)
* @hidden // TODO: replace by @since when GA
* @param options - Options for the operation (operationKey, context, description)
*/
failFeatureOperation: (name: string, failureReason: FailureReason, options?: FeatureOperationOptions) => void

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Duration } from '@datadog/browser-core'
import { mockClock, type Clock } from '@datadog/browser-core/test'
import { addExperimentalFeatures, clocksNow, ExperimentalFeature, generateUUID } from '@datadog/browser-core'
import { clocksNow, generateUUID } from '@datadog/browser-core'
import { collectAndValidateRawRumEvents, mockPageStateHistory } from '../../../test'
import type { RawRumEvent, RawRumVitalEvent } from '../../rawRumEvent.types'
import { VitalType, RumEventType } from '../../rawRumEvent.types'
Expand Down Expand Up @@ -221,7 +221,6 @@ describe('vitalCollection', () => {

describe('operation step vital', () => {
it('should collect raw rum event from operation step vital', () => {
addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL])
vitalCollection.addOperationStepVital('foo', 'start')

expect(rawRumEvents[0].startClocks.relative).toEqual(jasmine.any(Number))
Expand All @@ -243,7 +242,6 @@ describe('vitalCollection', () => {
})

it('should create operation step vital with handling stack in domainContext', () => {
addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL])
vitalCollection.addOperationStepVital('foo', 'start', {
handlingStack: 'Error\n at foo\n at bar',
})
Expand All @@ -254,7 +252,6 @@ describe('vitalCollection', () => {
})

it('should create a operation step vital from add API', () => {
addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL])
vitalCollection.addOperationStepVital(
'foo',
'end',
Expand Down
13 changes: 1 addition & 12 deletions packages/rum-core/src/domain/vital/vitalCollection.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import type { ClocksState, Duration } from '@datadog/browser-core'
import {
clocksNow,
ExperimentalFeature,
generateUUID,
isExperimentalFeatureEnabled,
sanitize,
toServerDuration,
} from '@datadog/browser-core'
import { clocksNow, generateUUID, sanitize, toServerDuration } from '@datadog/browser-core'
import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle'
import { LifeCycleEventType } from '../lifeCycle'
import type { RawRumVitalEvent } from '../../rawRumEvent.types'
Expand Down Expand Up @@ -113,10 +106,6 @@ export function startVitalCollection(lifeCycle: LifeCycle, pageStateHistory: Pag
options?: FeatureOperationOptions & { handlingStack?: string },
failureReason?: FailureReason
) {
if (!isExperimentalFeatureEnabled(ExperimentalFeature.FEATURE_OPERATION_VITAL)) {
return
}

const { operationKey, context, description, handlingStack } = options || {}

const vital: OperationStepVital = {
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/scenario/microfrontend.scenario.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { RumEvent, RumEventDomainContext, RumInitConfiguration } from '@datadog/browser-rum-core'
import type { LogsEvent, LogsInitConfiguration, LogsEventDomainContext } from '@datadog/browser-logs'
import { test, expect } from '@playwright/test'
import { ExperimentalFeature } from '@datadog/browser-core'
import { createTest, microfrontendSetup } from '../lib/framework'
import { isLongAnimationFrameSupported } from '../lib/helpers/browser'

Expand Down Expand Up @@ -184,7 +183,7 @@ test.describe('microfrontend', () => {
})

createTest('expose handling stack for DD_RUM.startFeatureOperation')
.withRum({ ...RUM_CONFIG, enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL] })
.withRum({ ...RUM_CONFIG })
.withRumInit((configuration) => {
window.DD_RUM!.init(configuration)

Expand Down Expand Up @@ -412,7 +411,7 @@ test.describe('microfrontend', () => {
})

createTest('feature operations should have service and version from source code context')
.withRum({ ...RUM_CONFIG, enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL] })
.withRum({ ...RUM_CONFIG })
.withSetup(microfrontendSetup)
.run(async ({ intakeRegistry, flushEvents, page }) => {
await page.click('#app1-feature-operation')
Expand Down
5 changes: 1 addition & 4 deletions test/e2e/scenario/rum/vitals.scenario.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { test, expect } from '@playwright/test'
import { ExperimentalFeature } from '@datadog/browser-core'
import { createTest } from '../../lib/framework'

test.describe('vital collection', () => {
Expand Down Expand Up @@ -46,9 +45,7 @@ test.describe('vital collection', () => {
})

createTest('send operation step vital')
.withRum({
enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL],
})
.withRum()
.run(async ({ flushEvents, intakeRegistry, page }) => {
await page.evaluate(() => {
window.DD_RUM!.startFeatureOperation('foo')
Expand Down
Loading