Skip to content

fix: stop the tracer after each invocation. Disable telemetry#207

Merged
purple4reina merged 1 commit into
mainfrom
aj/stop-tracer-disable-telemetry
Aug 11, 2025
Merged

fix: stop the tracer after each invocation. Disable telemetry#207
purple4reina merged 1 commit into
mainfrom
aj/stop-tracer-disable-telemetry

Conversation

@astuyve
Copy link
Copy Markdown
Contributor

@astuyve astuyve commented Aug 8, 2025

What does this PR do?

  1. Stops the tracer after each invocation
  2. Disables instrumentation telemetry from statsd client

Motivation

Limits additional CPU and network overhead which can cause issues for small, high-throughput functions.

Testing Guidelines

Additional Notes

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Checklist

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@astuyve astuyve requested a review from a team as a code owner August 8, 2025 17:53
@lucaspimentel lucaspimentel requested a review from Copilot August 8, 2025 18:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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()
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

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()

Copilot uses AI. Check for mistakes.
@purple4reina purple4reina merged commit c85d029 into main Aug 11, 2025
9 checks passed
@purple4reina purple4reina deleted the aj/stop-tracer-disable-telemetry branch August 11, 2025 21:02
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.

4 participants