2525import com .navercorp .pinpoint .common .util .DefaultSqlParser ;
2626import com .navercorp .pinpoint .common .util .OutputParameterParser ;
2727import com .navercorp .pinpoint .common .util .SqlParser ;
28+ import com .navercorp .pinpoint .web .view .TransactionInfoViewModel ;
2829import org .slf4j .Logger ;
2930import org .slf4j .LoggerFactory ;
3031import org .springframework .beans .factory .annotation .Autowired ;
@@ -89,61 +90,6 @@ public class BusinessTransactionController {
8990 private SqlParser sqlParser = new DefaultSqlParser ();
9091 private OutputParameterParser parameterParser = new OutputParameterParser ();
9192
92- /**
93- * executed URLs in applicationname query within from ~ to timeframe
94- *
95- * @param model
96- * @param applicationName
97- * @param from
98- * @param to
99- * @return
100- */
101- @ Deprecated
102- @ RequestMapping (value = "/transactionList" , method = RequestMethod .GET )
103- @ ResponseBody
104- public Model getBusinessTransactionsData (Model model ,
105- @ RequestParam ("application" ) String applicationName ,
106- @ RequestParam ("from" ) long from ,
107- @ RequestParam ("to" ) long to ,
108- @ RequestParam (value = "filter" , required = false ) String filterText ,
109- @ RequestParam (value = "limit" , required = false , defaultValue = "10000" ) int limit ) {
110- limit = LimitUtils .checkRange (limit );
111- Range range = new Range (from , to );
112- // TODO more refactoring needed: partially separated out server map lookup logic.
113- LimitedScanResult <List <TransactionId >> traceIdList = filteredMapService .selectTraceIdsFromApplicationTraceIndex (applicationName , range , limit );
114-
115- Filter filter = filterBuilder .build (filterText );
116- BusinessTransactions selectBusinessTransactions = transactionInfoService .selectBusinessTransactions (traceIdList .getScanData (), applicationName , range , filter );
117-
118- model .addAttribute ("lastFetchedTimestamp" , traceIdList .getLimitedTime ());
119- model .addAttribute ("rpcList" , selectBusinessTransactions .getBusinessTransaction ());
120- model .addAttribute ("requestList" , selectBusinessTransactions .getBusinessTransaction ());
121- model .addAttribute ("scatterList" , selectBusinessTransactions .getBusinessTransaction ());
122- model .addAttribute ("applicationName" , applicationName );
123- model .addAttribute ("from" , new Date (from ));
124- model .addAttribute ("to" , new Date (to ));
125- model .addAttribute ("urlCount" , selectBusinessTransactions .getURLCount ());
126- model .addAttribute ("totalCount" , selectBusinessTransactions .getTotalCallCount ());
127- model .addAttribute ("filterText" , filterText );
128- model .addAttribute ("filter" , filter );
129- // Deprecated jsp -> need json dump
130- return model ;
131- }
132-
133- @ Deprecated
134- @ RequestMapping (value = "/lastTransactionList" , method = RequestMethod .GET )
135- @ ResponseBody
136- public Model getLastBusinessTransactionsData (Model model , HttpServletResponse response ,
137- @ RequestParam ("application" ) String applicationName ,
138- @ RequestParam ("period" ) long period ,
139- @ RequestParam (value = "filter" , required = false ) String filterText ,
140- @ RequestParam (value = "limit" , required = false , defaultValue = "10000" ) int limit ) {
141- limit = LimitUtils .checkRange (limit );
142- long to = TimeUtils .getDelayLastTime ();
143- long from = to - period ;
144- return getBusinessTransactionsData (model , applicationName , from , to , filterText , limit );
145- }
146-
14793 /**
14894 * info lookup for a selected transaction
14995 *
@@ -152,63 +98,24 @@ public Model getLastBusinessTransactionsData(Model model, HttpServletResponse re
15298 * @return
15399 */
154100 @ RequestMapping (value = "/transactionInfo" , method = RequestMethod .GET )
155- public ModelAndView transactionInfo (@ RequestParam ("traceId" ) String traceIdParam ,
101+ @ ResponseBody
102+ public TransactionInfoViewModel transactionInfo (@ RequestParam ("traceId" ) String traceIdParam ,
156103 @ RequestParam (value = "focusTimestamp" , required = false , defaultValue = "0" ) long focusTimestamp ,
157104 @ RequestParam (value = "v" , required = false , defaultValue = "0" ) int viewVersion ,
158105 HttpServletResponse response ) {
159106 logger .debug ("traceId:{}" , traceIdParam );
160-
161107 final TransactionId traceId = new TransactionId (traceIdParam );
162108
163109 // select spans
164110 final SpanResult spanResult = this .spanService .selectSpan (traceId , focusTimestamp );
165111 final CallTreeIterator callTreeIterator = spanResult .getCallTree ();
166112
167- if (callTreeIterator .isEmpty ()) {
168- // TODO fix error page.
169- final ModelAndView error = new ModelAndView ();
170- // redefine errorCode.???
171- error .addObject ("errorCode" , 9 );
172- error .addObject ("message" , "Trace not found. traceId:" + traceId );
173- error .setViewName ("error" );
174- return error ;
175- }
176-
177- final ModelAndView mv = new ModelAndView ();
178- // debug
179- mv .addObject ("spanList" , callTreeIterator .values ());
180-
181- mv .addObject ("traceId" , traceId );
182-
183113 // application map
184114 ApplicationMap map = filteredMapService .selectApplicationMap (traceId );
185- mv .addObject ("nodes" , map .getNodes ());
186- mv .addObject ("links" , map .getLinks ());
187-
188- // call stacks
189115 RecordSet recordSet = this .transactionInfoService .createRecordSet (callTreeIterator , focusTimestamp );
190- mv .addObject ("recordSet" , recordSet );
191-
192- mv .addObject ("applicationName" , recordSet .getApplicationName ());
193- mv .addObject ("callstack" , recordSet .getRecordList ());
194- mv .addObject ("timeline" , recordSet .getRecordList ());
195- mv .addObject ("callstackStart" , recordSet .getStartTime ());
196- mv .addObject ("callstackEnd" , recordSet .getEndTime ());
197- mv .addObject ("completeState" , spanResult .getCompleteTypeString ());
198-
199- mv .addObject ("logLinkEnable" , logLinkEnable );
200- mv .addObject ("loggingTransactionInfo" , recordSet .isLoggingTransactionInfo ());
201- mv .addObject ("logButtonName" , logButtonName );
202- mv .addObject ("logPageUrl" , logPageUrl );
203- mv .addObject ("disableButtonMessage" , disableButtonMessage );
204-
205- if (viewVersion == 2 ) {
206- // TODO remove hashformat
207- mv .setViewName ("transactionInfoJsonHash" );
208- } else {
209- mv .setViewName ("transactionInfoJson" );
210- }
211- return mv ;
116+
117+ TransactionInfoViewModel result = new TransactionInfoViewModel (traceId , map .getNodes (), map .getLinks (), recordSet , spanResult .getCompleteTypeString (), logLinkEnable , logButtonName , logPageUrl , disableButtonMessage );
118+ return result ;
212119 }
213120
214121 @ RequestMapping (value = "/sqlBind" , method = RequestMethod .POST )
0 commit comments