Skip to content

Commit 9811e58

Browse files
authored
feat: add error.transaction.name (#2539)
Add `transaction.name` to errors captured in the context of a transaction. This allows APM UI to have fields used for transaction grouping, which allows correlating error groups to transaction groups. Closes: #2456
1 parent 6a12f7f commit 9811e58

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

CHANGELOG.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Notes:
4444
to provide help to the user on configuring the service name.
4545
({issues}2491[#2491])
4646
47+
* Add `transaction.name` to captured APM errors. This will allow the Kibana APM
48+
app to correlate error groups and transaction groups. ({issues}2456[#2456])
49+
4750
[float]
4851
===== Bug fixes
4952

lib/errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function createAPMError (args, cb) {
146146
if (args.trans) {
147147
error.transaction_id = args.trans.id
148148
error.transaction = {
149+
name: args.trans.name,
149150
type: args.trans.type,
150151
sampled: args.trans.sampled
151152
}

test/agent.test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,13 +1523,16 @@ test('#captureError()', function (t) {
15231523
t.equal(apmServer.events.length, 2, 'APM server got 2 events')
15241524
assertMetadata(t, apmServer.events[0].metadata)
15251525
const data = apmServer.events[1].error
1526-
t.strictEqual(data.exception.message, 'with callback')
1527-
t.strictEqual(data.id.length, 32, 'id is 32 characters')
1528-
t.strictEqual(data.parent_id, span.id, 'parent_id matches span id')
1529-
t.strictEqual(data.trace_id, trans.traceId, 'trace_id matches transaction trace id')
1530-
t.strictEqual(data.transaction_id, trans.id, 'transaction_id matches transaction id')
1531-
t.strictEqual(data.transaction.type, trans.type, 'transaction.type matches transaction type')
1532-
t.strictEqual(data.transaction.sampled, true, 'is sampled')
1526+
t.strictEqual(data.exception.message, 'with callback', 'error.exception.message')
1527+
t.strictEqual(data.id.length, 32, 'error.id is 32 characters')
1528+
t.strictEqual(data.parent_id, span.id, 'error.parent_id matches span id')
1529+
t.strictEqual(data.trace_id, trans.traceId, 'error.trace_id matches transaction trace id')
1530+
t.strictEqual(data.transaction_id, trans.id, 'error.transaction_id matches transaction id')
1531+
t.deepEqual(data.transaction, {
1532+
name: trans.name,
1533+
type: trans.type,
1534+
sampled: true
1535+
}, 'error.transaction.*')
15331536

15341537
apmServer.clear()
15351538
agent.destroy()

0 commit comments

Comments
 (0)