Skip to content

Commit a9186d4

Browse files
committed
chore: change config option to record all transactions
1 parent f5d29cb commit a9186d4

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

docs/reference/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ If APM Server is deployed in an origin different than the page’s origin, you w
368368
::::
369369

370370

371-
### `sendAllRouteChanges` [send-all-route-changes]
371+
### `recordEmptyTransactions` [record-empty-transactions]
372372

373373
* **Type:** Boolean
374374
* **Default:** `false`
375375

376-
This allows the agent to send all `route-change` transactions regardless if it contains any spans or not. This is usefull if you want to keep track of all the navigations your app is doing.
376+
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`.

packages/rum-core/src/common/config-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Config {
9696
session: false,
9797
apmRequest: null,
9898
sendCredentials: false,
99-
sendAllRouteChanges: false
99+
recordEmptyTransactions: false
100100
}
101101

102102
this.events = new EventHandler()

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ import {
4848
OUTCOME_SUCCESS,
4949
OUTCOME_UNKNOWN,
5050
QUEUE_ADD_TRANSACTION,
51-
TRANSACTION_IGNORE,
52-
ROUTE_CHANGE
51+
TRANSACTION_IGNORE
5352
} from '../common/constants'
5453
import {
5554
truncateModel,
@@ -362,13 +361,8 @@ export default class PerformanceMonitoring {
362361
return false
363362
}
364363

365-
if (tr.sampled && tr.spans.length === 0) {
366-
if (
367-
tr.type === ROUTE_CHANGE &&
368-
this._configService.get('sendAllRouteChanges')
369-
) {
370-
return true
371-
}
364+
const recordEmpty = this._configService.get('recordEmptyTransactions')
365+
if (tr.sampled && tr.spans.length === 0 && !recordEmpty) {
372366
if (__DEV__) {
373367
this._logginService.debug(
374368
`transaction(${tr.id}, ${tr.name}) was discarded! Transaction does not have any spans`

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ describe('PerformanceMonitoring', function () {
127127
)
128128
})
129129

130-
it('should allow route-change transactions with no spans if enabled by configuration', () => {
130+
it('should allow transactions with no spans if enabled by configuration', () => {
131131
spyOn(logger, 'debug').and.callThrough()
132-
configService.setConfig({ ...agentConfig, sendAllRouteChanges: true })
133-
const transaction1 = new Transaction('/route/:id', 'route-change', {
132+
configService.setConfig({ ...agentConfig, recordEmptyTransactions: true })
133+
const transaction1 = new Transaction('transaction', 'custom', {
134134
id: 1,
135135
startTime: 0,
136136
managed: true

0 commit comments

Comments
 (0)