-
Notifications
You must be signed in to change notification settings - Fork 20
Support IPv6 for egress metrics #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: terashima <[email protected]>
Signed-off-by: terashima <[email protected]>
Signed-off-by: terashima <[email protected]>
Signed-off-by: terashima <[email protected]>
We can get metrics like this.
|
Signed-off-by: terashima <[email protected]>
There was a problem hiding this 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 enhances egress metrics by adding IPv6 support and a new protocol
label on existing nftables metrics, enabling separate tracking for IPv4 and IPv6.
- Add a
protocol
label to all masquerade and invalid packet/byte metrics. - Extend
NewEgressCollector
to accept a list of protocols and instantiate per-protocol metric collectors. - Introduce
stringToTableFamily
helper and update NAT/invalid counter methods to select IPv4 or IPv6 tables. - Update the CLI runner to detect local IPs and pass supported protocols; update docs to include
protocol
column.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
v2/pkg/metrics/egress.go | Updated metric definitions, collector logic, helper |
v2/cmd/coil-egress/sub/run.go | Pass detected protocols to the collector |
docs/cmd-coil-egress.md | Documented new protocol label |
Comments suppressed due to low confidence (3)
v2/pkg/metrics/egress.go:23
- Typo in metric and variable name: ‘Connctrack’ should be ‘Conntrack’ (e.g. NfConntrackCount) for clarity and consistency.
NfConnctrackCount = prometheus.NewGaugeVec(prometheus.GaugeOpts{
v2/cmd/coil-egress/sub/run.go:40
- Update registration to match the corrected metric name ‘NfConntrackCount’ after fixing the typo in the variable.
metrics.Registry.MustRegister(egressMetrics.NfConnctrackCount)
v2/pkg/metrics/egress.go:217
- Add unit tests for
stringToTableFamily
and the protocol-specific branches ingetNfTablesNATCounter
/getNfTablesInvalidCounter
to verify IPv6 behavior.
func stringToTableFamily(protocol string) (nftables.TableFamily, error) {
6513c7d
to
4e7a01f
Compare
Signed-off-by: terashima <[email protected]>
4e7a01f
to
8b907cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR adds a IPv6 support for following egress related metrics.
I introduced a new label named
protocol
for these metrics, which can takeipv4
oripv6
.Signed-off-by: terashima [email protected]