File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -246,8 +246,9 @@ func (r *Registry) getOrCreateContainer(pid uint32) *Container {
246
246
cmdline := proc .GetCmdline (pid )
247
247
parts := bytes .Split (cmdline , []byte {0 })
248
248
if len (parts ) > 0 {
249
+ cmd := parts [0 ]
249
250
lastArg := parts [len (parts )- 1 ]
250
- if bytes .HasSuffix (parts [ 0 ] , []byte ("runsc-sandbox" )) && containerIdRegexp .Match (lastArg ) {
251
+ if ( bytes .HasSuffix (cmd , []byte ("runsc-sandbox" )) || bytes . HasSuffix ( cmd , [] byte ( "runsc" ) )) && containerIdRegexp .Match (lastArg ) {
251
252
cg .ContainerId = string (lastArg )
252
253
}
253
254
}
@@ -309,6 +310,9 @@ func calcId(cg *cgroup.Cgroup, md *ContainerMetadata) ContainerID {
309
310
default :
310
311
return ""
311
312
}
313
+ if cg .ContainerId == "" {
314
+ return ""
315
+ }
312
316
if md .labels ["io.kubernetes.pod.name" ] != "" {
313
317
pod := md .labels ["io.kubernetes.pod.name" ]
314
318
namespace := md .labels ["io.kubernetes.pod.namespace" ]
You can’t perform that action at this time.
0 commit comments