Skip to content
Open
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
6 changes: 6 additions & 0 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,9 @@ If APM Server is deployed in an origin different than the page’s origin, you w
::::


### `recordEmptyTransactions` [record-empty-transactions]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: reportTransactionsWithoutSpans? - fine with Empty as well. Just provided as a suggestion.


* **Type:** Boolean
* **Default:** `false`

If you are interested also for transactions that have no spans you can set this configuration option to true. Bear in mind that sampling rate still applies even if this setting is set to `true`.
3 changes: 2 additions & 1 deletion packages/rum-core/src/common/config-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class Config {
context: {},
session: false,
apmRequest: null,
sendCredentials: false
sendCredentials: false,
recordEmptyTransactions: false
}

this.events = new EventHandler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ export default class PerformanceMonitoring {
return false
}

if (tr.sampled && tr.spans.length === 0) {
const recordEmpty = this._configService.get('recordEmptyTransactions')
if (tr.sampled && tr.spans.length === 0 && !recordEmpty) {
if (__DEV__) {
this._logginService.debug(
`transaction(${tr.id}, ${tr.name}) was discarded! Transaction does not have any spans`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ describe('PerformanceMonitoring', function () {
)
})

it('should allow transactions with no spans if enabled by configuration', () => {
spyOn(logger, 'debug').and.callThrough()
configService.setConfig({ ...agentConfig, recordEmptyTransactions: true })
const transaction1 = new Transaction('transaction', 'custom', {
id: 1,
startTime: 0,
managed: true
})
transaction1.end(600)
expect(transaction1.duration()).toBe(600)
expect(performanceMonitoring.filterTransaction(transaction1)).toBe(true)
expect(logger.debug).not.toHaveBeenCalled()
})

it('should initialize and add transaction to the queue', async () => {
performanceMonitoring.init()
spyOn(apmServer, 'addTransaction')
Expand Down
Loading