fix: remove the top 10 limit on key operations table (#2824)

Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
Srikanth Chekuri 2023-06-06 17:25:53 +05:30 committed by GitHub
parent a3c917cca0
commit a52c104562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1870,14 +1870,18 @@ func (r *ClickHouseReader) GetTopOperations(ctx context.Context, queryParams *mo
if errStatus != nil {
return nil, errStatus
}
query += " GROUP BY name ORDER BY p99 DESC LIMIT 10"
query += " GROUP BY name ORDER BY p99 DESC"
if queryParams.Limit > 0 {
query += " LIMIT @limit"
args = append(args, clickhouse.Named("limit", queryParams.Limit))
}
err := r.db.Select(ctx, &topOperationsItems, query, args...)
zap.S().Debug(query)
if err != nil {
zap.S().Error("Error in processing sql query: ", err)
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query")}
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("error in processing sql query")}
}
if topOperationsItems == nil {

View File

@ -160,6 +160,7 @@ type GetTopOperationsParams struct {
Start *time.Time
End *time.Time
Tags []TagQueryParam `json:"tags"`
Limit int `json:"limit"`
}
type GetUsageParams struct {