Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppMonitorSubscriber
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nongyingchen
AppMonitorSubscriber
Commits
9b8d06bd
Commit
9b8d06bd
authored
Sep 11, 2019
by
trace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加逻辑: 补全监控数量
parent
a3d9bb70
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
play.js
+21
-3
subscriber.json
+1
-0
No files found.
play.js
View file @
9b8d06bd
let
version
=
'1.
3.3
'
let
version
=
'1.
4.0
'
let
release
=
`<div><br/>
<br/>1. <br/>
原获取排名链接失效不单独通知
<br/>
补全监控数量, 配置添加参数: monitorNumAtLeast, 至少监控多少个APP. 保持自有 APP 比例, 减少关联可能性
<br/>
<div/>
<br/>
<br/>
...
...
@@ -48,6 +48,7 @@ let requestTopAppNum = isTest() && 1 || 100
let
aliveTime
=
9
// 多少点后开始发送邮件
let
theDaySendList
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
// 发送列表的时间(周几)
let
aliveInterval
=
isTest
()
&&
0.1
||
3
// 发送邮件间隔时间
let
monitorNumAtLeast
=
isTest
()
&&
5
||
700
// 监控最低数量 (当补全数据不足时, 也可能少于700)
let
start
=
true
// 是否开始爬取监控
let
dailyOnlineStartHours
=
7
let
dailyOnlineEndHours
=
9
...
...
@@ -114,6 +115,7 @@ function log(content, useRelease = false) {
if
(
isTest
()
||
useRelease
)
{
console
.
log
(
`[
${
new
Date
().
toLocaleString
()}
]:
${
content
}
`
)
}
return
content
}
function
isTest
()
{
let
testName
=
[
'taketrace'
]
...
...
@@ -171,7 +173,7 @@ sendEmail(`开始监控-----------------------`)
async
function
startMonitor
()
{
log
(
'开始监控'
)
while
(
start
)
{
log
(
`抓取一圈`
)
dingDing
(
log
(
`抓取一圈`
)
)
await
getConfig
()
.
then
(()
=>
{
// 部署通知, 更新说明
if
(
newDeploy
)
{
...
...
@@ -185,6 +187,21 @@ async function startMonitor() {
.
then
(()
=>
{
// 动态修改间隔得值
// 自有 app 没到时间不会进入监控
let
allN
=
allNames
(
monitorNames
)
// 将监控数量补全到700
let
less
=
monitorNumAtLeast
-
allN
.
length
let
logLess
=
less
for
(
let
key
in
status
)
{
if
(
less
==
0
||
less
<
0
)
{
break
}
if
(
!
allN
.
includes
(
key
)
&&
status
[
key
].
status
)
{
log
(
`push 补全:
${
key
}
`
)
allN
.
push
(
key
)
less
--
}
}
log
(
`补全后监控数量:
${
allN
.
length
}
, 补全:
${
logLess
}
`
)
return
allN
})
.
then
(
allN
=>
monitorIfOnline
(
allN
))
...
...
@@ -360,6 +377,7 @@ async function getConfig() {
sleepTime
=
sec
*
(
config
.
sleepTime
||
sleepTime
)
requestTimeout
=
sec
*
(
config
.
requestTimeout
||
requestTimeout
)
requestTopAppNum
=
config
.
requestTopAppNum
||
requestTopAppNum
monitorNumAtLeast
=
config
.
monitorNumAtLeast
||
monitorNumAtLeast
aliveTime
=
config
.
aliveTime
||
aliveTime
if
(
Array
.
isArray
(
config
.
theDaySendList
))
{
theDaySendList
=
config
.
theDaySendList
...
...
subscriber.json
View file @
9b8d06bd
{
"config"
:
{
"monitorNumAtLeast"
:
200
,
"dailyOnlineStartHours"
:
7
,
"dailyOnlineEndHours"
:
9
,
"defaultIntervalTimeForOurApp"
:
6
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment