Skip to content

error: Record transaction.name when available#1177

Merged
stuartnelson3 merged 5 commits intoelastic:masterfrom
marclop:f/add-transaction.name-to-error
Dec 22, 2021
Merged

error: Record transaction.name when available#1177
stuartnelson3 merged 5 commits intoelastic:masterfrom
marclop:f/add-transaction.name-to-error

Conversation

@marclop
Copy link
Contributor

@marclop marclop commented Dec 21, 2021

Description

Adds a new transaction.name field which is recorded when a transaction
is set for the error.

Related issues

Closes #1154

Adds a new `transaction.name` field which is recorded when a transaction
is set for the error.

Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@marclop marclop added the enhancement New feature or request label Dec 21, 2021
@ghost
Copy link

ghost commented Dec 21, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-12-22T09:10:12.825+0000

  • Duration: 33 min 3 sec

  • Commit: 5a081c1

Test stats 🧪

Test Results
Failed 0
Passed 11976
Skipped 268
Total 12244

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@marclop marclop requested a review from a team December 21, 2021 11:14
@stuartnelson3 stuartnelson3 enabled auto-merge (squash) December 22, 2021 09:10
@stuartnelson3 stuartnelson3 merged commit 5c3ce2c into elastic:master Dec 22, 2021
@marclop marclop deleted the f/add-transaction.name-to-error branch December 23, 2021 01:30
@simitt simitt added this to the 2.0 milestone Feb 9, 2022
@axw axw self-assigned this Feb 10, 2022
@axw
Copy link
Member

axw commented Feb 10, 2022

Verified using go.elastic.co/apm/v2 v2.0.0-20220209134054-640a916049c9 (current main).

package main

import (
        "context"
        "errors"

        "go.elastic.co/apm/v2"
)

func main() {
        tracer := apm.DefaultTracer()
        defer tracer.Flush(nil)

        tracer.NewError(errors.New("err1")).Send()

        tx := tracer.StartTransaction("name", "type")
        ctx := apm.ContextWithTransaction(context.Background(), tx)
        apm.CaptureError(ctx, errors.New("err2")).Send()
        tx.Name = "new_name"
        tx.End()
}
  • The first error has no transaction.name field at all, as expected.
  • The second error has transaction.name: name -- the transaction name at the time the error was captured.
  • The transaction has transaction.name: new_name -- the transaction name at the time the transaction was ended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants