Skip to content

Commit

Permalink
Integrate 95f7dc6 (#2609) from bcaudan/vital-name into staging-07
Browse files Browse the repository at this point in the history
Co-authored-by: Bastien Caudan <bastien.caudan@datadoghq.com>
  • Loading branch information
dd-mergequeue[bot] and bcaudan committed Feb 16, 2024
2 parents 94b068e + 95f7dc6 commit d09adb8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/rum-core/src/domain/vital/vitalCollection.spec.ts
Expand Up @@ -134,6 +134,7 @@ describe('vitalCollection', () => {
vital: {
id: jasmine.any(String),
type: VitalType.DURATION,
name: 'foo',
custom: {
foo: 0,
},
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/src/domain/vital/vitalCollection.ts
Expand Up @@ -56,6 +56,7 @@ function processVital(vital: DurationVital): RawRumEventCollectedData<RawRumVita
vital: {
id: generateUUID(),
type: vital.type,
name: vital.name,
custom: {
[vital.name]: vital.value,
},
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/src/rawRumEvent.types.ts
Expand Up @@ -221,6 +221,7 @@ export interface RawRumVitalEvent {
type: RumEventType.VITAL
vital: {
id: string
name: string
type: VitalType
custom: {
[key: string]: number
Expand Down
17 changes: 15 additions & 2 deletions packages/rum-core/src/rumEvent.types.ts
Expand Up @@ -231,7 +231,16 @@ export type RumErrorEvent = CommonProperties &
/**
* Source type of the error (the language or platform impacting the error stacktrace format)
*/
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native' | 'flutter' | 'roku'
readonly source_type?:
| 'android'
| 'browser'
| 'ios'
| 'react-native'
| 'flutter'
| 'roku'
| 'ndk'
| 'ios+il2cpp'
| 'ndk+il2cpp'
/**
* Resource properties of the error
*/
Expand Down Expand Up @@ -1012,7 +1021,11 @@ export type RumVitalEvent = CommonProperties &
*/
readonly id: string
/**
* User custom vital. As vital name is used as facet path, it must contain only letters, digits, or the characters - _ . @ $
* Name of the vital, as it is also used as facet path for its value, it must contain only letters, digits, or the characters - _ . @ $
*/
readonly name?: string
/**
* User custom vital.
*/
readonly custom?: {
[k: string]: number
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/test/fixtures.ts
Expand Up @@ -47,6 +47,7 @@ export function createRawRumEvent(type: RumEventType, overrides?: Context): RawR
vital: {
id: generateUUID(),
type: VitalType.DURATION,
name: 'timing',
custom: {
timing: 0 as ServerDuration,
},
Expand Down
1 change: 1 addition & 0 deletions test/e2e/scenario/rum/vitals.scenario.ts
Expand Up @@ -21,6 +21,7 @@ describe('vital collection', () => {
await flushEvents()

expect(intakeRegistry.rumVitalEvents.length).toBe(1)
expect(intakeRegistry.rumVitalEvents[0].vital.name).toEqual('foo')
expect(intakeRegistry.rumVitalEvents[0].vital.custom).toEqual({ foo: jasmine.any(Number) })
})
})

0 comments on commit d09adb8

Please sign in to comment.