Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(apm/tracing): update pageload op transaction start timestamps (#2773
- Loading branch information
1 parent
e771b41
commit 7d7f0db
Showing
4 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Span, Transaction } from '../../src'; | ||
import { _startChild } from '../../src/browser/metrics'; | ||
|
||
describe('_startChild()', () => { | ||
it('creates a span with given properties', () => { | ||
const transaction = new Transaction({ name: 'test' }); | ||
const span = _startChild(transaction, { | ||
description: 'evaluation', | ||
op: 'script', | ||
}); | ||
|
||
expect(span).toBeInstanceOf(Span); | ||
expect(span.description).toBe('evaluation'); | ||
expect(span.op).toBe('script'); | ||
}); | ||
|
||
it('adjusts the start timestamp if child span starts before transaction', () => { | ||
const transaction = new Transaction({ name: 'test', startTimestamp: 123 }); | ||
const span = _startChild(transaction, { | ||
description: 'script.js', | ||
op: 'resource', | ||
startTimestamp: 100, | ||
}); | ||
|
||
expect(transaction.startTimestamp).toEqual(span.startTimestamp); | ||
expect(transaction.startTimestamp).toEqual(100); | ||
}); | ||
|
||
it('does not adjust start timestamp if child span starts after transaction', () => { | ||
const transaction = new Transaction({ name: 'test', startTimestamp: 123 }); | ||
const span = _startChild(transaction, { | ||
description: 'script.js', | ||
op: 'resource', | ||
startTimestamp: 150, | ||
}); | ||
|
||
expect(transaction.startTimestamp).not.toEqual(span.startTimestamp); | ||
expect(transaction.startTimestamp).toEqual(123); | ||
}); | ||
}); |