Skip to content

Commit 6936394

Browse files
authored
Limit cardinality of transaction.name (#90955) (#91021)
1 parent 5950d26 commit 6936394

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/optimize/bundles_route/bundles_route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { extname, join } from 'path';
1010

1111
import Hapi from '@hapi/hapi';
1212
import * as UiSharedDeps from '@kbn/ui-shared-deps';
13+
import agent from 'elastic-apm-node';
1314

1415
import { createDynamicAssetResponse } from './dynamic_asset_response';
1516
import { FileHashCache } from './file_hash_cache';
@@ -101,6 +102,8 @@ function buildRouteForBundles({
101102
method(request: Hapi.Request, h: Hapi.ResponseToolkit) {
102103
const ext = extname(request.params.path);
103104

105+
agent.setTransactionName('GET ?/bundles/?');
106+
104107
if (ext !== '.js' && ext !== '.css') {
105108
return h.continue;
106109
}

x-pack/plugins/task_manager/server/task_running/task_runner.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ export class TaskManagerRunner implements TaskRunner {
201201
});
202202

203203
const stopTaskTimer = startTaskTimer();
204-
const apmTrans = apm.startTransaction(
205-
`taskManager run ${this.instance.taskType}`,
206-
'taskManager'
207-
);
204+
const apmTrans = apm.startTransaction(`taskManager run`, 'taskManager');
205+
apmTrans?.addLabels({
206+
taskType: this.taskType,
207+
});
208208
try {
209209
this.task = this.definition.createTaskRunner(modifiedContext);
210210
const result = await this.task.run();
@@ -232,10 +232,11 @@ export class TaskManagerRunner implements TaskRunner {
232232
public async markTaskAsRunning(): Promise<boolean> {
233233
performance.mark('markTaskAsRunning_start');
234234

235-
const apmTrans = apm.startTransaction(
236-
`taskManager markTaskAsRunning ${this.instance.taskType}`,
237-
'taskManager'
238-
);
235+
const apmTrans = apm.startTransaction(`taskManager markTaskAsRunning`, 'taskManager');
236+
237+
apmTrans?.addLabels({
238+
taskType: this.taskType,
239+
});
239240

240241
const now = new Date();
241242
try {

0 commit comments

Comments
 (0)