Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
6c1fbf96
Commit
6c1fbf96
authored
Mar 08, 2024
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好办加好友统计
parent
42f44a17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
27 deletions
+30
-27
HBQwMonitorBO.java
...ava/com/gic/haoban/manage/service/pojo/HBQwMonitorBO.java
+9
-10
HBQwMonitorUtils.java
.../com/gic/haoban/manage/service/util/HBQwMonitorUtils.java
+20
-16
InfluxDbMonitorUtils.java
.../gic/haoban/manage/service/util/InfluxDbMonitorUtils.java
+1
-1
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/HBQwMonitorBO.java
View file @
6c1fbf96
...
...
@@ -3,9 +3,8 @@ package com.gic.haoban.manage.service.pojo;
public
class
HBQwMonitorBO
{
private
String
host
;
private
String
type
;
private
int
num
;
private
int
failNum
;
public
String
getHost
()
{
return
host
;
}
...
...
@@ -14,14 +13,6 @@ public class HBQwMonitorBO {
this
.
host
=
host
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
int
getNum
()
{
return
num
;
}
...
...
@@ -29,4 +20,12 @@ public class HBQwMonitorBO {
public
void
setNum
(
int
num
)
{
this
.
num
=
num
;
}
public
int
getFailNum
()
{
return
failNum
;
}
public
void
setFailNum
(
int
failNum
)
{
this
.
failNum
=
failNum
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/HBQwMonitorUtils.java
View file @
6c1fbf96
...
...
@@ -41,24 +41,28 @@ public class HBQwMonitorUtils {
public
static
void
addByTimer
()
{
List
<
String
>
ipList
=
DubboInvokeUtil
.
getServiceHostList
(
MemberUnionidRelatedApiService
.
class
)
;
logger
.
info
(
"add timer"
);
for
(
int
i
=
0
;
i
<
keyList
.
size
();
i
++)
{
for
(
String
ip
:
ipList
)
{
String
key
=
keyList
.
get
(
i
)+
ip
;
int
count
=
0
;
Object
countObj
=
RedisUtil
.
getCache
(
key
)
;
if
(
null
!=
countObj
)
{
count
=
Integer
.
valueOf
(
countObj
.
toString
())
;
}
RAtomicLong
cache
=
RedisUtil
.
getRedisClient
().
getAtomicLong
(
key
);
cache
.
addAndGet
(-
count
)
;
HBQwMonitorBO
bo
=
new
HBQwMonitorBO
()
;
bo
.
setHost
(
ip
);
bo
.
setType
(
""
+
i
);
bo
.
setNum
(
count
);
InfluxDbMonitorUtils
.
getInstance
().
friendAdd
(
bo
);
}
for
(
String
ip
:
ipList
)
{
int
totalNum
=
getNum
(
keyList
.
get
(
0
),
ip
)
;
int
failNum
=
getNum
(
keyList
.
get
(
1
),
ip
);
HBQwMonitorBO
bo
=
new
HBQwMonitorBO
()
;
bo
.
setHost
(
ip
);
bo
.
setNum
(
totalNum
);
bo
.
setFailNum
(
failNum
);
InfluxDbMonitorUtils
.
getInstance
().
friendAdd
(
bo
);
}
}
private
static
int
getNum
(
String
key
,
String
ip
)
{
int
count
=
0
;
Object
countObj
=
RedisUtil
.
getCache
(
key
)
;
if
(
null
!=
countObj
)
{
count
=
Integer
.
valueOf
(
countObj
.
toString
())
;
}
RAtomicLong
cache
=
RedisUtil
.
getRedisClient
().
getAtomicLong
(
key
);
cache
.
addAndGet
(-
count
)
;
return
count
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/InfluxDbMonitorUtils.java
View file @
6c1fbf96
...
...
@@ -58,9 +58,9 @@ public class InfluxDbMonitorUtils {
influxDB
.
write
(
Point
.
measurement
(
"hb_qw_friend_monitor"
)
.
time
(
System
.
currentTimeMillis
(),
TimeUnit
.
MILLISECONDS
)
.
addField
(
"num"
,
bo
.
getNum
())
.
addField
(
"failNum"
,
bo
.
getFailNum
())
.
tag
(
"application"
,
"haoban-manage3"
)
.
tag
(
"host"
,
bo
.
getHost
())
.
tag
(
"type"
,
bo
.
getType
())
.
build
());
}
...
...
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