Skip to content

Commit

Permalink
Fix missing service info (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski authored Dec 12, 2024
1 parent 59313dd commit 064fb93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/internal/kube/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,17 @@ func (s *Store) ServiceNameNamespaceForIP(ip string) (string, string) {
s.access.RUnlock()
return serviceInfo.Name, serviceInfo.Namespace
}
s.access.RUnlock()

s.access.Lock()
defer s.access.Unlock()

name, namespace := "", ""
if om, ok := s.objectMetaByIP[ip]; ok {
name, namespace = s.serviceNameNamespaceForMetadata(om)
}
s.access.RUnlock()

s.access.Lock()
s.otelServiceInfoByIP[ip] = OTelServiceNamePair{Name: name, Namespace: namespace}
s.access.Unlock()

return name, namespace
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubecache/meta/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (inf *Informers) Subscribe(observer Observer) {
for _, service := range inf.services.GetStore().List() {
// ignore headless services from being added
if headlessService(service.(*indexableEntity).EncodedMeta) {
return
continue
}
if err := observer.On(&informer.Event{
Type: informer.EventType_CREATED,
Expand Down

0 comments on commit 064fb93

Please sign in to comment.