Commit 7fac413d authored by 赵威's avatar 赵威

add msg

parent a88ffad6
...@@ -110,23 +110,25 @@ object Main extends LazyLogging { ...@@ -110,23 +110,25 @@ object Main extends LazyLogging {
logger.info(s"${user.eventCn} ${deviceId}") logger.info(s"${user.eventCn} ${deviceId}")
val cost = streamTimeBegin - user.sendTimestamp val cost = streamTimeBegin - user.sendTimestamp
val msg = Map(
"method" -> "Main.main",
"deviceId" -> deviceId,
"eventCn" -> user.eventCn,
"action" -> user.action,
"cityId" -> user.cityId.toString,
"projects" -> user.projects.mkString(" "),
"diaryRead" -> diaryRead.size.toString,
"tractateRead" -> tractateRead.size.toString,
"answerRead" -> answerRead.size.toString,
"cost" -> s"${cost}ms",
"description" -> "收到请求到开始处理的耗时"
)
if (deviceId == "64695DE0-B926-4188-9C62-D987DC20BEDF") {
DingTalk.send(msg, contentType = "debug")
}
if (cost > 1500) { if (cost > 1500) {
deviceId == "64695DE0-B926-4188-9C62-D987DC20BEDF" DingTalk.send(msg)
DingTalk.send(
Map(
"method" -> "Main.main",
"deviceId" -> deviceId,
"eventCn" -> user.eventCn,
"action" -> user.action,
"cityId" -> user.cityId.toString,
"projects" -> user.projects.mkString(" "),
"diaryRead" -> diaryRead.size.toString,
"tractateRead" -> tractateRead.size.toString,
"answerRead" -> answerRead.size.toString,
"cost" -> s"${cost}ms",
"description" -> "收到请求到开始处理的耗时"
)
)
} }
deviceId deviceId
......
...@@ -46,12 +46,19 @@ object DingTalk { ...@@ -46,12 +46,19 @@ object DingTalk {
} }
def mkUrl(contentType: String = "msg"): String = { def mkUrl(contentType: String = "msg"): String = {
var secret = "SECa194492f061e5b422452baee55b45f95c68bcc9fdbfa0439e0fa3f36d25d8840" var secret = ""
var token = "c39b1c5344558f46a8d1450fafc20366e64434ec58578a94df12c0f4b03dbad8" var token = ""
if (contentType != "msg") { contentType match {
secret = "SECc404abeefb4985e4ad1e3189bfbb3932b0005109fb5ecddc1f1f1526a1996f9c" case "debug" =>
token = "c90b88ddf6be2398eb72429ee897a24fe3e80e85b1a896a7e5e091baf39344ca" secret = "SECb6b55348a0859a83afd499bef8fd9a69df3bd7b983e65c32596e66c367c87adb"
token = "e9cb1271ab886e16d514899f62d4204a637f065c5086165a740cf18f67f9d7a8"
case "exception" =>
secret = "SECc404abeefb4985e4ad1e3189bfbb3932b0005109fb5ecddc1f1f1526a1996f9c"
token = "c90b88ddf6be2398eb72429ee897a24fe3e80e85b1a896a7e5e091baf39344ca"
case _ =>
secret = "SECa194492f061e5b422452baee55b45f95c68bcc9fdbfa0439e0fa3f36d25d8840"
token = "c39b1c5344558f46a8d1450fafc20366e64434ec58578a94df12c0f4b03dbad8"
} }
val r = requests.get("https://api.github.com/users/lihaoyi") val r = requests.get("https://api.github.com/users/lihaoyi")
......
...@@ -63,16 +63,18 @@ object Redis { ...@@ -63,16 +63,18 @@ object Redis {
} }
client.expire(key, 60 * 60 * 24 * 15) client.expire(key, 60 * 60 * 24 * 15)
val total = System.currentTimeMillis - timeBegin val total = System.currentTimeMillis - timeBegin
val msg = Map(
"method" -> "Redis.save",
"deviceId" -> deviceId,
"contentType" -> contentType,
"description" -> "从流开始处理到存入结果的总耗时",
"streamTotalSeconds" -> s"${total}ms"
)
if (deviceId == "64695DE0-B926-4188-9C62-D987DC20BEDF") {
DingTalk.send(msg, contentType = "debug")
}
if (total > 1500) { if (total > 1500) {
DingTalk.send( DingTalk.send(msg)
Map(
"method" -> "Redis.save",
"deviceId" -> deviceId,
"contentType" -> contentType,
"description" -> "从流开始处理到存入结果的总耗时",
"streamTotalSeconds" -> s"${total}ms"
)
)
} }
} }
} }
......
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