Skip to content

Conversation

@bdeitte
Copy link
Owner

@bdeitte bdeitte commented Dec 14, 2025

I still need to review this further, but this should fix:
#119 (will require a major version bump)
#92
#198
#218
#120

Copilot AI review requested due to automatic review settings December 14, 2025 22:52
Copy link
Contributor

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 addresses multiple historical issues by improving mock mode behavior, optimizing DNS lookups for IP addresses, fixing event prefix/suffix handling, enhancing Telegraf tag sanitization, and ensuring safe socket cleanup.

Key Changes:

  • Mock mode now creates a mock transport instead of real sockets
  • IP addresses bypass DNS lookup to avoid APM instrumentation overhead
  • Event titles now respect global prefix and suffix configuration
  • Telegraf tags ending with backslashes are properly sanitized
  • Socket error handler removal checks for socket existence

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/transport.js Implements mock transport, adds IP detection to bypass DNS lookups, assigns transport types before protocol-specific creation
lib/statsd.js Guards socket.removeListener calls with socket existence checks, passes mock flag to transport creation
lib/statsFunctions.js Applies prefix/suffix to event titles consistently with check() behavior
lib/helpers.js Sanitizes trailing backslashes in Telegraf tags to prevent line protocol breaking
test/udpSocketOptions.js Adds test coverage for IP address DNS lookup bypass behavior
test/init.js Verifies mock transport creation and properties
test/helpers.js Tests trailing backslash sanitization in various scenarios
test/event.js Validates event title prefix/suffix application
test/close.js Tests safe close behavior when socket is null
README.md Updates mock mode documentation and reorders feature list
CHANGES.md Documents all fixes in the changelog
CLAUDE.md Notes debug logging capability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lib/transport.js Outdated
});
} catch (socketError) {
debug('hot-shots UDP transport: send exception - %s', socketError.message);
callback(socketError);
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

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

The callback is invoked without checking if it exists, but earlier in this code path (lines 111-112) it's conditionally invoked. This could cause an error if callback is undefined when a socketError occurs.

Copilot uses AI. Check for mistakes.
Repository owner deleted a comment from Copilot AI Dec 14, 2025
@bdeitte bdeitte merged commit 4cae759 into main Dec 20, 2025
13 checks passed
@bdeitte bdeitte deleted the bug-bash branch December 20, 2025 00:55
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.

2 participants