dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

feat(ddtrace/tracer): add RecordException API

Open dubloom opened this issue 6 months ago • 2 comments

What does this PR do?

  • Add RecordException API in tracer following this RFC. This API adds an error to the current span as a SpanEvent.
  • Fix span event attributes sanitizer. Currently, it was possible to provide NaN or Infinite float value which would make the trace non loadable in datadog. image

I'll open a systemtest PR soon (I'm waiting for support on other languages).

Motivation

Several customers asked for this in other languages and @mtoffl01 told me there was a specific feature request in go.

Reviewer's Checklist

  • [x] Changed code has unit tests for its functionality at or near 100% coverage.
  • [x] New code is free of linting errors. You can check this by running golangci-lint run locally.
  • [x] Add an appropriate team label so this PR gets put in the right place for the release notes.
  • [x] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

dubloom avatar Jul 07 '25 09:07 dubloom

Benchmarks

Benchmark execution time: 2025-07-07 11:32:28

Comparing candidate commit f299476e0521815b6e1d4806837c72f121b9749b in PR branch dubloom/record-exception-api with baseline commit fb8024210cfa1479d2c074e9626d56085f34883f in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.

pr-commenter[bot] avatar Jul 07 '25 09:07 pr-commenter[bot]

@dubloom Is this PR alive?

darccio avatar Nov 14 '25 16:11 darccio