Skip to content

Adds DisposeAsync to IDogStatsd Interface for Tracer Usage#224

Open
link04 wants to merge 4 commits intoDataDog:masterfrom
link04:maximo/adds-async-methods
Open

Adds DisposeAsync to IDogStatsd Interface for Tracer Usage#224
link04 wants to merge 4 commits intoDataDog:masterfrom
link04:maximo/adds-async-methods

Conversation

@link04
Copy link

@link04 link04 commented Feb 6, 2026

Summary

Exposes DisposeAsync() on the public IDogStatsd interface, allowing callers to await disposal and avoid sync-over-async patterns.

Changes

  • IDogStatsd now has DisposeAsync()
  • DogStatsdService implements it
  • Added a couple tests for the new method

Motivation

With DisposeAsync(), callers can now do await dogstatsd.DisposeAsync(); instead of blocking with dogstatsd.Dispose();.

Testing

  • DisposeAsync_CanBeCalledMultipleTimes - verifies concurrent dispose calls don't deadlock
  • DisposeAsync_Completes_WithInFlightMetrics - verifies disposal completes even with ongoing metric traffic

Manual benchmark CompareSyncVsAsync_UnderStarvation (run with [Explicit] test) shows ~3x faster disposal under thread pool pressure(mostly added to showcase a difference).

=== THREAD POOL STARVATION BENCHMARK ===
Thread pool: min=2, max=4 (severely constrained)
Blocking tasks: 10 (exceeds pool capacity)

SYNC  Dispose: 144ms
ASYNC Dispose: 44ms  ← 3x faster under starvation

@link04 link04 requested a review from a team as a code owner February 6, 2026 22:00
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60c5e0d27a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant