better handling of non-zrok usage data

This commit is contained in:
Michael Quigley 2023-06-16 13:28:00 -04:00
parent 36d267256f
commit 23c275f930
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 7 additions and 6 deletions

View File

@ -220,7 +220,7 @@ mainLoop:
lastCycle = time.Now()
}
} else {
logrus.Warn("not enforcing for usage with no share token: %v", usage.String())
logrus.Warnf("not enforcing for usage with no share token: %v", usage.String())
}
case <-time.After(a.cfg.Cycle):

View File

@ -45,8 +45,12 @@ func (a *Agent) Start() error {
select {
case event := <-a.events:
if usage, err := Ingest(event.Data()); err == nil {
if err := a.cache.addZrokDetail(usage); err != nil {
logrus.Errorf("unable to add zrok detail for: %v: %v", usage.String(), err)
if usage.AccountId != 0 || usage.EnvironmentId != 0 {
if err := a.cache.addZrokDetail(usage); err != nil {
logrus.Errorf("unable to add zrok detail for: %v: %v", usage.String(), err)
}
} else {
logrus.Debugf("skipping zrok detail for: %v", usage.String())
}
shouldAck := true
for _, snk := range a.snks {
@ -64,9 +68,6 @@ func (a *Agent) Start() error {
}
} else {
logrus.Errorf("unable to ingest '%v': %v", event.Data(), err)
if err := event.Ack(); err != nil {
logrus.Errorf("unable to ack unparseable message: %v", err)
}
}
}
}