Skip to content
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

⚗️[RUM-3235] collect vital.name attribute #2609

Merged
merged 2 commits into from Feb 16, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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) })
})
})