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
7705e44e
Commit
7705e44e
authored
Jun 10, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Mr comments
parent
cca79cd2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
4 deletions
+11
-4
lib/gitlab/metrics/elasticsearch_rack_middleware.rb
lib/gitlab/metrics/elasticsearch_rack_middleware.rb
+1
-0
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+5
-1
lib/gitlab/metrics/redis_rack_middleware.rb
lib/gitlab/metrics/redis_rack_middleware.rb
+1
-0
lib/gitlab/metrics/subscribers/action_view.rb
lib/gitlab/metrics/subscribers/action_view.rb
+1
-0
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+2
-0
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+1
-1
spec/lib/gitlab/metrics/elasticsearch_rack_middleware_spec.rb
.../lib/gitlab/metrics/elasticsearch_rack_middleware_spec.rb
+0
-2
No files found.
lib/gitlab/metrics/elasticsearch_rack_middleware.rb
View file @
7705e44e
...
@@ -27,6 +27,7 @@ module Gitlab
...
@@ -27,6 +27,7 @@ module Gitlab
transaction
.
increment
(
:http_elasticsearch_requests_total
,
request_count
)
do
transaction
.
increment
(
:http_elasticsearch_requests_total
,
request_count
)
do
docstring
'Amount of calls to Elasticsearch servers during web requests'
docstring
'Amount of calls to Elasticsearch servers during web requests'
end
end
transaction
.
observe
(
:http_elasticsearch_requests_duration_seconds
,
query_time
)
do
transaction
.
observe
(
:http_elasticsearch_requests_duration_seconds
,
query_time
)
do
docstring
'Query time for Elasticsearch servers during web requests'
docstring
'Query time for Elasticsearch servers during web requests'
buckets
HISTOGRAM_BUCKETS
buckets
HISTOGRAM_BUCKETS
...
...
lib/gitlab/metrics/method_call.rb
View file @
7705e44e
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
module
Metrics
module
Metrics
# Class for tracking timing information about method calls
# Class for tracking timing information about method calls
class
MethodCall
class
MethodCall
attr_reader
:real_time
,
:cpu_time
,
:call_count
,
:labels
,
:transaction
attr_reader
:real_time
,
:cpu_time
,
:call_count
# name - The full name of the method (including namespace) such as
# name - The full name of the method (including namespace) such as
# `User#sign_in`.
# `User#sign_in`.
...
@@ -50,6 +50,10 @@ module Gitlab
...
@@ -50,6 +50,10 @@ module Gitlab
def
above_threshold?
def
above_threshold?
real_time
.
in_milliseconds
>=
::
Gitlab
::
Metrics
.
method_call_threshold
real_time
.
in_milliseconds
>=
::
Gitlab
::
Metrics
.
method_call_threshold
end
end
private
attr_reader
:labels
,
:transaction
end
end
end
end
end
end
lib/gitlab/metrics/redis_rack_middleware.rb
View file @
7705e44e
...
@@ -25,6 +25,7 @@ module Gitlab
...
@@ -25,6 +25,7 @@ module Gitlab
transaction
.
increment
(
:http_redis_requests_total
,
request_count
)
do
transaction
.
increment
(
:http_redis_requests_total
,
request_count
)
do
docstring
'Amount of calls to Redis servers during web requests'
docstring
'Amount of calls to Redis servers during web requests'
end
end
transaction
.
observe
(
:http_redis_requests_duration_seconds
,
query_time
)
do
transaction
.
observe
(
:http_redis_requests_duration_seconds
,
query_time
)
do
docstring
'Query time for Redis servers during web requests'
docstring
'Query time for Redis servers during web requests'
buckets
Gitlab
::
Instrumentation
::
Redis
::
QUERY_TIME_BUCKETS
buckets
Gitlab
::
Instrumentation
::
Redis
::
QUERY_TIME_BUCKETS
...
...
lib/gitlab/metrics/subscribers/action_view.rb
View file @
7705e44e
...
@@ -25,6 +25,7 @@ module Gitlab
...
@@ -25,6 +25,7 @@ module Gitlab
buckets
[
0.001
,
0.01
,
0.1
,
1
,
10.0
]
buckets
[
0.001
,
0.01
,
0.1
,
1
,
10.0
]
with_feature
:prometheus_metrics_view_instrumentation
with_feature
:prometheus_metrics_view_instrumentation
end
end
current_transaction
.
increment
(
:gitlab_transaction_view_duration_total
,
event
.
duration
)
current_transaction
.
increment
(
:gitlab_transaction_view_duration_total
,
event
.
duration
)
end
end
...
...
lib/gitlab/metrics/subscribers/rails_cache.rb
View file @
7705e44e
...
@@ -45,6 +45,7 @@ module Gitlab
...
@@ -45,6 +45,7 @@ module Gitlab
current_transaction
.
increment
(
:gitlab_cache_misses_total
,
1
)
do
current_transaction
.
increment
(
:gitlab_cache_misses_total
,
1
)
do
docstring
'Cache read miss'
docstring
'Cache read miss'
end
end
current_transaction
.
increment
(
:gitlab_transaction_cache_read_miss_count_total
,
1
)
current_transaction
.
increment
(
:gitlab_transaction_cache_read_miss_count_total
,
1
)
end
end
...
@@ -56,6 +57,7 @@ module Gitlab
...
@@ -56,6 +57,7 @@ module Gitlab
docstring
'Cache operations'
docstring
'Cache operations'
base_labels
labels
base_labels
labels
end
end
current_transaction
.
observe
(
:gitlab_cache_operation_duration_seconds
,
duration
/
1000.0
)
do
current_transaction
.
observe
(
:gitlab_cache_operation_duration_seconds
,
duration
/
1000.0
)
do
docstring
'Cache access time'
docstring
'Cache access time'
buckets
[
0.00001
,
0.0001
,
0.001
,
0.01
,
0.1
,
1.0
]
buckets
[
0.00001
,
0.0001
,
0.001
,
0.01
,
0.1
,
1.0
]
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
7705e44e
...
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Git::Blob, :seed_helper do
...
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Git::Blob, :seed_helper do
blob
blob
end
end
it
'increment :gitlab_blob_truncated_false counter'
do
it
'increment
s
:gitlab_blob_truncated_false counter'
do
expect
(
transaction
)
expect
(
transaction
)
.
to
receive
(
:increment
).
with
(
:gitlab_blob_truncated_false
)
.
to
receive
(
:increment
).
with
(
:gitlab_blob_truncated_false
)
...
...
spec/lib/gitlab/metrics/elasticsearch_rack_middleware_spec.rb
View file @
7705e44e
...
@@ -9,8 +9,6 @@ RSpec.describe Gitlab::Metrics::ElasticsearchRackMiddleware do
...
@@ -9,8 +9,6 @@ RSpec.describe Gitlab::Metrics::ElasticsearchRackMiddleware do
let
(
:transaction
)
{
Gitlab
::
Metrics
::
WebTransaction
.
new
(
env
)
}
let
(
:transaction
)
{
Gitlab
::
Metrics
::
WebTransaction
.
new
(
env
)
}
describe
'#call'
do
describe
'#call'
do
# let(:counter) { instance_double(Prometheus::Client::Counter, increment: nil) }
# let(:histogram) { instance_double(Prometheus::Client::Histogram, observe: nil) }
let
(
:elasticsearch_query_time
)
{
0.1
}
let
(
:elasticsearch_query_time
)
{
0.1
}
let
(
:elasticsearch_requests_count
)
{
2
}
let
(
:elasticsearch_requests_count
)
{
2
}
...
...
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