Commit 7705e44e authored by nmilojevic1's avatar nmilojevic1

Fix Mr comments

parent cca79cd2
......@@ -27,6 +27,7 @@ module Gitlab
transaction.increment(:http_elasticsearch_requests_total, request_count) do
docstring 'Amount of calls to Elasticsearch servers during web requests'
end
transaction.observe(:http_elasticsearch_requests_duration_seconds, query_time) do
docstring 'Query time for Elasticsearch servers during web requests'
buckets HISTOGRAM_BUCKETS
......
......@@ -4,7 +4,7 @@ module Gitlab
module Metrics
# Class for tracking timing information about method calls
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
# `User#sign_in`.
......@@ -50,6 +50,10 @@ module Gitlab
def above_threshold?
real_time.in_milliseconds >= ::Gitlab::Metrics.method_call_threshold
end
private
attr_reader :labels, :transaction
end
end
end
......@@ -25,6 +25,7 @@ module Gitlab
transaction.increment(:http_redis_requests_total, request_count) do
docstring 'Amount of calls to Redis servers during web requests'
end
transaction.observe(:http_redis_requests_duration_seconds, query_time) do
docstring 'Query time for Redis servers during web requests'
buckets Gitlab::Instrumentation::Redis::QUERY_TIME_BUCKETS
......
......@@ -25,6 +25,7 @@ module Gitlab
buckets [0.001, 0.01, 0.1, 1, 10.0]
with_feature :prometheus_metrics_view_instrumentation
end
current_transaction.increment(:gitlab_transaction_view_duration_total, event.duration)
end
......
......@@ -45,6 +45,7 @@ module Gitlab
current_transaction.increment(:gitlab_cache_misses_total, 1) do
docstring 'Cache read miss'
end
current_transaction.increment(:gitlab_transaction_cache_read_miss_count_total, 1)
end
......@@ -56,6 +57,7 @@ module Gitlab
docstring 'Cache operations'
base_labels labels
end
current_transaction.observe(:gitlab_cache_operation_duration_seconds, duration / 1000.0) do
docstring 'Cache access time'
buckets [0.00001, 0.0001, 0.001, 0.01, 0.1, 1.0]
......
......@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Git::Blob, :seed_helper do
blob
end
it 'increment :gitlab_blob_truncated_false counter' do
it 'increments :gitlab_blob_truncated_false counter' do
expect(transaction)
.to receive(:increment).with(:gitlab_blob_truncated_false)
......
......@@ -9,8 +9,6 @@ RSpec.describe Gitlab::Metrics::ElasticsearchRackMiddleware do
let(:transaction) { Gitlab::Metrics::WebTransaction.new(env) }
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_requests_count) { 2 }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment