Minor fixes in response (#14230)

This commit is contained in:
Vishal Nayak 2022-02-23 13:17:53 -05:00 committed by GitHub
parent 96f5f3cf50
commit 35d3d4226d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1552,8 +1552,10 @@ func (a *ActivityLog) handleQuery(ctx context.Context, startTime, endTime time.T
mountResponse = append(mountResponse, &ResponseMount{
MountPath: mountRecord.MountPath,
Counts: &ResponseCounts{
DistinctEntities: int(mountRecord.Counts.EntityClients),
EntityClients: int(mountRecord.Counts.EntityClients),
NonEntityClients: int(mountRecord.Counts.NonEntityClients),
NonEntityTokens: int(mountRecord.Counts.NonEntityClients),
Clients: int(mountRecord.Counts.EntityClients + mountRecord.Counts.NonEntityClients),
},
})
@ -2119,14 +2121,16 @@ func (a *ActivityLog) precomputedQueryWorker(ctx context.Context) error {
// Process mount specific data within a namespace within a given month
mountRecord := make([]*activity.MountRecord, 0, len(nsMap[nsID].Mounts))
for mountAccessor, mountData := range nsMap[nsID].Mounts {
var displayPath string
valResp := a.core.router.ValidateMountByAccessor(mountAccessor)
if valResp == nil {
// Add the mount to the response only if the mount is
// still valid.
continue
displayPath = fmt.Sprintf("deleted mount; accessor %q", mountAccessor)
} else {
displayPath = valResp.MountPath
}
mountRecord = append(mountRecord, &activity.MountRecord{
MountPath: valResp.MountPath,
MountPath: displayPath,
Counts: &activity.CountsRecord{
EntityClients: len(mountData.Counts.Entities),
NonEntityClients: int(mountData.Counts.Tokens) + len(mountData.Counts.NonEntities),