biz.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  1. <template>
  2. <div>
  3. <!-- <el-progress :percentage="100" status="success"></el-progress> @submit.native.prevent -->
  4. <el-form ref="queryTrace" :model="queryTrace" :inline="true" label-width="68px" @submit.native.prevent>
  5. <el-form-item label="" prop="trace_id">
  6. <el-input
  7. style='width:220px'
  8. v-model="queryTrace.trace_id"
  9. placeholder="TraceID"
  10. clearable
  11. size="mini"
  12. @input='$forceUpdate()'
  13. @paste.native.capture.prevent="handlePaste"
  14. @keyup.enter.native="handleQuery"
  15. />
  16. </el-form-item>
  17. </el-form>
  18. <el-table
  19. v-loading="loading"
  20. :data="selectList"
  21. border
  22. @row-click="handleRowClick"
  23. ref="table"
  24. highlight-current-row
  25. >
  26. <el-table-column
  27. type="index"
  28. width="50" label="#">
  29. </el-table-column>
  30. <el-table-column label="TraceID" prop="trace_id" header-align="center" :show-overflow-tooltip="true" align="center" />
  31. <el-table-column label="开始时间" prop="timestamp" header-align="center" :show-overflow-tooltip="true" align="center">
  32. <template slot-scope="scope">
  33. <span>{{ parseTime(scope.row.timestamp) }}</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="持续时间(ms)" header-align="right" prop="duration" align="right"/>
  37. <el-table-column label="涉及的服务数量" header-align="right" prop="service_num" align="right"/>
  38. <el-table-column label="包含的span数量" header-align="right" prop="span_num" align="right"/>
  39. <!-- <el-table-column label="调用深度" header-align="right" prop="max_depth" align="right"/> -->
  40. </el-table>
  41. <pagination
  42. v-show="total>0"
  43. :total="total"
  44. :page.sync="queryTrace.pageIndex"
  45. :limit.sync="queryTrace.pageSize"
  46. @pagination="getTraceList"
  47. />
  48. <div style="margin-top:32px;">
  49. <div class='css-container' style="margin-bottom:24px;">
  50. <div class='css-header'>
  51. <div class='css-title'>Trace</div>
  52. </div>
  53. <div class='css-content' v-if='tableDetail !=null'>
  54. <div class='css-page-header'>
  55. <div class='css-name'>
  56. <div class='css-name-title'>
  57. <span class='trace-name'>
  58. <span class='css-text'>{{tableDetail.service_name}}:</span>
  59. <span class='css-text'>{{tableDetail.span_name}}</span>
  60. <!-- <span class='css-text'>Convert</span> -->
  61. </span>
  62. <small class='css-small'>{{tableDetail.duration}}ms</small>
  63. </div>
  64. <div class='css-action'>
  65. TraceID: <span v-cloak>{{tractID}}</span>
  66. </div>
  67. </div>
  68. <div class='css-time-box'>
  69. <span class='css-time-wrap'>
  70. <span class='css-time-value'>{{parseTime(tableDetail.timestamp)}}
  71. <!-- <span class='css-time-vlaue-detail'>:07.635</span> -->
  72. </span>
  73. </span>
  74. <span class='css-type'>
  75. <el-tag size="mini" style='margin-right:8px'>{{tableDetail.http_method}}</el-tag>
  76. <el-tag size="mini" :type="tableDetail.http_code>300?'danger':'success'" style='margin-right:8px'>{{tableDetail.http_code}}</el-tag>
  77. <span class='css-api'>{{tableDetail.span_attributes!=undefined?tableDetail.span_attributes['http.url']:tableDetail.http_url}}</span>
  78. </span>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="TreeBox" style="margin-bottom:24px;">
  84. <div>
  85. <el-button-group>
  86. <el-button size="mini" type="primary" @click='toggleTab(1)'>Trace Tree</el-button>
  87. <el-button size="mini" type="primary" @click='toggleTab(2)'>Trace Map</el-button>
  88. <el-button size="mini" type="primary" @click='toggleTab(3)'>Deep Tree</el-button>
  89. </el-button-group>
  90. <div style='display:inline-block;vertical-align: middle;'>
  91. <el-dropdown
  92. style="margin-left: 10px"
  93. size="mini"
  94. trigger="click"
  95. placement="bottom"
  96. >
  97. <el-button type="primary" size="mini">
  98. <!-- 下拉菜单 -->
  99. <i class="el-icon-s-grid" />
  100. <i class="el-icon-arrow-down"></i>
  101. </el-button>
  102. <el-dropdown-menu slot="dropdown">
  103. <el-checkbox-group
  104. v-model="colSelect"
  105. style="text-align: left"
  106. @change="columnChange"
  107. >
  108. <el-dropdown-item
  109. v-for="(item, index) in colData"
  110. :key="index"
  111. ><el-checkbox :label="item.title">{{
  112. item.title
  113. }}</el-checkbox></el-dropdown-item
  114. >
  115. </el-checkbox-group>
  116. </el-dropdown-menu>
  117. </el-dropdown>
  118. </div>
  119. </div>
  120. <div style='font-size:14px;font-weight:bold;'>
  121. <!-- <el-button size="mini" icon="el-icon-full-screen" @click.native.prevent='clickFull'></el-button> -->
  122. <svg-icon :icon-class="isFull?'exit-fullscreen':'fullscreen'" @click.native.prevent="clickFull" />
  123. </div>
  124. </div>
  125. <div v-if='flag==true' style='position:relative;'>
  126. <div v-if='num == 1' class='tree_box'>
  127. </div>
  128. <div v-if="num ==2">
  129. <el-table
  130. v-loading="treeLoading"
  131. :data="tableData"
  132. :row-key="getRowKeys"
  133. :indent='4'
  134. style="width: 100%;margin-bottom: 20px;"
  135. border
  136. default-expand-all
  137. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  138. :row-class-name="status_change"
  139. :row-style="rowClassRender"
  140. @row-click='clickRowHandle'
  141. >
  142. <el-table-column
  143. prop="service_name"
  144. label="Name"
  145. header-align="center"
  146. :show-overflow-tooltip="true"
  147. v-if="colData[0].istrue"
  148. >
  149. <template slot-scope="scope">
  150. <span>{{scope.row.service_name}}<span>({{scope.row.span_name}})</span></span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. prop="timestamp"
  155. label="StartTime"
  156. align='center'
  157. header-align="center"
  158. :show-overflow-tooltip="true"
  159. v-if="colData[1].istrue"
  160. >
  161. <template slot-scope="scope">
  162. <span>{{ parseTime(scope.row.timestamp) }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column
  166. prop="duration"
  167. label="Cost(ms)"
  168. align='right'
  169. header-align="right"
  170. width='120'
  171. :show-overflow-tooltip="true"
  172. v-if="colData[2].istrue"
  173. >
  174. </el-table-column>
  175. <el-table-column
  176. prop="duration_persent"
  177. label="Duration(%)"
  178. header-align="center"
  179. v-if="colData[3].istrue"
  180. >
  181. <template slot-scope="scope">
  182. <!-- <div @click='getRowData(scope.row)' style="cursor: pointer;"> -->
  183. <div>
  184. <el-progress :percentage="scope.row.duration_persent * 100" color="#4343c8" :show-text='false' define-back-color='#E3E7ED'></el-progress>
  185. </div>
  186. </template>
  187. </el-table-column>
  188. <!-- <el-table-column
  189. prop="status_code"
  190. label="StatusCode"
  191. header-align="center"
  192. :show-overflow-tooltip="true"
  193. v-if="colData[4].istrue"
  194. >
  195. </el-table-column> -->
  196. <el-table-column
  197. prop="span_kind"
  198. label="SpanKind"
  199. header-align="center"
  200. :show-overflow-tooltip="true"
  201. v-if="colData[4].istrue"
  202. >
  203. </el-table-column>
  204. <el-table-column
  205. prop="service_name"
  206. label="ServiceName"
  207. header-align="center"
  208. :show-overflow-tooltip="true"
  209. v-if="colData[5].istrue"
  210. >
  211. </el-table-column>
  212. <el-table-column
  213. prop="events_attributes"
  214. label="EventsAttributes"
  215. header-align="center"
  216. :show-overflow-tooltip="true"
  217. v-if="colData[6].istrue"
  218. width="120"
  219. >
  220. </el-table-column>
  221. <el-table-column
  222. prop="events_name"
  223. label="EventsName"
  224. header-align="center"
  225. :show-overflow-tooltip="true"
  226. v-if="colData[7].istrue"
  227. >
  228. </el-table-column>
  229. <el-table-column
  230. prop="events_timestamp"
  231. label="EventsTimestamp"
  232. header-align="center"
  233. :show-overflow-tooltip="true"
  234. v-if="colData[8].istrue"
  235. width="120"
  236. >
  237. </el-table-column>
  238. <el-table-column
  239. prop="http_url"
  240. label="HttpUrl"
  241. header-align="center"
  242. :show-overflow-tooltip="true"
  243. v-if="colData[9].istrue"
  244. >
  245. </el-table-column>
  246. <el-table-column
  247. prop="http_method"
  248. label="HttpMethod"
  249. header-align="center"
  250. :show-overflow-tooltip="true"
  251. v-if="colData[10].istrue"
  252. >
  253. </el-table-column>
  254. <el-table-column
  255. prop="container_id"
  256. label="ContainerId"
  257. header-align="center"
  258. :show-overflow-tooltip="true"
  259. v-if="colData[11].istrue"
  260. >
  261. </el-table-column>
  262. <el-table-column
  263. prop="http_code"
  264. label="httpCode"
  265. header-align="center"
  266. :show-overflow-tooltip="true"
  267. v-if="colData[12].istrue"
  268. >
  269. </el-table-column>
  270. <el-table-column
  271. prop="db_connection_string"
  272. label="DbConnectionString"
  273. v-if="colData[13].istrue"
  274. :show-overflow-tooltip="true"
  275. >
  276. <template slot-scope="scope">
  277. <span>{{scope.row.db_connection_string}}</span>
  278. </template>
  279. </el-table-column>
  280. <el-table-column
  281. prop="rpc_method"
  282. label="RpcMethod"
  283. v-if="colData[14].istrue"
  284. :show-overflow-tooltip="true"
  285. >
  286. </el-table-column>
  287. <el-table-column
  288. prop="resource_attributes"
  289. label="ResourceAttributes"
  290. v-if="colData[15].istrue"
  291. :show-overflow-tooltip="true"
  292. >
  293. <template slot-scope="scope">
  294. <span>{{JSON.stringify(scope.row.resource_attributes)}}</span>
  295. </template>
  296. </el-table-column>
  297. <el-table-column
  298. prop="span_attributes"
  299. label="SpanAttributes"
  300. v-if="colData[16].istrue"
  301. :show-overflow-tooltip="true"
  302. >
  303. <template slot-scope="scope">
  304. <span>{{JSON.stringify(scope.row.span_attributes)}}</span>
  305. </template>
  306. </el-table-column>
  307. <el-table-column
  308. prop="max_depth"
  309. label="MaxDepth"
  310. v-if="colData[17].istrue"
  311. :show-overflow-tooltip="true"
  312. >
  313. </el-table-column>
  314. <!-- <el-table-column
  315. prop="db_connection_string"
  316. label="dbConnectionString"
  317. v-if="colData[18].istrue"
  318. :show-overflow-tooltip="true"
  319. >
  320. </el-table-column> -->
  321. <el-table-column
  322. prop="db_statement"
  323. label="DbStatement"
  324. v-if="colData[18].istrue"
  325. :show-overflow-tooltip="true"
  326. >
  327. </el-table-column>
  328. </el-table>
  329. </div>
  330. <div v-if="num ==3" style='position:relative;'>
  331. <iframe src='gi-topo-analyst2.html' style="width:100%;height:calc(100vh - 60px);min-height:800px;margin-top: -10px;"
  332. id="myIframe"
  333. scrolling='auto'
  334. frameBorder='no'
  335. border='0'
  336. marginWidth='0'
  337. marginHeight='0'></iframe>
  338. </div>
  339. </div>
  340. </div>
  341. <el-dialog
  342. :visible.sync="Visible"
  343. :fullscreen='true'
  344. center>
  345. <div style="margin-top:32px;">
  346. <div class='css-container' style="margin-bottom:24px;">
  347. <div class='css-header'>
  348. <div class='css-title'>Trace</div>
  349. </div>
  350. <div class='css-content' v-if='tableDetail !=null'>
  351. <div class='css-page-header'>
  352. <div class='css-name'>
  353. <div class='css-name-title'>
  354. <span class='trace-name'>
  355. <span class='css-text'>{{tableDetail.service_name}}:</span>
  356. <span class='css-text'>{{tableDetail.span_name}}</span>
  357. <!-- <span class='css-text'>Convert</span> -->
  358. </span>
  359. <small class='css-small'>{{tableDetail.duration}}ms</small>
  360. </div>
  361. <div class='css-action'>
  362. TraceID: <span v-cloak>{{tractID}}</span>
  363. </div>
  364. </div>
  365. <div class='css-time-box'>
  366. <span class='css-time-wrap'>
  367. <span class='css-time-value'>{{parseTime(tableDetail.timestamp)}}
  368. <!-- <span class='css-time-vlaue-detail'>:07.635</span> -->
  369. </span>
  370. </span>
  371. <span class='css-type'>
  372. <el-tag size="mini" style='margin-right:8px'>{{tableDetail.http_method}}</el-tag>
  373. <el-tag size="mini" :type="tableDetail.http_code>300?'danger':'success'" style='margin-right:8px'>{{tableDetail.http_code}}</el-tag>
  374. <span class='css-api'>{{tableDetail.span_attributes!=undefined?tableDetail.span_attributes['http.url']:tableDetail.http_url}}</span>
  375. </span>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. <div class="TreeBox" style="margin-bottom:24px;">
  381. <div>
  382. <el-button-group>
  383. <el-button size="mini" type="primary" @click='toggleTab(1)'>Trace Tree</el-button>
  384. <el-button size="mini" type="primary" @click='toggleTab(2)'>Trace Map</el-button>
  385. <el-button size="mini" type="primary" @click='toggleTab(3)'>Deep Tree</el-button>
  386. </el-button-group>
  387. <div style='display:inline-block;vertical-align: middle;'>
  388. <el-dropdown
  389. style="margin-left: 10px"
  390. size="mini"
  391. trigger="click"
  392. placement="bottom"
  393. >
  394. <el-button type="primary" size="mini">
  395. <!-- 下拉菜单 -->
  396. <i class="el-icon-s-grid" />
  397. <i class="el-icon-arrow-down"></i>
  398. </el-button>
  399. <el-dropdown-menu slot="dropdown">
  400. <el-checkbox-group
  401. v-model="colSelect"
  402. style="text-align: left"
  403. @change="columnChange"
  404. >
  405. <el-dropdown-item
  406. v-for="(item, index) in colData"
  407. :key="index"
  408. ><el-checkbox :label="item.title">{{
  409. item.title
  410. }}</el-checkbox></el-dropdown-item
  411. >
  412. </el-checkbox-group>
  413. </el-dropdown-menu>
  414. </el-dropdown>
  415. </div>
  416. </div>
  417. <div style='font-size:14px;font-weight:bold;'>
  418. </div>
  419. </div>
  420. <div v-if='flag==true' style='position:relative;'>
  421. <div v-if='num == 1' class='tree_box'>
  422. </div>
  423. <div v-if="num ==2">
  424. <el-table
  425. v-loading="treeLoading"
  426. :data="tableData"
  427. :row-key="getRowKeys"
  428. :indent='4'
  429. style="width: 100%;margin-bottom: 20px;"
  430. border
  431. default-expand-all
  432. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  433. :row-class-name="status_change"
  434. :row-style="rowClassRender"
  435. @row-click='clickRowHandle'
  436. >
  437. <el-table-column
  438. prop="service_name"
  439. label="Name"
  440. header-align="center"
  441. :show-overflow-tooltip="true"
  442. v-if="colData[0].istrue"
  443. >
  444. <template slot-scope="scope">
  445. <span>{{scope.row.service_name}}<span>({{scope.row.span_name}})</span></span>
  446. </template>
  447. </el-table-column>
  448. <el-table-column
  449. prop="timestamp"
  450. label="StartTime"
  451. align='center'
  452. header-align="center"
  453. :show-overflow-tooltip="true"
  454. v-if="colData[1].istrue"
  455. >
  456. <template slot-scope="scope">
  457. <span>{{ parseTime(scope.row.timestamp) }}</span>
  458. </template>
  459. </el-table-column>
  460. <el-table-column
  461. prop="duration"
  462. label="Cost(ms)"
  463. align='right'
  464. header-align="right"
  465. width='120'
  466. :show-overflow-tooltip="true"
  467. v-if="colData[2].istrue"
  468. >
  469. </el-table-column>
  470. <el-table-column
  471. prop="duration_persent"
  472. label="Duration(%)"
  473. header-align="center"
  474. v-if="colData[3].istrue"
  475. >
  476. <template slot-scope="scope">
  477. <!-- <div @click='getRowData(scope.row)' style="cursor: pointer;"> -->
  478. <div>
  479. <el-progress :percentage="scope.row.duration_persent * 100" color="#4343c8" :show-text='false' define-back-color='#E3E7ED'></el-progress>
  480. </div>
  481. </template>
  482. </el-table-column>
  483. <!-- <el-table-column
  484. prop="status_code"
  485. label="StatusCode"
  486. header-align="center"
  487. :show-overflow-tooltip="true"
  488. v-if="colData[4].istrue"
  489. >
  490. </el-table-column> -->
  491. <el-table-column
  492. prop="span_kind"
  493. label="SpanKind"
  494. header-align="center"
  495. :show-overflow-tooltip="true"
  496. v-if="colData[4].istrue"
  497. >
  498. </el-table-column>
  499. <el-table-column
  500. prop="service_name"
  501. label="ServiceName"
  502. header-align="center"
  503. :show-overflow-tooltip="true"
  504. v-if="colData[5].istrue"
  505. >
  506. </el-table-column>
  507. <el-table-column
  508. prop="events_attributes"
  509. label="EventsAttributes"
  510. header-align="center"
  511. :show-overflow-tooltip="true"
  512. v-if="colData[6].istrue"
  513. width="120"
  514. >
  515. </el-table-column>
  516. <el-table-column
  517. prop="events_name"
  518. label="EventsName"
  519. header-align="center"
  520. :show-overflow-tooltip="true"
  521. v-if="colData[7].istrue"
  522. >
  523. </el-table-column>
  524. <el-table-column
  525. prop="events_timestamp"
  526. label="EventsTimestamp"
  527. header-align="center"
  528. :show-overflow-tooltip="true"
  529. v-if="colData[8].istrue"
  530. width="120"
  531. >
  532. </el-table-column>
  533. <el-table-column
  534. prop="http_url"
  535. label="HttpUrl"
  536. header-align="center"
  537. :show-overflow-tooltip="true"
  538. v-if="colData[9].istrue"
  539. >
  540. </el-table-column>
  541. <el-table-column
  542. prop="http_method"
  543. label="HttpMethod"
  544. header-align="center"
  545. :show-overflow-tooltip="true"
  546. v-if="colData[10].istrue"
  547. >
  548. </el-table-column>
  549. <el-table-column
  550. prop="container_id"
  551. label="ContainerId"
  552. header-align="center"
  553. :show-overflow-tooltip="true"
  554. v-if="colData[11].istrue"
  555. >
  556. </el-table-column>
  557. <el-table-column
  558. prop="http_code"
  559. label="httpCode"
  560. header-align="center"
  561. :show-overflow-tooltip="true"
  562. v-if="colData[12].istrue"
  563. >
  564. </el-table-column>
  565. <el-table-column
  566. prop="db_connection_string"
  567. label="DbConnectionString"
  568. v-if="colData[13].istrue"
  569. :show-overflow-tooltip="true"
  570. >
  571. <template slot-scope="scope">
  572. <span>{{scope.row.db_connection_string}}</span>
  573. </template>
  574. </el-table-column>
  575. <el-table-column
  576. prop="rpc_method"
  577. label="RpcMethod"
  578. v-if="colData[14].istrue"
  579. :show-overflow-tooltip="true"
  580. >
  581. </el-table-column>
  582. <el-table-column
  583. prop="resource_attributes"
  584. label="ResourceAttributes"
  585. v-if="colData[15].istrue"
  586. :show-overflow-tooltip="true"
  587. >
  588. <template slot-scope="scope">
  589. <span>{{JSON.stringify(scope.row.resource_attributes)}}</span>
  590. </template>
  591. </el-table-column>
  592. <el-table-column
  593. prop="span_attributes"
  594. label="SpanAttributes"
  595. v-if="colData[16].istrue"
  596. :show-overflow-tooltip="true"
  597. >
  598. <template slot-scope="scope">
  599. <span>{{JSON.stringify(scope.row.span_attributes)}}</span>
  600. </template>
  601. </el-table-column>
  602. <el-table-column
  603. prop="max_depth"
  604. label="MaxDepth"
  605. v-if="colData[17].istrue"
  606. :show-overflow-tooltip="true"
  607. >
  608. </el-table-column>
  609. <!-- <el-table-column
  610. prop="db_connection_string"
  611. label="dbConnectionString"
  612. v-if="colData[18].istrue"
  613. :show-overflow-tooltip="true"
  614. >
  615. </el-table-column> -->
  616. <el-table-column
  617. prop="db_statement"
  618. label="DbStatement"
  619. v-if="colData[18].istrue"
  620. :show-overflow-tooltip="true"
  621. >
  622. </el-table-column>
  623. </el-table>
  624. </div>
  625. <div v-if="num ==3" style='position:relative;'>
  626. <iframe src='gi-topo-analyst2.html' style="width:100%;height:calc(100vh - 60px);min-height:800px;margin-top: -10px;"
  627. id="myIframe"
  628. scrolling='auto'
  629. frameBorder='no'
  630. border='0'
  631. marginWidth='0'
  632. marginHeight='0'></iframe>
  633. </div>
  634. </div>
  635. </div>
  636. </el-dialog>
  637. <el-drawer
  638. :visible.sync="drawer"
  639. direction="rtl"
  640. size="55%"
  641. @close="drawerClose"
  642. v-if='JSON.stringify(detailData) != "{}"'
  643. >
  644. <el-collapse v-model="activeNames">
  645. <el-collapse-item title="Attributes" name="one">
  646. <ul class='ul_box' v-if='detailData.span_attributes !=null'>
  647. <li v-for='(value,key) in detailData.span_attributes' :key='key'>
  648. <div class="ul_label">{{key}}</div>
  649. <div class="ul_value" style='color:#008080;white-space: pre-wrap;'>"{{value}}"</div>
  650. </li>
  651. </ul>
  652. </el-collapse-item>
  653. <el-collapse-item title="Resource" name="tow">
  654. <ul class='ul_box' v-if='detailData.resource_attributes !=null'>
  655. <li v-for='(value,key) in detailData.resource_attributes' :key='key'>
  656. <div class="ul_label">{{key}}</div>
  657. <div class="ul_value" style='color:#008080;white-space: pre-wrap;'>"{{value}}"</div>
  658. </li>
  659. </ul>
  660. </el-collapse-item>
  661. <el-collapse-item v-if='detailData.events_timestamp.length>0 && detailData.events_timestamp!=null' :title="'Events'+'('+ detailData.events_timestamp.length +')'" name="three">
  662. <!-- <el-collapse-item title="Events" name="three"> -->
  663. <div class='events_box'>
  664. <el-collapse :value="activeIn">
  665. <el-collapse-item v-for='(item,index) in detailData.events_timestamp' :key='index' :title="item" :name="index">
  666. <ul class='ul_box'>
  667. <li>
  668. <div class="ul_label">message</div>
  669. <div class="ul_value" style='color:#008080;white-space: pre-wrap;'>"{{detailData.events_name[index]}}"</div>
  670. </li>
  671. <li v-for='(value,key) in detailData.events_attributes[index]' :key='key'>
  672. <div class="ul_label">{{key}}</div>
  673. <div class="ul_value" style='color:#008080;white-space: pre-wrap;'>"{{value}}"</div>
  674. </li>
  675. <!-- <li>
  676. <div class="ul_label">message.type</div>
  677. <div class="ul_value" style='color:#008080'>"{{detailData.events_attributes[index]['message.type']}}"</div>
  678. </li>
  679. <li>
  680. <div class="ul_label">message.id</div>
  681. <div class="ul_value" style='color:#0000ff'>{{detailData.events_attributes[index]['message.id']}}</div>
  682. </li> -->
  683. </ul>
  684. </el-collapse-item>
  685. </el-collapse>
  686. </div>
  687. </el-collapse-item>
  688. </el-collapse>
  689. </el-drawer>
  690. </div>
  691. </template>
  692. <script>
  693. import { traceList, traceGraph } from '@/api/trace'
  694. import { listBiz,listBizStats,listBizGraph} from '@/api/mapping'
  695. export default {
  696. data(){
  697. return {
  698. Visible:false,
  699. isFull: false,
  700. drawer:false,
  701. // activeIn:['1'],
  702. detailData:{},
  703. expands:[],
  704. activeNames:['one','tow','three'],
  705. loading: false,
  706. topoUrl:'http://observe-front.cestong.com.cn/ui/index.html',
  707. flag:false,
  708. graphData:{},
  709. // 设置选中的列的复选框
  710. colSelect: [
  711. "Name",
  712. "StartTime",
  713. "Cost(ms)",
  714. "Duration(%)",
  715. "SpanKind",
  716. "ServiceName",
  717. "HttpUrl",
  718. "HttpCode",
  719. "DbConnectionString"
  720. ],
  721. colData: [
  722. { title: "Name", istrue: false },
  723. { title: "StartTime", istrue: false },
  724. { title: "Cost(ms)", istrue: false },
  725. { title: "Duration(%)", istrue: false },
  726. // { title: "StatusCode", istrue: false },
  727. { title: "SpanKind", istrue: false },
  728. { title: "ServiceName", istrue: false },
  729. { title: "EventsAttributes", istrue: false },
  730. { title: "EventsName", istrue: false },
  731. { title: "EventsTimestamp", istrue: false },
  732. { title: "HttpUrl", istrue: false },
  733. { title: "HttpMethod", istrue: false },
  734. { title: "ContainerId", istrue: false },
  735. { title: "httpCode", istrue: false },
  736. { title: "DbConnectionString", istrue: false },
  737. { title: "RpcMethod", istrue: false },
  738. { title: "ResourceAttributes", istrue: false },
  739. { title: "SpanAttributes", istrue: false },
  740. { title: "MaxDepth", istrue: false },
  741. // { title: "dbConnectionString", istrue: false },
  742. { title: "DbStatement", istrue: false },
  743. ],
  744. num:0,
  745. tableData:[],
  746. tableDetail:null,
  747. selectList:[],
  748. treeList:[],
  749. // 总条数
  750. total: 0,
  751. queryTrace:{
  752. app_id:'',
  753. start_time:'',
  754. end_time:'',
  755. pageIndex:1,
  756. pageSize:10
  757. },
  758. // 查询参数
  759. queryParams: {
  760. trace_id:'',
  761. pageIndex:1,
  762. pageSize:10,
  763. },
  764. tractID:'',
  765. treeLoading:false,
  766. appItem:{},
  767. BizStatsQuery:{
  768. biz_id:0,
  769. start_time:'',
  770. end_time:'',
  771. },
  772. }
  773. },
  774. computed: {
  775. activeIn() {
  776. if(this.detailData.events_timestamp.length>0 && this.detailData.events_timestamp!=null){
  777. return this.detailData.events_timestamp.map((item,i) => {
  778. return i;
  779. });
  780. }
  781. }
  782. },
  783. watch: {},
  784. created(){
  785. this.$store.commit('time/setTimeFlag',false)
  786. this.appItem=storage.get('appsItem');
  787. if(JSON.stringify(this.appItem) !="{}"){
  788. this.queryTrace.app_id = this.appItem.id;
  789. const start_time = this.$store.state.time.globalTimes.startTime
  790. const end_time = this.$store.state.time.globalTimes.endTime
  791. this.queryTrace.start_time = start_time;
  792. this.queryTrace.end_time = end_time;
  793. this.BizStatsQuery.start_time= start_time;
  794. this.BizStatsQuery.end_time= end_time;
  795. // this.getListUrlMappingErrors();
  796. // this.getListUrlMappingQuality();
  797. // this.getListBiz();
  798. }
  799. // let traceId='';
  800. // let strr = window.location.href;
  801. // let param = this.parseQueryString(strr);
  802. // if(param.traceId!=undefined){
  803. // this.queryTrace.trace_id = param.traceId;
  804. // this.queryTrace.app_alias=String(param.app_alias);
  805. // this.tractID = param.traceId;
  806. // this.getTraceList();
  807. // }
  808. // if(param.min_duration != undefined && param.max_duration !=undefined){
  809. // this.queryTrace.start_time = param.start_time;
  810. // this.queryTrace.end_time = param.end_time;
  811. // this.queryTrace.min_duration = param.min_duration;
  812. // this.queryTrace.max_duration = param.max_duration;
  813. // this.queryTrace.app_alias = String(param.app_alias);
  814. // if(param.failed != undefined){
  815. // this.queryTrace.failed= JSON.parse(param.failed);
  816. // }
  817. // this.queryTrace.pageIndex = 1;
  818. // this.queryTrace.pageSize =10;
  819. // this.queryTrace.trace_id = ''
  820. // this.getTraceList();
  821. // }
  822. this.columnChange();
  823. },
  824. methods:{
  825. clickFull() {
  826. this.Visible=true;
  827. this.$refs['topo'].initGraph();
  828. },
  829. handlePaste(e){
  830. var clip = e.clipboardData.getData('Text');
  831. this.queryTrace.trace_id = clip;
  832. this.$forceUpdate();
  833. },
  834. change(e){
  835. this.$forceUpdate();
  836. },
  837. parseQueryString(url){
  838. var json = {};
  839. var arr = url.substr(url.indexOf('?') + 1).split('&');
  840. arr.forEach(item=>{
  841. var tmp = item.split('=');
  842. json[tmp[0]] = tmp[1];
  843. });
  844. return json;
  845. },
  846. getRowData(row){
  847. this.detailData = row;
  848. this.drawer=true;
  849. },
  850. drawerClose() {
  851. this.drawer = false;
  852. },
  853. // toogleExpand(row,expandedRows){
  854. // // this.childQueryParams.id = row.id;
  855. // // this.rowData = []
  856. // var that = this
  857. // if (expandedRows.length) {
  858. // that.expands = []
  859. // if (row) {
  860. // that.expands.push(row.id)
  861. // }
  862. // } else {
  863. // that.expands = []
  864. // }
  865. // },
  866. //根据行的id判断
  867. getRowKeys(row) {
  868. return row.span_id;
  869. },
  870. rowClassRender({row}) {
  871. if(row.events_timestamp!=null){
  872. if(row.events_timestamp.length>0){
  873. return { "background-color": "#fef0f0" }
  874. }else{
  875. return '';
  876. }
  877. }
  878. },
  879. clickRowHandleNode(item){
  880. this.detailData = item;
  881. this.drawer=true;
  882. },
  883. clickRowHandle(row, column, event) {
  884. this.detailData = row;
  885. this.drawer=true;
  886. },
  887. status_change(row){
  888. if(row.row.events_timestamp!=null){
  889. if(row.row.events_timestamp.length>0){
  890. return 'table-error-row'
  891. }else{
  892. return ''
  893. }
  894. }else{
  895. return ''
  896. }
  897. },
  898. /** 搜索按钮操作 */
  899. handleQuery() {
  900. this.queryTrace.pageIndex = 1
  901. // this.queryParams.pageIndex = 1
  902. // this.getSingleTrace()
  903. this.getTraceList();
  904. },
  905. //控制列的显示和隐藏
  906. columnChange(val) {
  907. this.colData.filter((i) => {
  908. if (this.colSelect.indexOf(i.title) !== -1) {
  909. i.istrue = true;
  910. } else {
  911. i.istrue = false;
  912. }
  913. });
  914. },
  915. getTraceList(){
  916. this.loading=true;
  917. // this.queryTrace.pageSize = 10;
  918. listBiz(this.queryTrace).then(res=>{
  919. if(res.code == 200){
  920. this.loading=false;
  921. let list = res.data.list;
  922. this.selectList = res.data.list;
  923. this.total = res.data.count;
  924. if(list.length>0){
  925. for(let i=0;i<list.length;i++){
  926. for(let j=0;j<this.selectList.length;j++){
  927. if(this.selectList[i].id == list[i].id){
  928. this.BizStatsQuery.biz_id = list[i].id;
  929. listBizStats(this.BizStatsQuery).then(res=>{
  930. list[i] = {...list[i],...res.data}
  931. })
  932. }
  933. }
  934. }
  935. this.selectList = list;
  936. }
  937. }
  938. })
  939. },
  940. getSingleTrace(){
  941. traceList(this.queryParams).then(res=>{
  942. if(res.code == 200){
  943. this.selectList = res.data.list
  944. // this.total = res.data.count;
  945. }
  946. })
  947. },
  948. getTraceDetail(biz_id){
  949. this.treeLoading=true;
  950. listBizGraph({biz_id:biz_id}).then(res=>{
  951. if(res.code == 200){
  952. this.num = 1;
  953. this.treeLoading=false;
  954. this.tableData=res.data
  955. this.tableDetail = res.data;
  956. let arr = res.data
  957. // let List = this.handleDataTree(arr)
  958. // this.graphData=List[0];
  959. let List = this.handleData(arr)
  960. this.graphData = List;
  961. }
  962. })
  963. },
  964. handleData(data) {
  965. data.forEach((v, k) => {
  966. v.id = v.span_id;
  967. v.collapsed = false;
  968. v.name = v.span_name;
  969. // v.label = (v.duration).toFixed(2);
  970. v.label = v.duration.toFixed(2);
  971. v.currency='ms';
  972. v.rate = v.duration_persent;
  973. v.status = (v.status_code == 'STATUS_CODE_ERROR'||v.events_timestamp.length>0||v.http_code>399)?'R':(v.duration>500)?'Y':'G';
  974. v.variableValue = v.duration_persent;
  975. // v.status_code = 'UNSET'
  976. if (v.children != undefined && v.children.length > 0) {
  977. v.children = this.handleData(v.children)
  978. }
  979. })
  980. return data
  981. },
  982. handlerTreeData(arr) {
  983. if (arr) {
  984. arr.forEach((item) => {
  985. // if(item[key]){
  986. // delete item[key]
  987. // }
  988. // const {gender, ...item} = item;
  989. if (item.children && item.children!==[]) handler(item.children)
  990. })
  991. return arr
  992. }
  993. },
  994. //删除树形结构数据中的某个属性
  995. handlerTreeDataSimple (arr, key) {
  996. if (arr) {
  997. arr.forEach((item) => {
  998. if(item[key]){
  999. delete item[key]
  1000. }
  1001. if (item.children && item.children!==[]) handler(item.children, key)
  1002. })
  1003. return arr
  1004. }
  1005. },
  1006. handleDataTree(data) {
  1007. let obj = {}
  1008. let list = [];
  1009. data.forEach((v, k) => {
  1010. obj.id = v.span_id.substr(v.span_id.length - 4);;
  1011. obj.collapsed = false;
  1012. obj.name = v.span_name;
  1013. obj.label = (v.duration).toFixed(2);
  1014. obj.rate = v.duration_persent.toFixed(2);
  1015. obj.status = v.status_code == 'STATUS_CODE_ERROR'?'R':'G';
  1016. obj.variableValue = v.duration_persent.toFixed(2);
  1017. obj.currency='ms';
  1018. obj.variableName='V1';
  1019. obj.variableUp=false;
  1020. if (v.children != undefined && v.children.length > 0) {
  1021. obj.children = this.handleDataTree(v.children)
  1022. }
  1023. list.push(obj)
  1024. })
  1025. return list
  1026. },
  1027. getTraceGraph(trace_id){
  1028. traceGraph(trace_id).then(res=>{
  1029. if(res.code == 200){
  1030. res.data.nodes = res.data.nodes.map((item)=>({
  1031. label:item.title,
  1032. id: item.id,
  1033. title: item.title,
  1034. subtitle: item.subtitle,
  1035. mainstat: item.mainstat,
  1036. secondarystat: item.secondarystat,
  1037. arc_green: item.arc_green, // 结点圆圈颜色,1代表纯绿色,与red和为1
  1038. arc_red: item.arc_red, // 计算方式为当spankind为client时, current/total的值
  1039. icon: item.icon
  1040. }))
  1041. // this.graphData=res.data
  1042. }
  1043. })
  1044. },
  1045. handleRowClick(row, column, event){
  1046. setTimeout(()=>{
  1047. this.flag = true;
  1048. this.tractID = row.trace_id;
  1049. this.$refs.table.toggleRowSelection(row);
  1050. this.getTraceDetail(row.trace_id);
  1051. // this.getTraceGraph(this.tractID);
  1052. },0)
  1053. // this.num = 1;
  1054. },
  1055. toggleTab(val){
  1056. this.num = val;
  1057. }
  1058. }
  1059. }
  1060. </script>
  1061. <style lang='scss' scoped>
  1062. .TreeBox{
  1063. display: flex;
  1064. justify-content: space-between;
  1065. }
  1066. [v-cloak]{
  1067. display: none!important;
  1068. }
  1069. ::v-deep .el-tooltip__popper{ max-width:50%!important }
  1070. .table-error-row td{
  1071. background-color: #fef0f0;
  1072. }
  1073. ::v-deep .collapse-title {
  1074. flex: 1 0 90% !important;
  1075. order: 1 !important;
  1076. }
  1077. ::v-deep .el-collapse-item__header {
  1078. flex: 1 0 auto !important;
  1079. order: -1 !important;
  1080. padding-left:8px!important;
  1081. height: 30px;
  1082. line-height: 30px;
  1083. }
  1084. ::v-deep .el-collapse-item__header:hover{
  1085. background: rgb(232, 232, 232);
  1086. }
  1087. ::v-deep .el-drawer__header{
  1088. margin-bottom: 0!important;
  1089. font-weight: 500;
  1090. }
  1091. ul {
  1092. display: block;
  1093. list-style-type: disc;
  1094. margin-block-start: 0;
  1095. margin-block-end: 0;
  1096. margin-inline-start: 0px;
  1097. margin-inline-end: 0px;
  1098. padding-inline-start: 0;
  1099. }
  1100. .ul_box{
  1101. border: 1px solid rgba(36, 41, 46, 0.12);
  1102. box-sizing: border-box;
  1103. padding:4px;
  1104. margin:8px;
  1105. border-radius: 3px;
  1106. }
  1107. .ul_box li{
  1108. display: flex;
  1109. min-height: 30px;
  1110. line-height: 30px;
  1111. box-sizing: border-box;
  1112. // padding:0 4px;
  1113. }
  1114. .ul_box li .ul_label{
  1115. color: rgb(136, 136, 136);
  1116. // white-space: pre;
  1117. width: 180px;
  1118. min-width: 180px;
  1119. display: flex;
  1120. flex-direction: column;
  1121. // align-items: flex-end;
  1122. justify-content: flex-end;
  1123. overflow: hidden;
  1124. text-overflow: ellipsis;
  1125. white-space: nowrap;
  1126. }
  1127. .ul_box li .ul_value{
  1128. // white-space: nowrap;
  1129. // word-break: keep-all;
  1130. // overflow: hidden;
  1131. // text-overflow: ellipsis;
  1132. font-family: monospace;
  1133. display: flex;
  1134. flex-direction: column;
  1135. // align-items: flex-end;
  1136. justify-content: flex-end;
  1137. }
  1138. .ul_box li:nth-child(even) {
  1139. background: rgb(245, 245, 245);
  1140. }
  1141. .events_box{
  1142. padding:8px;
  1143. border: 1px solid rgba(36, 41, 46, 0.12);
  1144. border-radius: 3px;
  1145. }
  1146. .events_box ::v-deep .el-collapse-item__header {
  1147. background-color: rgb(244, 245, 245)
  1148. // background: rgb(228, 228, 228);
  1149. }
  1150. .css-container{
  1151. background-color: rgb(255, 255, 255);
  1152. border: 1px solid rgba(36, 41, 46, 0.12);
  1153. position: relative;
  1154. border-radius: 2px;
  1155. height: 100%;
  1156. display: flex;
  1157. flex-direction: column;
  1158. }
  1159. .css-header{
  1160. display: flex;
  1161. -webkit-box-align: center;
  1162. align-items: center;
  1163. height: 32px;
  1164. cursor: auto;
  1165. .css-title{
  1166. margin-bottom: 0px;
  1167. padding: 0px 8px;
  1168. text-overflow: ellipsis;
  1169. overflow: hidden;
  1170. white-space: nowrap;
  1171. font-size: 14px;
  1172. font-weight: 550;
  1173. line-height: 1.57143;
  1174. letter-spacing: 0.2px;
  1175. font-family: Inter, Helvetica, Arial, sans-serif;
  1176. }
  1177. }
  1178. .css-content{
  1179. padding: 0px;
  1180. box-flex:1;
  1181. -webkit-box-flex: 1;
  1182. flex-grow: 1;
  1183. contain: none;
  1184. }
  1185. .css-page-header{
  1186. background-color: rgb(255, 255, 255);
  1187. padding: 0.5em 0px 0px;
  1188. position: sticky;
  1189. top: 0px;
  1190. z-index: 5;
  1191. }
  1192. .css-name{
  1193. align-items: flex-start;
  1194. display: flex;
  1195. padding: 0px 8px;
  1196. .css-name-title{
  1197. color: inherit;
  1198. flex: 1 1 0%;
  1199. font-size: 1.7em;
  1200. line-height: 1em;
  1201. margin: 0px 0px 0.45em;
  1202. font-weight: 400;
  1203. letter-spacing: -0.00893em;
  1204. font-family: Inter, Helvetica, Arial, sans-serif;
  1205. .trace-name{
  1206. font-size: 18px;
  1207. }
  1208. .css-text{
  1209. display: inline-block;
  1210. white-space: pre;
  1211. }
  1212. }
  1213. }
  1214. .css-small{
  1215. color: rgb(170, 170, 170);
  1216. margin: 0px 12px;
  1217. font-size: 12px;
  1218. font-weight: 400;
  1219. }
  1220. .css-action{
  1221. font-size: 14px;
  1222. font-weight: 500;
  1223. font-family: Inter, Helvetica, Arial, sans-serif;
  1224. }
  1225. .css-time-box{
  1226. flex: 1 1 0%;
  1227. line-height: 1.5;
  1228. margin: -8px 8px 12px;
  1229. }
  1230. .css-time-wrap{
  1231. vertical-align: middle;
  1232. }
  1233. .css-time-vlaue-detail{
  1234. color: rgb(170, 170, 170);
  1235. }
  1236. .css-type {
  1237. margin: 0px 12px;
  1238. // vertical-align: text-top;
  1239. }
  1240. .css-api{
  1241. margin: -2.5px 2.4px;
  1242. height: 15px;
  1243. overflow: hidden;
  1244. word-break: break-all;
  1245. line-height: 20px;
  1246. }
  1247. .full{
  1248. width:32px;
  1249. height:32px;
  1250. position: absolute;
  1251. top:-35px;
  1252. right:0px;
  1253. display: block;
  1254. i{
  1255. font-size: 16px;
  1256. color:#999;
  1257. }
  1258. }
  1259. </style>
  1260. <style scoped>
  1261. .el-tooltip__popper{ max-width:50%!important }
  1262. [v-cloak]{
  1263. display:none!important;
  1264. }
  1265. </style>