Commit 3b518f00 authored by 温海元's avatar 温海元

Merge branch 'optimize_log' into 'master'

Optimize log

See merge request QA/qa-api!38
parents 8f2e01b2 ad36941c
...@@ -7,6 +7,7 @@ const jenkinsService = require('../service/jenkinsService') ...@@ -7,6 +7,7 @@ const jenkinsService = require('../service/jenkinsService')
const k8sService = require('../service/k8sService') const k8sService = require('../service/k8sService')
const { DBConfig } = require('../service/mongoService') const { DBConfig } = require('../service/mongoService')
const { api } = require('../../src') const { api } = require('../../src')
const { StatisticsLog } = require('../service/mongoService');
const domain = 'liangkebang.com' const domain = 'liangkebang.com'
let domainTKE = 'liangkebang.net' let domainTKE = 'liangkebang.net'
...@@ -47,7 +48,7 @@ const dbSync = async function (ctx) { ...@@ -47,7 +48,7 @@ const dbSync = async function (ctx) {
not_delete_business_data: req.not_delete_business_data, not_delete_business_data: req.not_delete_business_data,
use_cache: req.use_cache, use_cache: req.use_cache,
domain, domain,
}) })
ctx.body = ctx.ok({ location: res.location }) ctx.body = ctx.ok({ location: res.location })
} }
...@@ -109,6 +110,23 @@ const dbSyncTke = async function (ctx) { ...@@ -109,6 +110,23 @@ const dbSyncTke = async function (ctx) {
domain: domainTKE, domain: domainTKE,
}) })
ctx.body = ctx.ok({ location: res.location }) ctx.body = ctx.ok({ location: res.location })
// 数据库同步时新增行为记录
if (ctx.request.method === 'POST' && ctx.response.status === 200 ) {
const user = await ctx.redisGet(config.QA_TOKEN, ctx.request.header['x-token'])
if (user) {
const body = ctx.request.body
const data = {
namespace: body.namespace,
active: '同步' + body.mysqlName,
microservice_name: body.dbname,
user: user.cn,
user_mail: user.mail,
detail: body,
}
await StatisticsLog.saveLog(data);
}
}
} }
const dbSyncQuery = async function (ctx) { const dbSyncQuery = async function (ctx) {
......
...@@ -19,7 +19,10 @@ const api = async function (ctx) { ...@@ -19,7 +19,10 @@ const api = async function (ctx) {
user_mail: user.mail, user_mail: user.mail,
detail: body, detail: body,
} }
await StatisticsLog.saveLog(data); // 用户行为记录中过滤rabbitmq
if (!(data.active === 'service_details' && data.microservice_name === 'rabbitmq')) {
await StatisticsLog.saveLog(data);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment