Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
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
Kornkitt Poolsup
nexpie-grafana-theme
Commits
1ae24b36
Commit
1ae24b36
authored
Jun 16, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(profiler): fixed issues with frontend perf profiler
parent
2ceb58d0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
26 deletions
+17
-26
public/app/core/components/grafana_app.ts
+1
-0
public/app/core/profiler.ts
+14
-24
public/app/core/routes/dashboard_loaders.js
+1
-0
public/app/features/dashboard/dashboardLoaderSrv.js
+0
-1
public/app/features/dashboard/dashboard_ctrl.ts
+1
-1
No files found.
public/app/core/components/grafana_app.ts
View file @
1ae24b36
...
@@ -29,6 +29,7 @@ export class GrafanaCtrl {
...
@@ -29,6 +29,7 @@ export class GrafanaCtrl {
};
};
$scope
.
initDashboard
=
function
(
dashboardData
,
viewScope
)
{
$scope
.
initDashboard
=
function
(
dashboardData
,
viewScope
)
{
$scope
.
appEvent
(
"dashboard-fetch-end"
,
dashboardData
);
$controller
(
'DashboardCtrl'
,
{
$scope
:
viewScope
}).
init
(
dashboardData
);
$controller
(
'DashboardCtrl'
,
{
$scope
:
viewScope
}).
init
(
dashboardData
);
};
};
...
...
public/app/core/profiler.ts
View file @
1ae24b36
...
@@ -7,7 +7,6 @@ import angular from 'angular';
...
@@ -7,7 +7,6 @@ import angular from 'angular';
export
class
Profiler
{
export
class
Profiler
{
panelsRendered
:
number
;
panelsRendered
:
number
;
enabled
:
boolean
;
enabled
:
boolean
;
panels
:
any
[];
panelsInitCount
:
any
;
panelsInitCount
:
any
;
timings
:
any
;
timings
:
any
;
digestCounter
:
any
;
digestCounter
:
any
;
...
@@ -29,28 +28,21 @@ export class Profiler {
...
@@ -29,28 +28,21 @@ export class Profiler {
return
false
;
return
false
;
},
()
=>
{});
},
()
=>
{});
$rootScope
.
$on
(
'refresh'
,
this
.
refresh
.
bind
(
this
)
);
$rootScope
.
onAppEvent
(
'refresh'
,
this
.
refresh
.
bind
(
this
),
$rootScope
);
$rootScope
.
onAppEvent
(
'dashboard-fetch
ed'
,
this
.
dashboardFetched
.
bind
(
this
)
);
$rootScope
.
onAppEvent
(
'dashboard-fetch
-end'
,
this
.
dashboardFetched
.
bind
(
this
),
$rootScope
);
$rootScope
.
onAppEvent
(
'dashboard-initialized'
,
this
.
dashboardInitialized
.
bind
(
this
));
$rootScope
.
onAppEvent
(
'dashboard-initialized'
,
this
.
dashboardInitialized
.
bind
(
this
)
,
$rootScope
);
$rootScope
.
onAppEvent
(
'panel-initialized'
,
this
.
panelInitialized
.
bind
(
this
));
$rootScope
.
onAppEvent
(
'panel-initialized'
,
this
.
panelInitialized
.
bind
(
this
)
,
$rootScope
);
}
}
refresh
()
{
refresh
()
{
this
.
panels
=
[];
this
.
timings
.
query
=
0
;
this
.
timings
.
render
=
0
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
var
totalRender
=
0
;
console
.
log
(
'panel count: '
+
this
.
panelsInitCount
);
var
totalQuery
=
0
;
console
.
log
(
'total query: '
+
this
.
timings
.
query
);
console
.
log
(
'total render: '
+
this
.
timings
.
render
);
for
(
let
panelTiming
of
this
.
panels
)
{
console
.
log
(
'avg render: '
+
this
.
timings
.
render
/
this
.
panelsInitCount
);
totalRender
+=
panelTiming
.
render
;
totalQuery
+=
panelTiming
.
query
;
}
console
.
log
(
'panel count: '
+
this
.
panels
.
length
);
console
.
log
(
'total query: '
+
totalQuery
);
console
.
log
(
'total render: '
+
totalRender
);
console
.
log
(
'avg render: '
+
totalRender
/
this
.
panels
.
length
);
},
5000
);
},
5000
);
}
}
...
@@ -60,7 +52,8 @@ export class Profiler {
...
@@ -60,7 +52,8 @@ export class Profiler {
this
.
digestCounter
=
0
;
this
.
digestCounter
=
0
;
this
.
panelsInitCount
=
0
;
this
.
panelsInitCount
=
0
;
this
.
panelsRendered
=
0
;
this
.
panelsRendered
=
0
;
this
.
panels
=
[];
this
.
timings
.
query
=
0
;
this
.
timings
.
render
=
0
;
}
}
dashboardInitialized
()
{
dashboardInitialized
()
{
...
@@ -110,11 +103,8 @@ export class Profiler {
...
@@ -110,11 +103,8 @@ export class Profiler {
if
(
this
.
enabled
)
{
if
(
this
.
enabled
)
{
panelTimings
.
renderEnd
=
new
Date
().
getTime
();
panelTimings
.
renderEnd
=
new
Date
().
getTime
();
this
.
panels
.
push
({
this
.
timings
.
query
+=
panelTimings
.
queryEnd
-
panelTimings
.
queryStart
;
panelId
:
panelId
,
this
.
timings
.
render
+=
panelTimings
.
renderEnd
-
panelTimings
.
renderStart
;
query
:
panelTimings
.
queryEnd
-
panelTimings
.
queryStart
,
render
:
panelTimings
.
renderEnd
-
panelTimings
.
renderStart
,
});
}
}
}
}
...
...
public/app/core/routes/dashboard_loaders.js
View file @
1ae24b36
...
@@ -5,6 +5,7 @@ function (coreModule) {
...
@@ -5,6 +5,7 @@ function (coreModule) {
"use strict"
;
"use strict"
;
coreModule
.
default
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
,
$location
)
{
coreModule
.
default
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
,
$location
)
{
$scope
.
appEvent
(
"dashboard-fetch-start"
);
if
(
!
$routeParams
.
slug
)
{
if
(
!
$routeParams
.
slug
)
{
backendSrv
.
get
(
'/api/dashboards/home'
).
then
(
function
(
homeDash
)
{
backendSrv
.
get
(
'/api/dashboards/home'
).
then
(
function
(
homeDash
)
{
...
...
public/app/features/dashboard/dashboardLoaderSrv.js
View file @
1ae24b36
...
@@ -47,7 +47,6 @@ function (angular, moment, _, $, kbn, dateMath, impressionStore) {
...
@@ -47,7 +47,6 @@ function (angular, moment, _, $, kbn, dateMath, impressionStore) {
}
}
promise
.
then
(
function
(
result
)
{
promise
.
then
(
function
(
result
)
{
$rootScope
.
appEvent
(
"dashboard-fetched"
,
result
.
dashboard
);
if
(
result
.
meta
.
dashboardNotFound
!==
true
)
{
if
(
result
.
meta
.
dashboardNotFound
!==
true
)
{
impressionStore
.
impressions
.
addDashboardImpression
(
result
.
dashboard
.
id
);
impressionStore
.
impressions
.
addDashboardImpression
(
result
.
dashboard
.
id
);
...
...
public/app/features/dashboard/dashboard_ctrl.ts
View file @
1ae24b36
...
@@ -51,7 +51,7 @@ export class DashboardCtrl {
...
@@ -51,7 +51,7 @@ export class DashboardCtrl {
$scope
.
updateSubmenuVisibility
();
$scope
.
updateSubmenuVisibility
();
$scope
.
setWindowTitleAndTheme
();
$scope
.
setWindowTitleAndTheme
();
$scope
.
appEvent
(
"dashboard-
load
ed"
,
$scope
.
dashboard
);
$scope
.
appEvent
(
"dashboard-
initializ
ed"
,
$scope
.
dashboard
);
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
if
(
err
.
data
&&
err
.
data
.
message
)
{
err
.
message
=
err
.
data
.
message
;
}
if
(
err
.
data
&&
err
.
data
.
message
)
{
err
.
message
=
err
.
data
.
message
;
}
$scope
.
appEvent
(
"alert-error"
,
[
'Dashboard init failed'
,
'Template variables could not be initialized: '
+
err
.
message
]);
$scope
.
appEvent
(
"alert-error"
,
[
'Dashboard init failed'
,
'Template variables could not be initialized: '
+
err
.
message
]);
...
...
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