diff --git a/server/services/v1/billing.go b/server/services/v1/billing.go index 5eadc0a7..015f7f91 100644 --- a/server/services/v1/billing.go +++ b/server/services/v1/billing.go @@ -106,6 +106,9 @@ func (b *billingService) getMetronomeId(ctx context.Context, namespaceId string) log.Warn().Msgf("Could not find namespace, this must not happen with right authn/authz configured") return uuid.Nil, errors.NotFound("Namespace %s not found", namespaceId) } + if nsMeta.Accounts == nil { + nsMeta.Accounts = &metadata.AccountIntegrations{} + } mIdStr, enabled := nsMeta.Accounts.GetMetronomeId() if !enabled || len(mIdStr) == 0 { diff --git a/server/services/v1/billing/reporter.go b/server/services/v1/billing/reporter.go index c6453cd6..3f890bf7 100644 --- a/server/services/v1/billing/reporter.go +++ b/server/services/v1/billing/reporter.go @@ -188,6 +188,10 @@ func (r *UsageReporter) pushStorage() error { events := make([]*StorageEvent, 0, len(tenants)) for _, t := range tenants { nsMeta := t.GetNamespace().Metadata() + if nsMeta.Accounts == nil { + nsMeta.Accounts = &metadata.AccountIntegrations{} + } + if id, enabled := nsMeta.Accounts.GetMetronomeId(); len(id) == 0 || !enabled { // user doesn't have metronome integration; skip continue