Skip to content

Commit

Permalink
backport of commit ff504ad
Browse files Browse the repository at this point in the history
  • Loading branch information
HridoyRoy authored and mpalmi committed Jun 14, 2023
1 parent 3b189b1 commit 8fe3366
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 0 additions & 3 deletions changelog/16447.txt

This file was deleted.

15 changes: 15 additions & 0 deletions vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,21 @@ func (a *ActivityLog) handleQuery(ctx context.Context, startTime, endTime time.T
if err != nil {
return nil, err
}
// Add the namespace attribution for the current month to the newly computed current month value. Note
// that transformMonthBreakdowns calculates a superstruct of the required namespace struct due to its
// primary use-case being for precomputedQueryWorker, but we will reuse this code for brevity and extract
// the namespaces from it.
currentMonthNamespaceAttribution := a.transformMonthBreakdowns(partialByMonth)
// Ensure that there is only one element in this list -- if not, warn.
if len(currentMonthNamespaceAttribution) > 1 {
a.logger.Warn("more than one month worth of namespace and mount attribution calculated for "+
"current month values", "number of months", len(currentMonthNamespaceAttribution))
}
if len(currentMonthNamespaceAttribution) == 0 {
a.logger.Warn("no month data found, returning query with no namespace attribution for current month")
} else {
currentMonth.Namespaces = currentMonthNamespaceAttribution[0].Namespaces
}
pq.Months = append(pq.Months, currentMonth)
distinctEntitiesResponse += pq.Months[len(pq.Months)-1].NewClients.Counts.EntityClients
}
Expand Down

0 comments on commit 8fe3366

Please sign in to comment.