-
Notifications
You must be signed in to change notification settings - Fork 399
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
fix: k8s meta index #2032
fix: k8s meta index #2032
Conversation
2023b06
to
d4c641e
Compare
@@ -10,6 +10,24 @@ import ( | |||
"github.com/alibaba/ilogtail/pkg/logger" | |||
) | |||
|
|||
type IndexItem struct { |
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.
1、cache是内存密集型的,需要把内存通过指标体现出来
2、指标现在是否能通过Lens承载。指标现在比较多(包括之前的http请求),需要考虑后端的承载能力,不一定都会上报上来。
7791db0
to
a1836d9
Compare
@@ -169,36 +163,14 @@ func (m *MetaManager) RegisterSendFunc(projectName, configName, resourceType str | |||
} | |||
} | |||
|
|||
func (m *MetaManager) UnRegisterSendFunc(projectName, configName, resourceType string) { | |||
if cache, ok := m.cacheMap[resourceType]; ok { | |||
func (m *MetaManager) UnRegisterAllSendFunc(projectName, configName string) { |
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.
这里是优化了一下锁。因为每种资源的cache unregister很快,在Manager这里不用频繁申请锁了,直接申请一次,全部遍历一遍
switch pod.OwnerReferences[0].Kind { | ||
case "ReplicaSet": | ||
switch { | ||
case linkType == POD_REPLICASET && pod.OwnerReferences[0].Kind == "ReplicaSet": |
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.
后续还得抽点时间改掉这个时间
event.Object.FirstObservedTime = obj.FirstObservedTime | ||
oldIdxKeys = m.getIdxKeys(obj) |
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.
如果是update事件,还需要先delete再add吗?你这里怎么判断是1还是2?
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.
update也需要先delete再add,因为新的索引和旧的索引可能不同,例如Pod的container id
61f3ec5
to
9292932
Compare
问题
由于存在多个对象index相同的情况,所以索引中的value是一个数组。但是处理update事件时没有覆盖旧的索引,导致重复发送。
修复