123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982 |
- <template>
- <BasicLayout>
- <template #wrapper>
- <el-card class="box-card" style="flex:1;">
- <div style="margin-bottom:16px;">
- <!-- <i class="el-icon-arrow-left" style="font-size:24px;cursor: pointer;vertical-align: middle;" @click='back'></i> -->
- <!-- <el-button type="primary" icon="el-icon-refresh-left" size="mini" @click='back' plain>返回</el-button> -->
- <el-page-header @back="back">
- <div slot="content">
- <span style="font-size:18px;">{{ cnName }}【 {{ spansQuery.service_name }} 】</span>
- </div>
- </el-page-header>
- </div>
- <div v-if="activeName=="first"" class="block-container" style="margin-bottom:20px">
- <div class="row">
- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow="false">
- <div slot="content">
- <i class="dot" />
- <span>{{ digitsObj.Span }}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">SPANS/min</div>
- <div class="col-con">{{ digitsObj.Span !=undefined?digitsObj.Span:0 }}</div>
- </div>
- </div>
- </el-tooltip>
- </div>
- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow="false">
- <div slot="content">
- <i class="dot" />
- <span>{{ digitsObj.Http }}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">HTTP/min</div>
- <div class="col-con">{{ digitsObj.Http !=undefined?digitsObj.Http:0 }}</div>
- </div>
- </div>
- </el-tooltip>
- </div>
- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow="false">
- <div slot="content">
- <i class="dot" />
- <span>{{ digitsObj.Rpc }}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">RPC/min</div>
- <div class="col-con">{{ digitsObj.Rpc !=undefined?(digitsObj.Rpc).toFixed(2):0 }}</div>
- </div>
- </div>
- </el-tooltip>
- </div>
- <!-- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow='false'>
- <div slot="content">
- <i class="dot"></i>
- <span>{{digitsObj.error_rate}}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">LOGS</div>
- <div class="col-con">{{(digitsObj.error_rate*100).toFixed(2)}}/min</div>
- </div>
- </div>
- </el-tooltip>
- </div> -->
- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow="false">
- <div slot="content">
- <i class="dot" />
- <span>{{ digitsObj.Error!=undefined?digitsObj.Error:0 }}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">HTTPERROR/min</div>
- <div class="col-con">{{ digitsObj.Error!=undefined?(digitsObj.Error).toFixed(2):0 }}</div>
- </div>
- </div>
- </el-tooltip>
- </div>
- <div class="col">
- <el-tooltip placement="bottom" effect="dark" :visible-arrow="false">
- <div slot="content">
- <i class="dot" />
- <span>{{ digitsObj.DB }}</span>
- </div>
- <div class="border-bottom">
- <div class="block-box px-3 py-4">
- <div class="col-tit">DATABASE/min</div>
- <div class="col-con">{{ digitsObj.DB !=undefined?digitsObj.DB :0 }}</div>
- </div>
- </div>
- </el-tooltip>
- </div>
- </div>
- </div>
- <div v-if="activeName=="second"">
- <div id="scaleMain" style="width:100%;height:240px;margin-bottom:36px;margin-top:16px" />
- </div>
- <div class="link-box">
- <router-link class="to-inline-block" :to="{path:'/service/Interface/index'}">
- <el-button type="primary" size="mini">接口解析</el-button>
- </router-link>
- <router-link class="to-inline-block" :to="{path:'/service/process/index'}">
- <el-button type="primary" size="mini">进程解析</el-button>
- </router-link>
- </div>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="对比分析" name="first">
- <el-form ref="timeQuery" :model="timeQuery" :inline="true" label-width="100px" style="text-align: right;">
- <el-form-item label="时间跨度" prop="hour_num">
- <el-select v-model="timeQuery.hour_num" placeholder="时间选择" clearable size="small" @keyup.enter.native="handletimeQuery" @change="changetimeQuery">
- <el-option
- v-for="time in timeOptions"
- :key="time.value"
- :label="time.label"
- :value="time.value"
- />
- </el-select>
- </el-form-item>
- </el-form>
- <div>
- <h6 class="h6">活跃度</h6>
- <!-- <div class="echartsWrap" v-if="ServiceCompareObj.current.length>0"> -->
- <div class="echartsWrap">
- <div id="serviceActive" style="width:100vw;height:220px" />
- </div>
- <!-- <div v-else class="noData">
- <div style="text-align: center;color: rgba(36, 41, 46, 0.75);font-size: 18px; width: 100%;line-height:200px">No Data</div>
- </div> -->
- <h6 class="h6">错误率分布</h6>
- <!-- <div class="echartsWrap" v-if="errorRateObj.current.length>0"> -->
- <div class="echartsWrap">
- <div id="errorRate" style="width:100vw;height:220px" />
- </div>
- <!-- <div v-else class="noData">
- <div style="text-align: center;color: rgba(36, 41, 46, 0.75);font-size: 18px; width: 100%;line-height:200px">No Data</div>
- </div> -->
- </div>
- </el-tab-pane>
- <el-tab-pane label="Span列表" name="second">
- <div style="display:flex">
- <el-form ref="spansQuery" :model="spansQuery" :inline="true" label-width="100px">
- <el-form-item label="自定义属性" prop="span_attribute_key">
- <el-input
- v-model="spansQuery.span_attribute_key"
- placeholder="请输入自定义属性"
- clearable
- size="small"
- @keyup.enter.native="handleSpansQuery"
- />
- </el-form-item>
- <el-form-item label="自定义属性值" prop="span_attribute_value">
- <el-input
- v-model="spansQuery.span_attribute_value"
- placeholder="请输入自定义属性值"
- clearable
- size="small"
- @keyup.enter.native="handleSpansQuery"
- />
- </el-form-item>
- <el-form-item label="Span类型" prop="span_kind">
- <el-select v-model="spansQuery.span_kind" placeholder="Span类型" clearable size="small" @keyup.enter.native="handleSpansQuery" @change="changeSpansQuery">
- <el-option
- v-for="kind in spanOptions"
- :key="kind.value"
- :label="kind.label"
- :value="kind.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="延迟大于" prop="min_duration">
- <el-input
- v-model="spansQuery.min_duration"
- placeholder=""
- clearable
- size="small"
- type="number"
- class="Dur_input"
- @keyup.enter.native="handleSpansQuery"
- >
- <template slot="append">ms</template>
- </el-input>
- </el-form-item>
- <el-form-item label="调用方法" prop="request_method">
- <el-input
- v-model="spansQuery.request_method"
- placeholder="请输入调用方法"
- clearable
- size="small"
- @keyup.enter.native="handleSpansQuery"
- />
- </el-form-item>
- <!-- <el-form-item label="最大延迟" prop="max_duration">
- <el-input
- v-model="spansQuery.max_duration"
- placeholder="请输入最大延迟"
- clearable
- size="small"
- type="number"
- @keyup.enter.native="handleSpansQuery"
- />
- </el-form-item> -->
- <el-form-item label="" prop="only_exception">
- <el-checkbox v-model="spansQuery.only_exception" :true-label="1" :false-label="0" @keyup.enter.native="handleSpansQuery" @change="changeErrorSpans">仅异常</el-checkbox>
- </el-form-item>
- <el-form-item label="" prop="only_database">
- <!-- <el-checkbox v-model="spansQuery.only_database"></el-checkbox> -->
- <el-checkbox v-model="spansQuery.only_database" :true-label="1" :false-label="0" @keyup.enter.native="handleSpansQuery" @change="changeSQLSpans">仅SQL</el-checkbox>
- </el-form-item>
- </el-form>
- <div style="display:inline-block;vertical-align: middle;">
- <el-dropdown
- style="margin-left: 10px"
- size="mini"
- trigger="click"
- placement="bottom"
- >
- <el-button type="primary" size="mini">
- <!-- 下拉菜单 -->
- <i class="el-icon-s-grid" />
- <!-- 配置项 -->
- <i class="el-icon-arrow-down" />
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-checkbox-group
- v-model="colSelect"
- style="text-align: left"
- @change="columnChange"
- >
- <el-dropdown-item
- v-for="(item, index) in colData"
- :key="index"
- ><el-checkbox :label="item.title">{{
- item.title
- }}</el-checkbox></el-dropdown-item>
- </el-checkbox-group>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </div>
- <div style="padding-bottom:16px;">
- <el-table
- v-loading="loading"
- :data="spansList"
- @sort-change="sortChangeTable"
- >
- <!-- <el-table-column type="selection" width="45" align="center" /> -->
- <el-table-column v-if="isShow('TraceId')" label="TraceId" prop="trace_id" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <span @click="goto(scope.row)">{{ scope.row.trace_id }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="isShow('ServiceName')" label="ServiceName" prop="service_name" :show-overflow-tooltip="true" />
- <el-table-column v-if="isShow('DateTime')" label="DateTime" sortable="custom" prop="datetime" :show-overflow-tooltip="true" />
- <el-table-column v-if="isShow('Method')" label="Method" prop="method" :show-overflow-tooltip="true" />
- <el-table-column v-if="isShow('Code')" label="Code" prop="code" :show-overflow-tooltip="true" />
- <el-table-column v-if="isShow('Duration(ms)')" label="Duration(ms)" prop="duration" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <el-tag v-if="scope.row.duration>=2000" type="danger">{{ scope.row.duration }}</el-tag>
- <el-tag v-if="scope.row.duration<2000" type="info">{{ scope.row.duration }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- v-if="isShow('SpanId')"
- label="SpanId"
- prop="span_id"
- :show-overflow-tooltip="true"
- />
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="spansQuery.pageIndex"
- :limit.sync="spansQuery.pageSize"
- @pagination="getServiceSpans"
- />
- </div>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </template>
- </BasicLayout>
- </template>
- <script>
- import { digitsService, serviceSpans, serviceCompare, serviceErrors, listServiceStats } from '@/api/service'
- import storage from '@/utils/storage'
- import moment from 'moment'
- export default {
- data() {
- return {
- timeQuery: {
- app_alias: '',
- service_name: '',
- hour_num: 1
- },
- timeOptions: [
- {
- value: 1,
- label: '1 小时'
- },
- {
- value: 3,
- label: '3 小时'
- },
- {
- value: 6,
- label: '6 小时'
- },
- {
- value: 12,
- label: '12 小时'
- },
- {
- value: 24,
- label: '24 小时'
- }
- ],
- spanOptions: [
- {
- value: 'SPAN_KIND_CLIENT',
- label: 'SPAN_KIND_CLIENT'
- },
- {
- value: 'SPAN_KIND_SERVER',
- label: 'SPAN_KIND_SERVER'
- },
- {
- value: 'SPAN_KIND_INTERNAL',
- label: 'SPAN_KIND_INTERNAL'
- },
- {
- value: 'SPAN_KIND_CONSUMER',
- label: 'SPAN_KIND_CONSUMER'
- },
- {
- value: 'SPAN_KIND_PRODUCER',
- label: 'SPAN_KIND_PRODUCER'
- }
- ],
- // 设置选中的列的复选框
- colSelect: [
- 'TraceId',
- 'ServiceName',
- 'DateTime',
- 'Method',
- 'Code',
- 'Duration(ms)'
- ],
- colData: [
- { title: 'TraceId', istrue: false },
- { title: 'ServiceName', istrue: false },
- { title: 'DateTime', istrue: false },
- { title: 'Method', istrue: false },
- { title: 'Code', istrue: false },
- { title: 'Duration(ms)', istrue: false },
- { title: 'SpanId', istrue: false }
- ],
- loading: false,
- total: 0,
- activeName: 'first',
- digitsObj: {},
- digitsQuery: {
- app_alias: '',
- service_name: ''
- },
- timer: null,
- spansQuery: {
- app_alias: '',
- request_method: '',
- service_name: '', // 支持多个,多个并列
- only_exception: 0, // 仅显示异常trace相关
- only_database: 0, // 仅显示数据库相关
- // 支持分页,参数与之前一致
- // 支持时间筛选,参数与之前一致
- trace_id: '', // trace id, 字符串
- span_kind: '', // 固定5个值,建议下拉列表,分别为SPAN_KIND_CLIENT SPAN_KIND_SERVER SPAN_KIND_INTERNAL SPAN_KIND_CONSUMER SPAN_KIND_PRODUCER
- span_attribute_key: '', // 字符串
- span_attribute_value: '', // 字符串
- min_duration: 0, // 最小耗时
- max_duration: 0, // 最大耗时
- start_time: 0,
- end_time: 0,
- pageIndex: 1,
- pageSize: 10,
- sort_field: 'Timestamp',
- sort_type: 'DESC'
- },
- spansList: [],
- ServiceCompareObj: {
- current: [],
- forward: [],
- time: []
- },
- errorRateObj: {
- current: [],
- forward: [],
- time: []
- },
- compareChart: null,
- errorChart: null,
- cnName: '',
- statsQuery: {
- id: 0,
- start_time: '',
- end_time: ''
- },
- statsObj: {}
- }
- },
- watch: {
- '$store.state.time.globalTimes': {
- handler(newValue, oldValue) {
- if (newValue) {
- this.digitsQuery.start_time = newValue.startTime
- this.digitsQuery.end_time = newValue.endTime
- this.statsQuery.start_time = newValue.startTime
- this.statsQuery.end_time = newValue.endTime
- this.spansQuery.start_time = newValue.startTime
- this.spansQuery.end_time = newValue.endTime
- this.getDigitsService()
- this.getlistServiceStats()
- this.getServiceSpans()
- setTimeout(() => {
- this.drawEchartsScale(this.statsObj)
- }, 300)
- if (newValue.timeOut) {
- if (newValue.timeOut == 1) {
- clearInterval(this.timer)
- } else {
- clearInterval(this.timer)
- this.Refresh(newValue.timeOut)
- }
- }
- }
- },
- // immediate: true,
- deep: true
- }
- },
- created() {
- // 说明
- // appItem中的id和app_id是一样的
- this.appItem = storage.get('appsItem')
- const start_time = this.$store.state.time.globalTimes.startTime
- const end_time = this.$store.state.time.globalTimes.endTime
- if (JSON.stringify(this.appItem) != '{}') {
- this.digitsQuery.app_alias = this.appItem.alias
- this.digitsQuery.app_id = this.appItem.id
- this.digitsQuery.start_time = start_time
- this.digitsQuery.end_time = end_time
- this.spansQuery.app_alias = this.appItem.alias
- this.spansQuery.start_time = start_time
- this.spansQuery.end_time = end_time
- this.timeQuery.app_alias = this.appItem.alias
- this.statsQuery.start_time = start_time
- this.statsQuery.end_time = end_time
- }
- // 从业务解析中节点中的所属服务跳转过来的和业务解析列表中每列跳转过来的,服务名
- if (this.$route.query.service_name != undefined) {
- this.digitsQuery.service_name = this.$route.query.service_name
- this.spansQuery.service_name = this.$route.query.service_name
- this.timeQuery.service_name = this.$route.query.service_name
- this.statsQuery.id = this.$route.query.id
- this.getDigitsService()
- this.getServiceSpans()
- this.getServiceCompare()
- this.getErrorRateCompare()
- this.getlistServiceStats()
- }
- if (this.$route.query.name != undefined) {
- this.cnName = this.$route.query.name
- }
- const strr = window.location.href
- const param = this.parseQueryString(strr)
- if (param.app_alias != undefined && param.service_name != undefined) {
- this.digitsQuery.app_alias = param.app_alias
- this.spansQuery.app_alias = param.app_alias
- this.timeQuery.app_alias = param.app_alias
- this.digitsQuery.service_name = param.service_name
- this.spansQuery.service_name = param.service_name
- this.timeQuery.service_name = param.service_name
- this.getDigitsService()
- this.getServiceSpans()
- this.getServiceCompare()
- this.getErrorRateCompare()
- }
- // this.getDigitsService();
- // this.getServiceSpans();
- // this.getServiceCompare();
- // this.getErrorRateCompare();
- // this.getlistServiceStats();
- this.columnChange()
- },
- mounted() {
- this.$nextTick(() => {
- // this.initServiceCompareChart(this.ServiceCompareObj)
- // this.initErrorRateCompareChart(this.errorRateObj)
- // this.$echarts5.connect([this.errorChart, this.compareChart]);
- })
- },
- beforeDestroy() {
- clearInterval(this.timer)
- },
- methods: {
- Refresh(timeOut) {
- this.timer = setInterval(() => {
- this.getDigitsService()
- this.getlistServiceStats()
- this.getServiceSpans()
- this.getServiceCompare()
- this.getErrorRateCompare()
- }, timeOut)
- },
- getlistServiceStats() {
- listServiceStats(this.statsQuery).then(response => {
- if (response.code == 200) {
- this.statsObj = response.data
- }
- })
- },
- drawEchartsScale(row) {
- const _this = this
- const myChartScale = this.$echarts5.init(document.getElementById('scaleMain'))
- // 绘制趋势echarts
- const option = {
- tooltip: {
- trigger: 'axis',
- // confine: false,
- // appendToBody: true,
- show: true,
- formatter: function(params) {
- storage.set('paramsValue', params)
- const axisValueLabel = params[0].axisValueLabel
- let str0 = ''
- params.forEach((item, idx) => {
- // str1+=`${}`
- str0 += `${item.marker}${item.seriesName}<span style='margin-left:30px;text-align:right;font-weight:400'>${item.data}</span>`
- switch (idx) {
- case 0:
- str0
- break
- case 1:
- str0
- break
- default:
- str0
- }
- str0 += idx === params.length - 1 ? '' : '<br/>'
- })
- return axisValueLabel + '<br>' + str0
- }
- },
- title: {
- text: '延迟比例',
- // subtext: 'ms',
- textStyle: {
- fontSize: 14
- }
- // triggerEvent: true,
- },
- grid: {
- // top:'5%',
- left: '3%',
- right: '6%',
- bottom: '1%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: row.quantiles.time,
- axisLabel: {
- textStyle: {
- fontSize: 12,
- textAlign: 'center'
- },
- formatter: function(params) {
- // let newParams = moment(params).format('YYYY-MM-DD HH:mm:ss');
- // let newArr = newParams.split(' ')
- // let time = newArr[0] + "\n" + newArr[1]
- // return time;
- let newParams = ''
- const dateStr = params.substring(0, 10)
- // dateStr = dateStr.replace(/\-/g, function(match) {
- // return match.replace(/\-/g, '.');
- // });
- const timeStr = params.substring(11, 19)
- newParams = dateStr + '\n' + timeStr
- return newParams
- }
- }
- },
- yAxis: {
- type: 'value',
- scale: true,
- gridIndex: 0,
- axisLabel: {
- formatter: '{value}'
- },
- axisLine: {
- show: true
- },
- axisTick: {
- show: true
- },
- splitLine: {
- show: true
- }
- },
- series: [
- {
- name: 'P.50',
- type: 'line',
- stack: 'Total',
- symbol: 'none',
- // symbol: 'emptyCircle',//拐点
- data: row.quantiles.p50
- },
- {
- name: 'P.95',
- type: 'line',
- stack: 'Total',
- symbol: 'none', // 拐点
- // symbol: 'emptyCircle',//拐点
- data: row.quantiles.p90
- },
- {
- name: 'P.99',
- type: 'line',
- stack: 'Total',
- symbol: 'none', // 拐点
- // symbol: 'emptyCircle',//拐点
- data: row.quantiles.p99
- }
- ]
- }
- myChartScale.setOption(option)
- myChartScale.getZr().off('click')
- myChartScale.getZr().on('click', params => {
- const data = storage.get('paramsValue')
- const timestamp = moment(data[0].name).unix()
- _this.spansQuery.start_time = timestamp
- _this.spansQuery.end_time = timestamp
- _this.getServiceSpans()
- })
- },
- parseQueryString(url) {
- var json = {}
- var arr = url.substr(url.indexOf('?') + 1).split('&')
- arr.forEach(item => {
- var tmp = item.split('=')
- json[tmp[0]] = decodeURIComponent(tmp[1])
- })
- return json
- },
- handletimeQuery() {
- this.getServiceCompare()
- this.getErrorRateCompare()
- },
- changetimeQuery(val) {
- this.timeQuery.hour_num = val
- this.getServiceCompare()
- this.getErrorRateCompare()
- },
- handleSpansQuery() {
- this.getServiceSpans()
- },
- changeErrorSpans(val) {
- this.spansQuery.only_exception = val
- this.getServiceSpans()
- },
- changeSQLSpans(val) {
- this.spansQuery.only_database = val
- this.getServiceSpans()
- },
- changeSpansQuery(val) {
- this.spansQuery.span_kind = val
- this.getServiceSpans()
- },
- // 控制列的显示和隐藏
- columnChange(val) {
- this.colData.filter((i) => {
- if (this.colSelect.indexOf(i.title) !== -1) {
- i.istrue = true
- } else {
- i.istrue = false
- }
- })
- },
- handleClick(tab, event) {
- if (tab.name == 'second') {
- this.$nextTick(() => {
- this.drawEchartsScale(this.statsObj)
- })
- }
- },
- getDigitsService() {
- digitsService(this.digitsQuery).then((res) => {
- if (res.code == 200) {
- this.digitsObj = res.data
- }
- })
- },
- getServiceSpans() {
- serviceSpans(this.spansQuery).then((res) => {
- if (res.code == 200) {
- this.spansList = res.data.list
- this.total = res.data.count
- }
- })
- },
- getServiceCompare() {
- serviceCompare(this.timeQuery).then(res => {
- if (res.code == 200) {
- this.ServiceCompareObj = res.data
- // if(this.ServiceCompareObj.current.length>0){
- this.initServiceCompareChart(this.ServiceCompareObj)
- // }
- }
- })
- },
- initServiceCompareChart(data) {
- const _this = this
- this.compareChart = this.$echarts5.init(document.getElementById('serviceActive'))
- this.compareChart.setOption({
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#999'
- }
- }
- },
- legend: {
- data: ['当前时段', '前续时段']
- // selected: {
- // '当前时段': true,
- // '前续时段对比': false
- // }
- },
- // toolbox: {
- // show:true,
- // feature: {
- // // dataView: { show: true, readOnly: false },
- // magicType: { show: true, type: ['line', 'bar'] },
- // restore: { show: true },
- // // saveAsImage: { show: true }
- // }
- // },
- grid: {
- // top:'5%',
- left: '3%',
- right: '16%',
- bottom: '1%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- // type:'time',
- data: data.time
- // axisPointer: {
- // type: 'shadow'
- // },
- }
- ],
- yAxis: [
- {
- type: 'value'
- }
- ],
- series: [
- {
- name: '当前时段',
- type: 'bar',
- tooltip: {
- valueFormatter: function(value) {
- return value
- }
- },
- barWidth: 8,
- data: data.current != undefined ? data.current : []
- },
- {
- type: 'line',
- name: '前续时段',
- tooltip: {
- valueFormatter: function(value) {
- return value
- }
- },
- lineStyle: {
- width: 3
- },
- data: data.forward != undefined ? data.forward : []
- }
- ]
- })
- this.compareChart.group = 'group1'
- this.$echarts5.connect('group1')
- },
- getErrorRateCompare() {
- serviceErrors(this.timeQuery).then(res => {
- if (res.code == 200) {
- this.errorRateObj = res.data
- this.initErrorRateCompareChart(this.errorRateObj)
- }
- })
- },
- initErrorRateCompareChart(data) {
- this.errorChart = this.$echarts5.init(document.getElementById('errorRate'))
- this.errorChart.setOption({
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#999'
- }
- }
- },
- legend: {
- data: ['当前时段', '前续时段']
- // selected: {
- // '当前时段': true,
- // '前续时段对比': false
- // }
- },
- // toolbox: {
- // show:true,
- // feature: {
- // // dataView: { show: true, readOnly: false },
- // magicType: { show: true, type: ['line', 'bar'] },
- // restore: { show: true },
- // // saveAsImage: { show: true }
- // }
- // },
- grid: {
- // top:'5%',
- left: '3%',
- right: '16%',
- bottom: '1%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- data: data.time
- }
- ],
- yAxis: [
- {
- type: 'value'
- }
- ],
- series: [
- {
- name: '当前时段',
- type: 'bar',
- tooltip: {
- valueFormatter: function(value) {
- return value
- }
- },
- barWidth: 8,
- data: data.current != undefined ? data.current : []
- },
- {
- type: 'line',
- name: '前续时段',
- tooltip: {
- valueFormatter: function(value) {
- return value
- }
- },
- lineStyle: {
- width: 3
- },
- data: data.forward != undefined ? data.forward : []
- }
- ]
- })
- this.errorChart.group = 'group1'
- this.$echarts5.connect('group1')
- },
- back() {
- this.$router.push({
- path: '/service/service/index'
- })
- },
- goto(row) {
- const datetime = Date.parse(row.datetime) / 1000
- const href = this.$router.resolve({
- path: '/latency/index',
- query: {
- id: row.trace_id,
- span_id: row.span_id,
- datetime: datetime
- }
- })
- window.open(window.location.origin + '/' + href.href, '_blank')
- },
- isShow(label) {
- return this.colData.filter(i => i.title === label)[0].istrue
- },
- sortChangeTable(val) {
- // desc(倒序)和asc(正序)
- if (val.order === 'descending') {
- this.spansQuery.sort_type = 'DESC'
- } else if (val.order === 'ascending') {
- this.spansQuery.sort_type = 'ASC'
- }
- this.getServiceSpans()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .echartsWrap{
- width:100%;
- }
- .h6{
- font-size: 14px;
- }
- .Dur_input ::v-deep .el-input__inner{
- width:100px;
- }
- .noData{
- width: 100%;
- height: 200px;
- background: #fff;
- }
- .noData_title{
- margin-bottom: 0px;
- padding: 2px 5px;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- font-size: 14px;
- font-weight: 500;
- line-height: 1.57143;
- font-family: Inter, Helvetica, Arial, sans-serif;
- }
- .link-box{
- display:none;
- text-align: right;
- // position:relative;
- // top:26px;
- .to-inline-block{
- display: inline-block;
- + .to-inline-block{
- margin-left:10px;
- }
- button{
- font-size:14px;
- }
- }
- }
- </style>
|