Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
12042405
Commit
12042405
authored
Nov 22, 2019
by
Dhiraj Bodicherla
Committed by
Martin Wortschack
Nov 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monitor dashboard instrumentation
Tracking the type of dashboard loaded and number of charts in dashboard
parent
ff90095e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
5 deletions
+37
-5
app/assets/javascripts/monitoring/monitoring_tracking_helper.js
...sets/javascripts/monitoring/monitoring_tracking_helper.js
+10
-0
app/assets/javascripts/monitoring/stores/actions.js
app/assets/javascripts/monitoring/stores/actions.js
+8
-5
changelogs/unreleased/34157-snowplow-custom-events-for-monitor-apm.yml
...released/34157-snowplow-custom-events-for-monitor-apm.yml
+5
-0
spec/frontend/monitoring/store/actions_spec.js
spec/frontend/monitoring/store/actions_spec.js
+14
-0
No files found.
app/assets/javascripts/monitoring/monitoring_tracking_helper.js
0 → 100644
View file @
12042405
import
Tracking
from
'
~/tracking
'
;
const
trackDashboardLoad
=
({
label
,
value
})
=>
Tracking
.
event
(
document
.
body
.
dataset
.
page
,
'
dashboard_fetch
'
,
{
label
,
property
:
'
count
'
,
value
,
});
export
default
trackDashboardLoad
;
app/assets/javascripts/monitoring/stores/actions.js
View file @
12042405
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
trackDashboardLoad
from
'
../monitoring_tracking_helper
'
;
import
statusCodes
from
'
../../lib/utils/http_status
'
;
import
statusCodes
from
'
../../lib/utils/http_status
'
;
import
{
backOff
}
from
'
../../lib/utils/common_utils
'
;
import
{
backOff
}
from
'
../../lib/utils/common_utils
'
;
import
{
s__
,
__
}
from
'
../../locale
'
;
import
{
s__
,
__
}
from
'
../../locale
'
;
...
@@ -45,7 +46,7 @@ export const requestMetricsDashboard = ({ commit }) => {
...
@@ -45,7 +46,7 @@ export const requestMetricsDashboard = ({ commit }) => {
export
const
receiveMetricsDashboardSuccess
=
({
commit
,
dispatch
},
{
response
,
params
})
=>
{
export
const
receiveMetricsDashboardSuccess
=
({
commit
,
dispatch
},
{
response
,
params
})
=>
{
commit
(
types
.
SET_ALL_DASHBOARDS
,
response
.
all_dashboards
);
commit
(
types
.
SET_ALL_DASHBOARDS
,
response
.
all_dashboards
);
commit
(
types
.
RECEIVE_METRICS_DATA_SUCCESS
,
response
.
dashboard
.
panel_groups
);
commit
(
types
.
RECEIVE_METRICS_DATA_SUCCESS
,
response
.
dashboard
.
panel_groups
);
dispatch
(
'
fetchPrometheusMetrics
'
,
params
);
return
dispatch
(
'
fetchPrometheusMetrics
'
,
params
);
};
};
export
const
receiveMetricsDashboardFailure
=
({
commit
},
error
)
=>
{
export
const
receiveMetricsDashboardFailure
=
({
commit
},
error
)
=>
{
commit
(
types
.
RECEIVE_METRICS_DATA_FAILURE
,
error
);
commit
(
types
.
RECEIVE_METRICS_DATA_FAILURE
,
error
);
...
@@ -83,10 +84,12 @@ export const fetchDashboard = ({ state, dispatch }, params) => {
...
@@ -83,10 +84,12 @@ export const fetchDashboard = ({ state, dispatch }, params) => {
return
backOffRequest
(()
=>
axios
.
get
(
state
.
dashboardEndpoint
,
{
params
}))
return
backOffRequest
(()
=>
axios
.
get
(
state
.
dashboardEndpoint
,
{
params
}))
.
then
(
resp
=>
resp
.
data
)
.
then
(
resp
=>
resp
.
data
)
.
then
(
response
=>
{
.
then
(
response
=>
dispatch
(
'
receiveMetricsDashboardSuccess
'
,
{
response
,
params
}))
dispatch
(
'
receiveMetricsDashboardSuccess
'
,
{
.
then
(()
=>
{
response
,
const
dashboardType
=
state
.
currentDashboard
===
''
?
'
default
'
:
'
custom
'
;
params
,
return
trackDashboardLoad
({
label
:
`
${
dashboardType
}
_metrics_dashboard`
,
value
:
state
.
metricsWithData
.
length
,
});
});
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
...
...
changelogs/unreleased/34157-snowplow-custom-events-for-monitor-apm.yml
0 → 100644
View file @
12042405
---
title
:
Add snowplow events for monitoring dashboard
merge_request
:
19455
author
:
type
:
added
spec/frontend/monitoring/store/actions_spec.js
View file @
12042405
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
...
@@ -226,12 +227,14 @@ describe('Monitoring store actions', () => {
...
@@ -226,12 +227,14 @@ describe('Monitoring store actions', () => {
let
state
;
let
state
;
const
response
=
metricsDashboardResponse
;
const
response
=
metricsDashboardResponse
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
Tracking
,
'
event
'
);
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
state
=
storeState
();
state
=
storeState
();
state
.
dashboardEndpoint
=
'
/dashboard
'
;
state
.
dashboardEndpoint
=
'
/dashboard
'
;
});
});
it
(
'
dispatches receive and success actions
'
,
done
=>
{
it
(
'
dispatches receive and success actions
'
,
done
=>
{
const
params
=
{};
const
params
=
{};
document
.
body
.
dataset
.
page
=
'
projects:environments:metrics
'
;
mock
.
onGet
(
state
.
dashboardEndpoint
).
reply
(
200
,
response
);
mock
.
onGet
(
state
.
dashboardEndpoint
).
reply
(
200
,
response
);
fetchDashboard
(
fetchDashboard
(
{
{
...
@@ -246,6 +249,17 @@ describe('Monitoring store actions', () => {
...
@@ -246,6 +249,17 @@ describe('Monitoring store actions', () => {
response
,
response
,
params
,
params
,
});
});
})
.
then
(()
=>
{
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
document
.
body
.
dataset
.
page
,
'
dashboard_fetch
'
,
{
label
:
'
custom_metrics_dashboard
'
,
property
:
'
count
'
,
value
:
0
,
},
);
done
();
done
();
})
})
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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