|
464 | 464 | </div> |
465 | 465 | </template> |
466 | 466 |
|
| 467 | + <!-- Benchmark graphs --> |
| 468 | + <template v-if="( (op.data.spec.op == 'benchmark') && hasProp(op, 'data.status.benchmark.pgbench') )"> |
| 469 | + <div id="benchmarkStats"> |
| 470 | + <template v-if="hasProp(op, 'data.status.benchmark.pgbench.transactionsPerSecond.overTime')"> |
| 471 | + <div id="benchmark-tpsOverTime" class="benchmarkGraph"> |
| 472 | + <h3 class="sectionHeader"> |
| 473 | + TPS over-time |
| 474 | + </h3> |
| 475 | + |
| 476 | + <apexchart |
| 477 | + type="line" |
| 478 | + :options="{ |
| 479 | + chart: { |
| 480 | + type: 'bar', |
| 481 | + id: '-tpsOverTimeGraph', |
| 482 | + height: '350px', |
| 483 | + animations: { |
| 484 | + enabled: false |
| 485 | + } |
| 486 | + }, |
| 487 | + tooltip: { |
| 488 | + enabled: true |
| 489 | + }, |
| 490 | + stroke: { |
| 491 | + width: 1 |
| 492 | + }, |
| 493 | + yaxis: { |
| 494 | + title: { |
| 495 | + text: 'TPS' |
| 496 | + }, |
| 497 | + }, |
| 498 | + xaxis: { |
| 499 | + show: false, |
| 500 | + labels: { |
| 501 | + show: false |
| 502 | + }, |
| 503 | + axisBorder: { |
| 504 | + show: false |
| 505 | + }, |
| 506 | + axisTicks: { |
| 507 | + show: false |
| 508 | + } |
| 509 | + }, |
| 510 | + tooltip: { |
| 511 | + shared: false, |
| 512 | + } |
| 513 | + }" |
| 514 | + :series="[{ |
| 515 | + name: 'TPS', |
| 516 | + data: op.data.status.benchmark.pgbench.transactionsPerSecond.overTime.values |
| 517 | + }]"> |
| 518 | + </apexchart> |
| 519 | + </div> |
| 520 | + </template> |
| 521 | + |
| 522 | + <template v-if="hasProp(op, 'data.status.benchmark.pgbench.hdrHistogram')"> |
| 523 | + <div id="benchmark-histogram"> |
| 524 | + <h3 class="sectionHeader"> |
| 525 | + Time Percentiles |
| 526 | + </h3> |
| 527 | + |
| 528 | + <div id="hdrHistogram"> |
| 529 | + {{ getHdrHistogram(op.data.status.benchmark.pgbench.hdrHistogram) }} |
| 530 | + </div> |
| 531 | + </div> |
| 532 | + </template> |
| 533 | + |
| 534 | + <template v-if="hasProp(op, 'data.status.benchmark.pgbench.statements')"> |
| 535 | + <div id="benchmark-statements" class="benchmarkGraph"> |
| 536 | + <h3 class="sectionHeader"> |
| 537 | + Statements |
| 538 | + </h3> |
| 539 | + |
| 540 | + <apexchart |
| 541 | + type="bar" |
| 542 | + :options="{ |
| 543 | + chart: { |
| 544 | + id: '-statements', |
| 545 | + height: '350px', |
| 546 | + animations: { |
| 547 | + enabled: false |
| 548 | + } |
| 549 | + }, |
| 550 | + plotOptions: { |
| 551 | + bar: { |
| 552 | + horizontal: true, |
| 553 | + } |
| 554 | + }, |
| 555 | + dataLabels: { |
| 556 | + enabled: false |
| 557 | + }, |
| 558 | + xaxis: { |
| 559 | + categories: op.data.status.benchmark.pgbench.statements.map((s) => (s.command)) |
| 560 | + }, |
| 561 | + }" |
| 562 | + :series="[{ |
| 563 | + data: op.data.status.benchmark.pgbench.statements.map((s) => (s.latency)) |
| 564 | + }]"> |
| 565 | + </apexchart> |
| 566 | + </div> |
| 567 | + </template> |
| 568 | + </div> |
| 569 | + </template> |
| 570 | + |
467 | 571 | <!--Events--> |
468 | 572 | <template v-if="op.data.hasOwnProperty('status')"> |
469 | 573 | <div> |
|
493 | 597 | </th> |
494 | 598 | </thead> |
495 | 599 | <tbody> |
496 | | - <template v-if="!events.length"> |
| 600 | + <template v-if="(events === null)"> |
| 601 | + <tr class="no-results"> |
| 602 | + <td colspan="999"> |
| 603 | + Loading events info... |
| 604 | + </td> |
| 605 | + </tr> |
| 606 | + </template> |
| 607 | + <template v-else-if="!events.length"> |
497 | 608 | <tr class="no-results"> |
498 | 609 | <td colspan="999"> |
499 | 610 | No recent events have been recorded for this operation. |
|
700 | 811 | </template> |
701 | 812 |
|
702 | 813 | <script> |
703 | | - import { mixin } from './mixins/mixin' |
704 | | - import store from '../store' |
705 | | - import moment from 'moment' |
706 | | - import sgApi from '../api/sgApi' |
707 | | - import CRDSummary from './forms/summary/CRDSummary.vue' |
| 814 | + import { mixin } from './mixins/mixin'; |
| 815 | + import store from '../store'; |
| 816 | + import moment from 'moment'; |
| 817 | + import sgApi from '../api/sgApi'; |
| 818 | + import CRDSummary from './forms/summary/CRDSummary.vue'; |
| 819 | + import HdrHistogramWidget from "hdr-histogram-widget"; |
708 | 820 |
|
709 | 821 | export default { |
710 | 822 | name: 'SGDbOps', |
|
736 | 848 | }, |
737 | 849 | podConnections: {}, |
738 | 850 | pollClusterStats: 0, |
739 | | - events: [], |
| 851 | + events: null, |
740 | 852 | eventsPooling: null |
741 | 853 | } |
742 | 854 | }, |
743 | 855 |
|
744 | 856 | mounted: function() { |
745 | 857 | const vc = this; |
746 | 858 |
|
747 | | - vc.getOpEvents(); |
748 | | - vc.eventsPooling = setInterval( function() { |
749 | | - vc.getOpEvents() |
750 | | - }, 10000); |
| 859 | + if(vc.$route.params.hasOwnProperty('name')) { |
| 860 | + vc.getOpEvents(); |
| 861 | + vc.eventsPooling = setInterval( function() { |
| 862 | + vc.getOpEvents() |
| 863 | + }, 10000); |
| 864 | + } |
751 | 865 | }, |
752 | 866 |
|
753 | 867 | methods: { |
|
852 | 966 |
|
853 | 967 | getOpEvents() { |
854 | 968 | const vc = this; |
855 | | - |
856 | | - sgApi |
| 969 | +
|
| 970 | + sgApi |
857 | 971 | .getResourceDetails('sgdbops', vc.$route.params.namespace, vc.$route.params.name, 'events') |
858 | 972 | .then( function(response) { |
859 | 973 | vc.events = [...response.data] |
860 | 974 |
|
861 | 975 | vc.events.sort((a,b) => { |
862 | | - |
863 | 976 | if(moment(a.firstTimestamp).isValid && moment(b.firstTimestamp).isValid) { |
864 | 977 |
|
865 | 978 | if(moment(a.firstTimestamp).isBefore(moment(b.firstTimestamp))) |
|
870 | 983 |
|
871 | 984 | } |
872 | 985 | }); |
| 986 | +
|
873 | 987 | }).catch(function(err) { |
874 | 988 | console.log(err); |
875 | 989 | vc.checkAuthError(err); |
876 | 990 | }); |
877 | 991 | }, |
| 992 | +
|
| 993 | + getStatementsYAxis(statements) { |
| 994 | + return statements.map( (s) => (s.command) ); |
| 995 | + }, |
| 996 | +
|
| 997 | + getStatementsXAxis(statements) { |
| 998 | + return statements.map( (s) => (s.latency) ); |
| 999 | + }, |
| 1000 | +
|
| 1001 | + getHdrHistogram(histogramData) { |
| 1002 | + /* const opHistogram = hdr.decodeFromCompressedBase64(histogramData); |
| 1003 | + console.log(histogramData); |
| 1004 | + console.log(opHistogram); */ |
| 1005 | +
|
| 1006 | + const opHistogram = { |
| 1007 | + percentiles: histogramData |
| 1008 | + } |
| 1009 | + HdrHistogramWidget.display( |
| 1010 | + opHistogram, |
| 1011 | + 'milliseconds', // default is milliseconds |
| 1012 | + document.getElementById("hdrHistogram") // default is document.body |
| 1013 | + ); |
| 1014 | + } |
878 | 1015 | }, |
879 | 1016 | |
880 | 1017 | computed: { |
|
974 | 1111 | ? store.state.sgdbops.find(o => (o.data.metadata.namespace == this.$route.params.namespace) && (o.data.metadata.name == this.$route.params.name)) |
975 | 1112 | : null |
976 | 1113 | ) |
977 | | - } |
| 1114 | + }, |
978 | 1115 | }, |
979 | 1116 |
|
980 | 1117 | beforeDestroy: function() { |
981 | 1118 | clearInterval(this.pollClusterStats); |
982 | | - clearInterval(this.eventsPooling) |
| 1119 | + clearInterval(this.eventsPooling); |
983 | 1120 | } |
984 | 1121 | } |
985 | 1122 | </script> |
|
0 commit comments