Skip to content
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

[BUG] connects metrics having same netns in tcpsummary should be accumulated instead of overwrite #283

Closed
dzy176 opened this issue May 21, 2024 · 3 comments

Comments

@dzy176
Copy link
Contributor

dzy176 commented May 21, 2024

https://github.com/alibaba/kubeskoop/blob/18cc669b7048d6299a4eb0fbc9efdab2d1aae3f7/pkg/exporter/probe/proctcpsummary/proctcp.go#L137C1-L143C40

		resMap[TCPEstablishedConn][nsinum] = est + est6
		resMap[TCPTimewaitConn][nsinum] = tw + tw6
		resMap[TCPTXQueue][nsinum] = tx + tx6
		resMap[TCPRXQueue][nsinum] = rx + rx6

Maybe resMap[TCPEstablishedConn][nsinum] += est + est6 ...... is correct?

@Lyt99
@RichardoMrMu any idea?

@dzy176 dzy176 changed the title [BUG] connects metrics in tcpsummary should be accumulated instead of overwrite [BUG] connects metrics having same netns in tcpsummary should be accumulated instead of overwrite May 21, 2024
@RichardoMrMu
Copy link
Contributor

i approve that metrics should be accumulated instead of overwrite. like this #284

@jzwlqx
Copy link
Collaborator

jzwlqx commented May 22, 2024

Each pid in the pidlist corresponds to a separate netns, and the netns corresponding to any two pids are different. During the for idx := range pidlist loop, every netns would only be processed once.

When the loop starts, the value of resMap[TCPEstablishedConn][nsinum] is 0, and there is no need to accumulate during the loop.

@BSWANG BSWANG closed this as completed May 23, 2024
@BSWANG
Copy link
Collaborator

BSWANG commented May 23, 2024

@RichardoMrMu @dzy176 Thanks for reporting the issue.

Based on the discussion above, a socket metric for a netns only needs to be accounted for once, regardless of how many Pids are in that namespace.

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

No branches or pull requests

4 participants