mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 06:29:02 +08:00
fix: apply filters on count of exceptions (#1945)
This commit is contained in:
parent
27cd514fa5
commit
6ba5c0ecad
@ -108,12 +108,21 @@ function AllErrors(): JSX.Element {
|
|||||||
enabled: !loading,
|
enabled: !loading,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
queryKey: ['getErrorCounts', maxTime, minTime],
|
queryKey: [
|
||||||
|
'getErrorCounts',
|
||||||
|
maxTime,
|
||||||
|
minTime,
|
||||||
|
getUpdatedExceptionType,
|
||||||
|
getUpdatedServiceName,
|
||||||
|
],
|
||||||
queryFn: (): Promise<ErrorResponse | SuccessResponse<number>> =>
|
queryFn: (): Promise<ErrorResponse | SuccessResponse<number>> =>
|
||||||
getErrorCounts({
|
getErrorCounts({
|
||||||
end: maxTime,
|
end: maxTime,
|
||||||
start: minTime,
|
start: minTime,
|
||||||
|
exceptionType: getUpdatedExceptionType,
|
||||||
|
serviceName: getUpdatedServiceName,
|
||||||
}),
|
}),
|
||||||
|
enabled: !loading,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ import { GlobalTime } from 'types/actions/globalTime';
|
|||||||
export type Props = {
|
export type Props = {
|
||||||
start: GlobalTime['minTime'];
|
start: GlobalTime['minTime'];
|
||||||
end: GlobalTime['minTime'];
|
end: GlobalTime['minTime'];
|
||||||
|
exceptionType: string;
|
||||||
|
serviceName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PayloadProps = number;
|
export type PayloadProps = number;
|
||||||
|
@ -2592,12 +2592,12 @@ func (r *ClickHouseReader) CountErrors(ctx context.Context, queryParams *model.C
|
|||||||
query := fmt.Sprintf("SELECT count(distinct(groupID)) FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.errorTable)
|
query := fmt.Sprintf("SELECT count(distinct(groupID)) FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.errorTable)
|
||||||
args := []interface{}{clickhouse.Named("timestampL", strconv.FormatInt(queryParams.Start.UnixNano(), 10)), clickhouse.Named("timestampU", strconv.FormatInt(queryParams.End.UnixNano(), 10))}
|
args := []interface{}{clickhouse.Named("timestampL", strconv.FormatInt(queryParams.Start.UnixNano(), 10)), clickhouse.Named("timestampU", strconv.FormatInt(queryParams.End.UnixNano(), 10))}
|
||||||
if len(queryParams.ServiceName) != 0 {
|
if len(queryParams.ServiceName) != 0 {
|
||||||
query = query + " AND serviceName = @serviceName"
|
query = query + " AND serviceName ilike @serviceName"
|
||||||
args = append(args, clickhouse.Named("serviceName", queryParams.ServiceName))
|
args = append(args, clickhouse.Named("serviceName", "%"+queryParams.ServiceName+"%"))
|
||||||
}
|
}
|
||||||
if len(queryParams.ExceptionType) != 0 {
|
if len(queryParams.ExceptionType) != 0 {
|
||||||
query = query + " AND exceptionType = @exceptionType"
|
query = query + " AND exceptionType ilike @exceptionType"
|
||||||
args = append(args, clickhouse.Named("exceptionType", queryParams.ExceptionType))
|
args = append(args, clickhouse.Named("exceptionType", "%"+queryParams.ExceptionType+"%"))
|
||||||
}
|
}
|
||||||
err := r.db.QueryRow(ctx, query, args...).Scan(&errorCount)
|
err := r.db.QueryRow(ctx, query, args...).Scan(&errorCount)
|
||||||
zap.S().Info(query)
|
zap.S().Info(query)
|
||||||
|
@ -507,10 +507,14 @@ func parseCountErrorsRequest(r *http.Request) (*model.CountErrorsParams, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
serviceName := r.URL.Query().Get("serviceName")
|
||||||
|
exceptionType := r.URL.Query().Get("exceptionType")
|
||||||
|
|
||||||
params := &model.CountErrorsParams{
|
params := &model.CountErrorsParams{
|
||||||
Start: startTime,
|
Start: startTime,
|
||||||
End: endTime,
|
End: endTime,
|
||||||
|
ServiceName: serviceName,
|
||||||
|
ExceptionType: exceptionType,
|
||||||
}
|
}
|
||||||
|
|
||||||
return params, nil
|
return params, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user