Skip to content

Conversation

@phinze
Copy link
Contributor

@phinze phinze commented Dec 12, 2025

Summary

  • Add -enableTCP6 flag to VictoriaMetrics and VictoriaLogs containers to enable dual-stack (IPv4 + IPv6) listening

Problem

Go's HTTP client uses "Happy Eyeballs" (RFC 6555) when connecting to localhost, which resolves to both ::1 (IPv6) and 127.0.0.1 (IPv4). The algorithm typically tries IPv6 first. Since VictoriaMetrics was only listening on IPv4 (0.0.0.0:8428), connections would fail when the client chose IPv6:

[ERROR] failed to send metrics to victoriametrics │ error: "failed to send metrics: Post \"http://localhost:8428/api/v1/import/prometheus\": dial tcp [::1]:8428: connect: connection refused"

Fix

VictoriaMetrics defaults to IPv4-only listening. Adding the -enableTCP6 flag enables dual-stack mode, allowing it to accept connections on both IPv4 and IPv6.

Test plan

  • Deploy updated runtime and verify VictoriaMetrics listens on both IPv4 and IPv6:
    ss -tlnp | grep 8428
    # Should show both 0.0.0.0:8428 and [::]:8428
    
  • Verify curl -6 http://localhost:8428/health succeeds
  • Verify metrics writer no longer logs connection refused errors

Summary by CodeRabbit

  • New Features
    • Enabled IPv6 TCP support for VictoriaLogs and VictoriaMetrics services, allowing these components to communicate over IPv6 networks.

✏️ Tip: You can customize this high-level summary in your review settings.

Add -enableTCP6 flag to enable dual-stack (IPv4 + IPv6) listening.

Go's HTTP client uses "Happy Eyeballs" (RFC 6555) when connecting to
localhost, which resolves to both ::1 (IPv6) and 127.0.0.1 (IPv4). The
algorithm typically tries IPv6 first. Since VictoriaMetrics was only
listening on IPv4, connections would fail when the client chose IPv6:

  [ERROR] failed to send metrics to victoriametrics
  error: "dial tcp [::1]:8428: connect: connection refused"

VictoriaMetrics defaults to IPv4-only listening. Adding -enableTCP6
enables dual-stack mode, allowing connections on both IPv4 and IPv6.
@phinze phinze requested a review from a team as a code owner December 12, 2025 17:03
@coderabbitai
Copy link

coderabbitai bot commented Dec 12, 2025

📝 Walkthrough

Walkthrough

Both VictoriaLogs and VictoriaMetrics containers now include the -enableTCP6 flag in their startup arguments within the createContainer functions, enabling IPv6 TCP support without altering container management logic or APIs.

Changes

Cohort / File(s) Summary
TCP6 flag additions
components/victorialogs/victorialogs.go, components/victoriametrics/victoriametrics.go
Added -enableTCP6 argument to container startup command in createContainer function for each component

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc69b2 and e0678cb.

📒 Files selected for processing (2)
  • components/victorialogs/victorialogs.go (1 hunks)
  • components/victoriametrics/victoriametrics.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Follow standard Go formatting conventions
Only add comments when they provide valuable context or explain 'why' something is done - avoid redundant comments that restate what the code does
Good comments should explain complex logic, document assumptions, or clarify non-obvious behavior rather than restating the code
Function/method comments should explain the purpose and any important side effects, not just restate the function name

Files:

  • components/victoriametrics/victoriametrics.go
  • components/victorialogs/victorialogs.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: lint
  • GitHub Check: build-binaries (darwin, amd64, macos-latest)
  • GitHub Check: test-e2e
  • GitHub Check: test
🔇 Additional comments (2)
components/victorialogs/victorialogs.go (1)

305-305: The -enableTCP6 flag is a supported and documented flag in VictoriaLogs for enabling IPv6 listening. It functions as a boolean flag (usable as -enableTCP6 or -enableTCP6=true) and is consistent with the same flag used in VictoriaMetrics components. By default, VictoriaLogs listens on IPv4 only; this flag enables dual-stack (IPv4 + IPv6) listening.

components/victoriametrics/victoriametrics.go (1)

314-314: The -enableTCP6 flag is supported and correctly added.

VictoriaMetrics officially supports the -enableTCP6 flag, which enables IPv6 for listening and dialing. The flag is documented in the official VictoriaMetrics documentation and is compatible with the v1 image reference used in this project.


Comment @coderabbitai help to get the list of available commands and usage tips.

@phinze phinze merged commit cd4dc35 into main Dec 12, 2025
9 checks passed
@phinze phinze deleted the phinze/enable-tcp6-victoria branch December 12, 2025 19:43
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