Skip to content

Commit

Permalink
Limit cardinality of transaction.name
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Feb 10, 2021
1 parent 240da2b commit 1dc7e01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/optimize/bundles_route/bundles_route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { extname, join } from 'path';

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

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

agent.setTransactionName('GET ?/bundles/?');

if (ext !== '.js' && ext !== '.css') {
return h.continue;
}
Expand Down
17 changes: 9 additions & 8 deletions x-pack/plugins/task_manager/server/task_running/task_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ export class TaskManagerRunner implements TaskRunner {
});

const stopTaskTimer = startTaskTimer();
const apmTrans = apm.startTransaction(
`taskManager run ${this.instance.taskType}`,
'taskManager'
);
const apmTrans = apm.startTransaction(`taskManager run`, 'taskManager');
apmTrans?.addLabels({
taskType: this.taskType,
});
try {
this.task = this.definition.createTaskRunner(modifiedContext);
const result = await this.task.run();
Expand Down Expand Up @@ -232,10 +232,11 @@ export class TaskManagerRunner implements TaskRunner {
public async markTaskAsRunning(): Promise<boolean> {
performance.mark('markTaskAsRunning_start');

const apmTrans = apm.startTransaction(
`taskManager markTaskAsRunning ${this.instance.taskType}`,
'taskManager'
);
const apmTrans = apm.startTransaction(`taskManager markTaskAsRunning`, 'taskManager');

apmTrans?.addLabels({
taskType: this.taskType,
});

const now = new Date();
try {
Expand Down

0 comments on commit 1dc7e01

Please sign in to comment.