fix: stop the tracer after each invocation. Disable telemetry#207
Merged
Conversation
duncanista
approved these changes
Aug 8, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the Datadog Lambda Go library by reducing CPU and network overhead for high-throughput functions. It accomplishes this by ensuring the tracer is properly stopped after each invocation and disabling telemetry collection from the statsd client.
- Adds tracer cleanup after each Lambda invocation
- Disables statsd client telemetry to reduce overhead
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/trace/listener.go | Adds tracer.Stop() call to properly clean up tracer resources after each invocation |
| internal/metrics/listener.go | Configures statsd client to disable telemetry using WithoutTelemetry() option |
| } | ||
|
|
||
| tracer.Stop() | ||
| tracer.Flush() |
There was a problem hiding this comment.
Consider the order of operations: calling tracer.Stop() before tracer.Flush() may prevent pending traces from being sent. The typical pattern is to flush first, then stop to ensure all data is transmitted before cleanup.
Suggested change
| tracer.Flush() | |
| tracer.Flush() | |
| tracer.Stop() |
purple4reina
approved these changes
Aug 8, 2025
purple4reina
approved these changes
Aug 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Motivation
Limits additional CPU and network overhead which can cause issues for small, high-throughput functions.
Testing Guidelines
Additional Notes
Types of changes
Checklist