Skip to content

Commit

Permalink
Merge pull request #1084 from Bee-lee/redis-fixes
Browse files Browse the repository at this point in the history
add timing logs to a problemtic REST API handler `v2/getClustersView`
  • Loading branch information
Bee-lee authored Jul 13, 2023
2 parents 8607f33 + b766c5f commit 5c87f48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/handlers_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ func (server HTTPServer) getClustersView(writer http.ResponseWriter, request *ht
orgID,
userID,
)
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClustersView start, after getClusterListAndUserData took %s", time.Since(tStart))

clusterViewResponse, err := matchClusterInfoAndUserData(
clusterList, clusterRuleHits, ackedRulesMap, disabledRules,
Expand All @@ -403,6 +404,7 @@ func (server HTTPServer) getClustersView(writer http.ResponseWriter, request *ht
log.Error().Uint32(orgIDTag, uint32(orgID)).Err(err).Msg("getClustersView error generating cluster list response")
handleServerError(writer, err)
}
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClustersView start, after matchClusterInfoAndUserData took %s", time.Since(tStart))
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("getClustersView final number %v", len(clusterViewResponse))

resp := make(map[string]interface{})
Expand Down
5 changes: 5 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1439,13 +1439,15 @@ func (server *HTTPServer) getClusterListAndUserData(
ackedRulesMap map[ctypes.RuleID]bool,
disabledRulesPerCluster map[ctypes.ClusterName][]ctypes.RuleID,
) {
tStart := time.Now()
// get list of clusters from AMS API or aggregator
clusterInfoList, err := server.readClusterInfoForOrgID(orgID)
if err != nil {
log.Error().Err(err).Int(orgIDTag, int(orgID)).Msg("problem reading cluster list for org")
handleServerError(writer, err)
return
}
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClusterListAndUserData start, after readClusterInfoForOrgID took %s", time.Since(tStart))
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf(
"getClusterListAndUserData number of clusters before processing %d", len(clusterInfoList),
)
Expand All @@ -1461,6 +1463,7 @@ func (server *HTTPServer) getClusterListAndUserData(

return
}
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClusterListAndUserData start, after getClustersAndRecommendations took %s", time.Since(tStart))
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf(
"getClusterListAndUserData getting clusters and impacting recommendations from aggregator took %s", time.Since(tStartImpacting),
)
Expand All @@ -1471,9 +1474,11 @@ func (server *HTTPServer) getClusterListAndUserData(
handleServerError(writer, err)
return
}
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClusterListAndUserData start, after getRuleAcksMap took %s", time.Since(tStart))

// retrieve list of cluster IDs and single disabled rules for each cluster
disabledRulesPerCluster = server.getUserDisabledRulesPerCluster(orgID)
log.Info().Uint32(orgIDTag, uint32(orgID)).Msgf("time since getClusterListAndUserData start, after getUserDisabledRulesPerCluster took %s", time.Since(tStart))

return
}

0 comments on commit 5c87f48

Please sign in to comment.