Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ab361c47
authored
Feb 07, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: mccabe for VmGraphView
parent
d4f0e64c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
circle/dashboard/views.py
+13
-11
No files found.
circle/dashboard/views.py
View file @
ab361c47
...
...
@@ -1267,19 +1267,21 @@ class VmGraphView(LoginRequiredMixin, View):
if
not
instance
.
has_level
(
request
.
user
,
'user'
):
raise
PermissionDenied
()
prefix
=
'vm.
%
s'
%
instance
.
vm_name
if
metric
==
'cpu'
:
target
=
(
'cactiStyle(alias(derivative(
%
s.cpu.usage),'
'"cpu usage (
%%
)"))'
)
%
prefix
elif
metric
==
'memory'
:
target
=
(
'cactiStyle(alias(
%
s.memory.usage,'
'"memory usage (
%%
)"))'
)
%
prefix
elif
metric
==
'network'
:
target
=
(
'cactiStyle(aliasByMetric('
'derivative(
%
s.network.bytes_*)))'
)
%
prefix
else
:
targets
=
{
'cpu'
:
(
'cactiStyle(alias(derivative(
%
s.cpu.usage),'
'"cpu usage (
%%
)"))'
),
'memory'
:
(
'cactiStyle(alias(
%
s.memory.usage,'
'"memory usage (
%%
)"))'
),
'network'
:
(
'cactiStyle(aliasByMetric('
'derivative(
%
s.network.bytes_*)))'
),
}
if
metric
not
in
targets
.
keys
():
raise
SuspiciousOperation
()
prefix
=
'vm.
%
s'
%
instance
.
vm_name
target
=
targets
[
metric
]
%
prefix
title
=
'
%
s (
%
s) -
%
s'
%
(
instance
.
name
,
instance
.
vm_name
,
metric
)
params
=
urlencode
({
'target'
:
target
,
...
...
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