Skip to content

Commit

Permalink
Merge pull request #3751 from weaveworks/billing-window
Browse files Browse the repository at this point in the history
Improve calculation of usage in multitenant code
  • Loading branch information
bboreham authored Mar 6, 2020
2 parents b07bfb2 + 329023b commit e04dc86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/multitenant/billing_emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ func (e *BillingEmitter) Add(ctx context.Context, rep report.Report, buf []byte)
}

// reportInterval tries to find the custom report interval of this report. If
// it is malformed, or not set, it returns false.
// it is malformed, or not set, it returns a default value.
func (e *BillingEmitter) reportInterval(r report.Report) time.Duration {
if r.Window != 0 {
return r.Window
}
var inter string
for _, c := range r.Process.Nodes {
cmd, ok := c.Latest.Lookup("cmdline")
if !ok {
continue
}
if strings.Contains(cmd, "scope-probe") &&
if strings.Contains(cmd, "scope") &&
strings.Contains(cmd, "probe.publish.interval") {
cmds := strings.SplitAfter(cmd, "probe.publish.interval")
aft := strings.Split(cmds[1], " ")
Expand Down

0 comments on commit e04dc86

Please sign in to comment.