Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
enoch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
enoch
Commits
b6c55ef5
Commit
b6c55ef5
authored
Mar 06, 2020
by
vrg0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
当qps获取不成功时,显示未知
parent
b5f98256
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
3 deletions
+10
-3
path.go
pkg/report-form/path.go
+2
-0
report_form.go
pkg/report-form/report_form.go
+3
-0
service.go
pkg/report-form/service.go
+3
-1
service_map.go
pkg/report-form/service_map.go
+2
-2
No files found.
pkg/report-form/path.go
View file @
b6c55ef5
...
...
@@ -58,6 +58,8 @@ func (p *Path) initQps() {
maxqps
,
ok
:=
queryOneAndToInt
(
sql
)
if
ok
{
p
.
maxqps
=
maxqps
}
else
{
p
.
maxqps
=
-
1
}
}
...
...
pkg/report-form/report_form.go
View file @
b6c55ef5
...
...
@@ -26,6 +26,9 @@ var (
//Human-readable number
func
hrn
(
n
int
)
string
{
if
n
<
0
{
return
"未知"
}
num
:=
float64
(
n
)
unit
:=
float64
(
1024
)
if
num
<
unit
{
...
...
pkg/report-form/service.go
View file @
b6c55ef5
...
...
@@ -47,7 +47,7 @@ func NewService(name string, startTime time.Time, endTime time.Time) *Service {
endTime
:
endTime
,
pathMap
:
make
(
map
[
string
]
*
Path
),
nodeMap
:
make
(
map
[
string
]
*
Node
),
maxqps
:
0
,
maxqps
:
-
1
,
}
//初始化path
...
...
@@ -97,6 +97,8 @@ func (s *Service) initQps() {
maxqps
,
ok
:=
queryOneAndToInt
(
sql
)
if
ok
{
s
.
maxqps
=
maxqps
}
else
{
s
.
maxqps
=
-
1
}
}
...
...
pkg/report-form/service_map.go
View file @
b6c55ef5
...
...
@@ -194,7 +194,7 @@ func (sm *ServiceMap) GetMaxQps() int {
}
//取最大值
max
:=
0
max
:=
-
1
for
_
,
x
:=
range
maxList
{
if
x
>
max
{
max
=
x
...
...
@@ -211,7 +211,7 @@ func (sm *ServiceMap) getMaxQps(start time.Time, end time.Time) int {
sql
:=
fmt
.
Sprintf
(
sqlMaxQps
,
start
.
UnixNano
(),
end
.
UnixNano
())
maxqps
,
ok
:=
queryOneAndToInt
(
sql
)
if
!
ok
{
return
0
return
-
1
}
return
maxqps
}
...
...
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