Tempo: Return a not found error if the trace is empty from v2 (#95256)

Return a not found error if the trace is empty from v2
This commit is contained in:
Andre Pereira
2024-10-23 15:14:40 +01:00
committed by GitHub
parent 15de8a5433
commit 0872eb2791

View File

@@ -114,6 +114,14 @@ func (s *Service) getTrace(ctx context.Context, pCtx backend.PluginContext, quer
return &backend.DataResponse{}, fmt.Errorf("failed to transform trace %v to data frame: %w", model.Query, err)
}
if frame == nil {
result.Status = http.StatusNotFound
result.Error = fmt.Errorf("failed to get trace with id: %s Status: %s", *model.Query, result.Status)
span.RecordError(result.Error)
span.SetStatus(codes.Error, result.Error.Error())
return result, nil
}
frame.Meta.Custom = map[string]interface{}{
"partial": tr.GetStatus() == tempopb.TraceByIDResponse_PARTIAL,
"message": tr.GetMessage(),