Skip to content

Commit 83851f3

Browse files
committed
fix: remove dashes in app name
1 parent 369800e commit 83851f3

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

packages/rum-core/src/performance-monitoring/metrics.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,9 @@ export class PerfEntryRecorder {
317317
}
318318

319319
start(type) {
320-
/**
321-
* Safari throws an error when PerformanceObserver is
322-
* observed for unknown entry types as longtasks and lcp is
323-
* not supported at the moment
324-
*/
325-
try {
320+
const supportedEntryTypes =
321+
window.PerformanceObserver?.supportedEntryTypes || []
322+
if (supportedEntryTypes.indexOf(type) !== -1) {
326323
/**
327324
* Start observing for different entry types depending on the transaction type
328325
* - `buffered`: true means we would be able to retrive all the events that happened
@@ -332,7 +329,7 @@ export class PerfEntryRecorder {
332329
* buffered flag (https://w3c.github.io/performance-timeline/#observe-method)
333330
*/
334331
this.po.observe({ type, buffered: true })
335-
} catch (_) {}
332+
}
336333
}
337334

338335
stop() {

packages/rum-core/test/performance-monitoring/metrics.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ describe('Metrics', () => {
191191
})
192192
})
193193

194+
it('should not start observer with unsupported type', () => {
195+
const recorder = new PerfEntryRecorder(() => {})
196+
const onStartSpy = jasmine.createSpy()
197+
recorder.po = {
198+
observe: onStartSpy
199+
}
200+
recorder.start('unknown_entry_type')
201+
expect(onStartSpy).not.toHaveBeenCalled()
202+
})
203+
194204
describe('Total Blocking Time', () => {
195205
it('should create total blocking time as span', () => {
196206
calculateTotalBlockingTime(longtaskEntries)

0 commit comments

Comments
 (0)