Skip to content

Conversation

@mtoffl01
Copy link
Contributor

@mtoffl01 mtoffl01 commented Dec 5, 2025

What does this PR do?

Tracer migrates to using Config.debugAbandonedSpans instead of its own config.debugAbandonedSpans.

Motivation

https://datadoghq.atlassian.net/browse/APMAPI-1748

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • 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!

@pr-commenter
Copy link

pr-commenter bot commented Dec 5, 2025

Benchmarks

Benchmark execution time: 2025-12-05 18:45:54

Comparing candidate commit 44f2aa9 in PR branch mtoff/debugAbandonedSpans with baseline commit 8eb1f41 in branch mtoff/revamp-debug-api.

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

@mtoffl01 mtoffl01 marked this pull request as ready for review December 5, 2025 18:43
@mtoffl01 mtoffl01 requested review from a team as code owners December 5, 2025 18:43
t.Run("default", func(t *testing.T) {
assert := assert.New(t)
assert.False(tracer.config.debugAbandonedSpans)
assert.False(tracer.config.internalConfig.DebugAbandonedSpans())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(For here and every other place) is it ever possible for internalConfig on the tracer.config to be nil? Or for config itself to be nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible, yes, if tracer has not initialized internalConfig via the Get() function, but Config is designed with the expectations that callers must use Get() to get the instance before calling getters/setters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is to make every getter/setter on Config check if the receiver c is not nil, but I think it's more standard Golang to design under the assumptions described above.

@mtoffl01 mtoffl01 marked this pull request as draft December 5, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants