From ad82fafde810b71c4dc948184d55c36a3e61aeb8 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 19 May 2020 10:09:28 +0000 Subject: [PATCH] multitenant: scan container command-lines as well as process --- app/multitenant/billing_emitter.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/multitenant/billing_emitter.go b/app/multitenant/billing_emitter.go index 1a418bf12..8c9e0963d 100644 --- a/app/multitenant/billing_emitter.go +++ b/app/multitenant/billing_emitter.go @@ -139,13 +139,22 @@ func (e *BillingEmitter) reportInterval(r report.Report) time.Duration { return r.Window } var inter string - for _, c := range r.Process.Nodes { - if cmd, ok := c.Latest.Lookup(report.Cmdline); ok { + for _, c := range r.Container.Nodes { + if cmd, ok := c.Latest.Lookup(report.DockerContainerCommand); ok { if inter = intervalFromCommand(cmd); inter != "" { break } } } + if inter == "" { // not found in containers: look in processes + for _, c := range r.Process.Nodes { + if cmd, ok := c.Latest.Lookup(report.Cmdline); ok { + if inter = intervalFromCommand(cmd); inter != "" { + break + } + } + } + } if inter == "" { return 0 }