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
e5b6b17a
Commit
e5b6b17a
authored
Jun 26, 2020
by
Matthias Kaeppler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hourly request volume metric
This is pulled from Prometheus as well.
parent
81d353bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
doc/development/telemetry/usage_ping.md
doc/development/telemetry/usage_ping.md
+5
-3
lib/gitlab/usage_data_concerns/topology.rb
lib/gitlab/usage_data_concerns/topology.rb
+10
-1
spec/lib/gitlab/usage_data_concerns/topology_spec.rb
spec/lib/gitlab/usage_data_concerns/topology_spec.rb
+14
-0
No files found.
doc/development/telemetry/usage_ping.md
View file @
e5b6b17a
...
...
@@ -666,8 +666,9 @@ appear to be associated to any of the services running, since they all appear to
|
`clusters_applications_runner`
|
`usage_activity_by_stage`
|
`verify`
| | | Unique clusters with Runner enabled |
|
`projects_reporting_ci_cd_back_to_github: 0`
|
`usage_activity_by_stage`
|
`verify`
| | | Unique projects with a GitHub pipeline enabled |
|
`merge_requests_users`
|
`usage_activity_by_stage_monthly`
|
`create`
| | | Unique count of users who used a merge request |
|
`nodes`
|
`topology`
|
`enablement`
| | | The list of server nodes on which GitLab components are running |
|
`duration_s`
|
`topology`
|
`enablement`
| | | Time it took to collect topology data |
|
`application_requests_per_hour`
|
`topology`
|
`enablement`
| | | Number of requests to the web application per hour |
|
`nodes`
|
`topology`
|
`enablement`
| | | The list of server nodes on which GitLab components are running |
|
`node_memory_total_bytes`
|
`topology > nodes`
|
`enablement`
| | | The total available memory of this node |
|
`node_cpus`
|
`topology > nodes`
|
`enablement`
| | | The number of CPU cores of this node |
|
`node_services`
|
`topology > nodes`
|
`enablement`
| | | The list of GitLab services running on this node |
...
...
@@ -873,6 +874,8 @@ The following is example content of the Usage Ping payload.
}
},
"topology"
:
{
"duration_s"
:
0.013836685999194742
,
"application_requests_per_hour"
:
4224
,
"nodes"
:
[
{
"node_memory_total_bytes"
:
33269903360
,
...
...
@@ -897,8 +900,7 @@ The following is example content of the Usage Ping payload.
...
},
...
],
"duration_s"
:
0.013836685999194742
]
}
}
```
lib/gitlab/usage_data_concerns/topology.rb
View file @
e5b6b17a
...
...
@@ -28,11 +28,20 @@ module Gitlab
def
topology_fetch_all_data
with_prometheus_client
(
fallback:
{})
do
|
client
|
{
application_requests_per_hour:
topology_app_requests_per_hour
(
client
),
nodes:
topology_node_data
(
client
)
}
}
.
compact
end
end
def
topology_app_requests_per_hour
(
client
)
result
=
client
.
query
(
one_week_average
(
'gitlab_usage_ping:ops:rate5m'
)).
first
return
unless
result
# the metric is recorded as a per-second rate
(
result
[
'value'
].
last
.
to_f
*
1
.
hour
).
to_i
end
def
topology_node_data
(
client
)
# node-level data
by_instance_mem
=
topology_node_memory
(
client
)
...
...
spec/lib/gitlab/usage_data_concerns/topology_spec.rb
View file @
e5b6b17a
...
...
@@ -22,6 +22,7 @@ RSpec.describe Gitlab::UsageDataConcerns::Topology do
context
'tracking node metrics'
do
it
'contains node level metrics for each instance'
do
expect_prometheus_api_to
(
receive_app_request_volume_query
,
receive_node_memory_query
,
receive_node_cpu_count_query
,
receive_node_service_memory_rss_query
,
...
...
@@ -32,6 +33,7 @@ RSpec.describe Gitlab::UsageDataConcerns::Topology do
expect
(
subject
[
:topology
]).
to
eq
({
duration_s:
0
,
application_requests_per_hour:
36
,
nodes:
[
{
node_memory_total_bytes:
512
,
...
...
@@ -76,6 +78,7 @@ RSpec.describe Gitlab::UsageDataConcerns::Topology do
context
'and some node memory metrics are missing'
do
it
'removes the respective entries'
do
expect_prometheus_api_to
(
receive_app_request_volume_query
(
result:
[]),
receive_node_memory_query
(
result:
[]),
receive_node_cpu_count_query
,
receive_node_service_memory_rss_query
(
result:
[]),
...
...
@@ -149,6 +152,17 @@ RSpec.describe Gitlab::UsageDataConcerns::Topology do
end
end
def
receive_app_request_volume_query
(
result:
nil
)
receive
(
:query
)
.
with
(
/gitlab_usage_ping:ops:rate/
)
.
and_return
(
result
||
[
{
'metric'
=>
{
'component'
=>
'http_requests'
,
'service'
=>
'workhorse'
},
'value'
=>
[
1000
,
'0.01'
]
}
])
end
def
receive_node_memory_query
(
result:
nil
)
receive
(
:query
)
.
with
(
/node_memory_total_bytes/
,
an_instance_of
(
Hash
))
...
...
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