Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@get('/getMetricsNames')
async getMetricsNames(ctx) {
const query = ctx.query;
const {scope, scopeName, env} = query;
const data = await this.metricsService.getMetricsNames({
scope, scopeName, env,
});
ctx.body = {
success: true,
data,
};
}
@get('/getCustomMetricsNames')
async getCustomMetricsNames(ctx) {
const query = ctx.query;
const {scope, scopeName, env} = query;
const data = await this.metricsService.getCustomMetricsNames({
scope, scopeName, env,
});
ctx.body = {
success: true,
data,
};
}
@get('/queryMetricsLatest')
async queryMetricsLatest(ctx) {
@get('/traceNodeSummary')
async traceNodeSummary(ctx) {
const query = ctx.query;
const result = await this.traceService.traceNodeSummary(query);
ctx.body = wrapJson(result);
}
@get('/spanTargetList')
async spanTargetList(ctx) {
const query = ctx.query;
const result = await this.traceService.spanTargetList(query);
ctx.body = wrapJson(result);
}
@get('/listNodesByTarget')
async listNodesByTarget(ctx) {
const query = ctx.query;
const result = await this.traceService.listNodesByTarget(query);
ctx.body = wrapJson(result);
}
@get('/spansSummaryTrend')
async spansSummaryTrend(ctx) {
const query = ctx.query;
const result = await this.traceService.spansSummaryTrend(query);
ctx.body = wrapJson(result);
}
@get('/traceFlowHistogram')
async traceFlowHistogram(ctx) {
const query = ctx.query;
import { get, post, inject } from 'midway-web';
import {wrapJson} from '../../core/util/util';
export class TracingCtrl {
@inject('traceService')
traceService;
@get('/listFocusTraces')
async focusTraces(ctx) {
const query = ctx.query;
const result = await this.traceService.listFocusTraces(query);
ctx.body = wrapJson(result);
}
@get('/listTraces')
async traces(ctx) {
const query = ctx.query;
const result = await this.traceService.listTraces(query);
ctx.body = wrapJson(result);
}
@post('/toggleFocus')
async toggleFocus(ctx) {
const body = ctx.request.body;
const result = await this.traceService.toggleTraceFocus(body);
ctx.body = wrapJson(result);
}
@get('/traceDetail')
async traceDetail(ctx) {
const query = ctx.query;
import * as Interface from '../../interface/services/IErrorService';
import * as moment from 'moment';
import * as _ from 'lodash';
import { inject, get, logger } from 'midway-web';
export class ErrorCtrl {
@logger()
logger;
@inject('errorService')
errorServ;
@get('/queryErrors')
async queryErrors(ctx) {
const startTime: moment.Moment = moment(parseInt(ctx.request.query.startTime, 10));
const endTime: moment.Moment = moment(parseInt(ctx.request.query.endTime, 10));
const ago: moment.Moment = moment().subtract(15, 'minutes');
const _s: moment.Moment = !startTime.isValid() ? ago : startTime;
const _e: moment.Moment = !endTime.isValid() ? moment() : endTime;
const scope: string = _.trim(ctx.request.query.scope || '');
const scopeName: string = _.trim(ctx.request.query.scopeName || '');
const env: string = _.trim(ctx.request.query.env || '');
const logPath: string = _.trim(ctx.request.query.logPath || '');
const ip: string = _.trim(ctx.request.query.ip || '');
const keyword: string = _.trim(ctx.request.query.keyword) || '';
const level: string = _.trim(ctx.request.query.level) || '';
const pageSize: number = parseInt(ctx.request.query.pageSize, 10);
const page: number = parseInt(ctx.request.query.page, 10);
@get('/traceNodeSummaryTrend')
async traceNodeSummaryTrend(ctx) {
const query = ctx.query;
const result = await this.traceService.traceNodeSummaryTrend(query);
ctx.body = wrapJson(result);
}
@get('/spanTargetSummaryTrend')
async spanTargetSummaryTrend(ctx) {
const query = ctx.query;
const result = await this.traceService.spanTargetSummaryTrend(query);
ctx.body = wrapJson(result);
}
@get('/listTraceByName')
async listTraceByName(ctx) {
const query = ctx.query;
const result = await this.traceService.listTraceByName(query);
ctx.body = wrapJson(result);
}
@get('/traceNodeSummaryList')
async traceNodeSummaryList(ctx) {
const query = ctx.query;
const result = await this.traceService.traceNodeSummaryList(query);
ctx.body = wrapJson(result);
}
@get('/traceSummary')
async traceSummary(ctx) {
const query = ctx.query;
const query = ctx.query;
const data = await this.applicationService.listByUser(ctx.uid, {
offset: parseInt(query.offset, 10) || 0,
limit: parseInt(query.limit, 10) || 20,
});
ctx.body = wrapJson(data);
}
@get('/queryGroups')
async queryGroups(ctx) {
const query = ctx.query;
const data = await this.applicationService.queryGroups(query);
ctx.body = wrapJson(data);
}
@get('/queryHosts')
async queryHosts(ctx) {
const query = ctx.query;
const data = await this.applicationService.queryHosts(query);
ctx.body = wrapJson(data);
}
@get('/groupExist')
async groupExist(ctx) {
const query = ctx.query;
const data = await this.applicationService.groupExist(query);
ctx.body = wrapJson(data);
}
@post('/groupUpsert')
async groupUpsert(ctx) {
const body = ctx.request.body;
@get('/listNodesByTarget')
async listNodesByTarget(ctx) {
const query = ctx.query;
const result = await this.traceService.listNodesByTarget(query);
ctx.body = wrapJson(result);
}
@get('/spansSummaryTrend')
async spansSummaryTrend(ctx) {
const query = ctx.query;
const result = await this.traceService.spansSummaryTrend(query);
ctx.body = wrapJson(result);
}
@get('/traceFlowHistogram')
async traceFlowHistogram(ctx) {
const query = ctx.query;
const result = await this.traceService.traceFlowHistogram(query);
ctx.body = wrapJson(result);
}
}
import { inject, get, post } from 'midway-web';
import {IApplicationService} from '../../interface/services/IApplicationService';
import { wrapJson } from '../../core/util/util';
export class ApplicationCtrl {
@inject()
applicationService: IApplicationService;
@get('/listByUser')
async listByUser(ctx) {
const query = ctx.query;
const data = await this.applicationService.listByUser(ctx.uid, {
offset: parseInt(query.offset, 10) || 0,
limit: parseInt(query.limit, 10) || 20,
});
ctx.body = wrapJson(data);
}
@get('/queryGroups')
async queryGroups(ctx) {
const query = ctx.query;
const data = await this.applicationService.queryGroups(query);
ctx.body = wrapJson(data);
}
@get('/traceNodeSummaryList')
async traceNodeSummaryList(ctx) {
const query = ctx.query;
const result = await this.traceService.traceNodeSummaryList(query);
ctx.body = wrapJson(result);
}
@get('/traceSummary')
async traceSummary(ctx) {
const query = ctx.query;
const result = await this.traceService.traceSummary(query);
ctx.body = wrapJson(result);
}
@get('/traceNodeSummary')
async traceNodeSummary(ctx) {
const query = ctx.query;
const result = await this.traceService.traceNodeSummary(query);
ctx.body = wrapJson(result);
}
@get('/spanTargetList')
async spanTargetList(ctx) {
const query = ctx.query;
const result = await this.traceService.spanTargetList(query);
ctx.body = wrapJson(result);
}
@get('/listNodesByTarget')
async listNodesByTarget(ctx) {
const query = ctx.query;
@get('/traceDetail')
async traceDetail(ctx) {
const query = ctx.query;
const result = await this.traceService.traceDetail(query);
ctx.body = wrapJson(result);
}
@get('/traceTotalitySummary')
async traceTotality(ctx) {
const query = ctx.query;
const result = await this.traceService.traceTotalitySummary(query);
ctx.body = wrapJson(result);
}
@get('/spanTotalitySummary')
async spanTotality(ctx) {
const query = ctx.query;
const result = await this.traceService.spanTotalitySummary(query);
ctx.body = wrapJson(result);
}
@get('/traceSummaryTrend')
async traceSummaryTrend(ctx) {
const query = ctx.query;
const result = await this.traceService.traceSummaryTrend(query);
ctx.body = wrapJson(result);
}
@get('/traceNodeSummaryTrend')
async traceNodeSummaryTrend(ctx) {
const query = ctx.query;