-
Notifications
You must be signed in to change notification settings - Fork 83
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
Added debug log of AllocatedIPCount of ippool #3926
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3926 +/- ##
==========================================
- Coverage 81.34% 80.81% -0.54%
==========================================
Files 51 51
Lines 4514 4519 +5
==========================================
- Hits 3672 3652 -20
- Misses 672 700 +28
+ Partials 170 167 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
e1cda70
to
d2cedea
Compare
需要找出 用量统计的根因,gc并不能解决真正的问题,只是事后补救,这是两个纬度 |
d2cedea
to
42941c7
Compare
@@ -586,6 +586,23 @@ var _ = Describe("test ip with reclaim ip case", Label("reclaim"), func() { | |||
// Delete Pod | |||
Expect(frame.DeletePod(podName, namespace)).To(Succeed(), "Failed to delete pod %v/%v\n", namespace, podName) | |||
GinkgoWriter.Printf("succeed to delete pod %v/%v\n", namespace, podName) | |||
|
|||
// Check whether the dirty IP data is recovered successfully and whether the AllocatedIPCount decreases and meets expectations? |
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.
用例是在手动更新 AllocatedIPCount 为一个错误的值,期望在新的改进引入后,分配 IP 或则 释放 IP,或则 gc all 回收异常 IP,都能够纠正这个 AllocatedIPCount 值。
IPPool 的状态是健壮的。
42941c7
to
e7ee784
Compare
f59f549
to
a9069ca
Compare
(1) 这个日志 真有 能帮助 debug 问题根因么 |
当前没有任何日志去获悉 ippool 的 AllocatedIPCount 数量在什么时候开始出现异常的。AllocatedIPCount++,AllocatedIPCount-- 只出现在文中两处,补充这样的日志,当 IPPool 分配与释放 IP 打印当前的 AllocatedIPCount,能够知道在哪一次分配和释放出现的记录错误的问题。 |
你再想想,你这行 日志 真的能 进行 生产监控么 |
pkg/ippoolmanager/ippool_manager.go
Outdated
@@ -215,6 +215,8 @@ func (im *ipPoolManager) genRandomIP(ctx context.Context, ipPool *spiderpoolv2be | |||
ipPool.Status.AllocatedIPCount = new(int64) | |||
} | |||
|
|||
// reference issue: https://github.com/spidernet-io/spiderpool/issues/3771 | |||
logger.Sugar().Debugf("Handling AllocatedIPCount when allocate IP from IPPool %s, the current AllocatedIPCount is: %d", ipPool.Name, *ipPool.Status.AllocatedIPCount) |
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.
这么检测,是帮助不了 捕获问题的
它的逻辑应该是
if len( ip 分配数组 ) != AllocatedIPCount {
log(error, ....... )
}
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.
done
同理, subnet 对象的统计 也可能会有问题 |
a9069ca
to
6168361
Compare
子网根据实际的来算的
|
为什么不 两个拉齐 一个算法 |
开始修改就是对齐子网,使用切片长度来算的,然后被你否了。你说没找到根因怎么知道修改是否有效? |
6168361
to
e9f0536
Compare
Signed-off-by: ty-dc <[email protected]>
e9f0536
to
6ef5fc2
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.
建议 PR 加些描述,方便 release-notes 展示
done |
Added debug log of AllocatedIPCount of ippool Signed-off-by: robot <[email protected]>
Added debug log of AllocatedIPCount of ippool Signed-off-by: robot <[email protected]>
Added debug log of AllocatedIPCount of ippool Signed-off-by: robot <[email protected]>
Thanks for contributing!
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes ##3771
Special notes for your reviewer:
SpiderIPPool's AllocatedIPCount statistics are aligned with SpiderSubnet, and some debug logs are added.