Commit b8b90f2c authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rc/remove_influxdb_entry_points' into 'master'

Remove influxdb entry points

See merge request gitlab-org/gitlab!31149
parents 48623138 bed42254
......@@ -18,7 +18,6 @@ linters:
- "app/views/admin/application_settings/_abuse.html.haml"
- "app/views/admin/application_settings/_diff_limits.html.haml"
- "app/views/admin/application_settings/_gitaly.html.haml"
- "app/views/admin/application_settings/_influx.html.haml"
- "app/views/admin/application_settings/_ip_limits.html.haml"
- "app/views/admin/application_settings/_performance.html.haml"
- "app/views/admin/application_settings/_plantuml.html.haml"
......
......@@ -135,7 +135,6 @@ end
# loading of our custom migration templates.
if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && defined?(Rails::Generators))
require 'pathname'
require 'influxdb'
require 'connection_pool'
require 'method_source'
......@@ -193,10 +192,6 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
GC::Profiler.enable
Gitlab::Cluster::LifecycleEvents.on_worker_start do
Gitlab::Metrics::Samplers::InfluxSampler.initialize_instance.start
end
module TrackNewRedisConnections
def connect(*args)
val = super
......
......@@ -2,17 +2,106 @@
module Gitlab
module Metrics
include Gitlab::Metrics::InfluxDb
include Gitlab::Metrics::Prometheus
include Gitlab::Metrics::Methods
EXECUTION_MEASUREMENT_BUCKETS = [0.001, 0.01, 0.1, 1].freeze
@error = false
def self.enabled?
influx_metrics_enabled? || prometheus_metrics_enabled?
prometheus_metrics_enabled?
end
def self.error?
@error
end
# Tracks an event.
#
# See `Gitlab::Metrics::Transaction#add_event` for more details.
def self.add_event(*args)
current_transaction&.add_event(*args)
end
# Allow access from other metrics related middlewares
def self.current_transaction
Transaction.current
end
# Returns the prefix to use for the name of a series.
def self.series_prefix
@series_prefix ||= Gitlab::Runtime.sidekiq? ? 'sidekiq_' : 'rails_'
end
def self.settings
@settings ||= begin
current_settings = Gitlab::CurrentSettings.current_application_settings
{
method_call_threshold: current_settings[:metrics_method_call_threshold]
}
end
end
def self.method_call_threshold
# This is memoized since this method is called for every instrumented
# method. Loading data from an external cache on every method call slows
# things down too much.
# in milliseconds
@method_call_threshold ||= settings[:method_call_threshold]
end
# Measures the execution time of a block.
#
# Example:
#
# Gitlab::Metrics.measure(:find_by_username_duration) do
# UserFinder.new(some_username).find_by_username
# end
#
# name - The name of the field to store the execution time in.
#
# Returns the value yielded by the supplied block.
def self.measure(name)
trans = current_transaction
return yield unless trans
real_start = System.monotonic_time
cpu_start = System.cpu_time
retval = yield
cpu_stop = System.cpu_time
real_stop = System.monotonic_time
real_time = (real_stop - real_start)
cpu_time = cpu_stop - cpu_start
real_duration_seconds = fetch_histogram("gitlab_#{name}_real_duration_seconds".to_sym) do
docstring "Measure #{name}"
base_labels Transaction::BASE_LABELS
buckets EXECUTION_MEASUREMENT_BUCKETS
end
real_duration_seconds.observe(trans.labels, real_time)
cpu_duration_seconds = fetch_histogram("gitlab_#{name}_cpu_duration_seconds".to_sym) do
docstring "Measure #{name}"
base_labels Transaction::BASE_LABELS
buckets EXECUTION_MEASUREMENT_BUCKETS
with_feature "prometheus_metrics_measure_#{name}_cpu_duration"
end
cpu_duration_seconds.observe(trans.labels, cpu_time)
trans.increment("#{name}_real_time", real_time.in_milliseconds, false)
trans.increment("#{name}_cpu_time", cpu_time.in_milliseconds, false)
trans.increment("#{name}_call_count", 1, false)
retval
end
end
end
......@@ -20,10 +20,6 @@ module Gitlab
trans.add_event(:rails_exception)
raise error
# Even in the event of an error we want to submit any metrics we
# might've gathered up to this point.
ensure
trans.finish
end
retval
......
......@@ -17,8 +17,6 @@ module Gitlab
trans.add_event(:sidekiq_exception)
raise error
ensure
trans.finish
end
end
end
......
......@@ -26,23 +26,17 @@ module Gitlab
private
def track(event)
values = values_for(event)
tags = tags_for(event)
tags = tags_for(event)
self.class.gitlab_view_rendering_duration_seconds.observe(current_transaction.labels.merge(tags), event.duration)
current_transaction.increment(:view_duration, event.duration)
current_transaction.add_metric(SERIES, values, tags)
end
def relative_path(path)
path.gsub(%r{^#{Rails.root}/?}, '')
end
def values_for(event)
{ duration: event.duration }
end
def tags_for(event)
path = relative_path(event.payload[:identifier])
......
......@@ -16,20 +16,18 @@ module Gitlab
# The series to store events (e.g. Git pushes) in.
EVENT_SERIES = 'events'
attr_reader :tags, :values, :method, :metrics
attr_reader :tags, :method
def self.current
Thread.current[THREAD_KEY]
end
def initialize
@metrics = []
@methods = {}
@started_at = nil
@finished_at = nil
@values = Hash.new(0)
@tags = {}
@memory_before = 0
......@@ -40,10 +38,6 @@ module Gitlab
@finished_at ? (@finished_at - @started_at) : 0.0
end
def duration_milliseconds
duration.in_milliseconds.to_i
end
def thread_cpu_duration
System.thread_cpu_duration(@thread_cputime_start)
end
......@@ -71,10 +65,6 @@ module Gitlab
Thread.current[THREAD_KEY] = nil
end
def add_metric(series, values, tags = {})
@metrics << Metric.new("#{::Gitlab::Metrics.series_prefix}#{series}", values, filter_tags(tags))
end
# Tracks a business level event
#
# Business level events including events such as Git pushes, Emails being
......@@ -85,7 +75,6 @@ module Gitlab
def add_event(event_name, tags = {})
filtered_tags = filter_tags(tags)
self.class.transaction_metric(event_name, :counter, prefix: 'event_', tags: filtered_tags).increment(filtered_tags.merge(labels))
@metrics << Metric.new(EVENT_SERIES, { count: 1 }, filtered_tags.merge(event: event_name), :event)
end
# Returns a MethodCall object for the given name.
......@@ -99,55 +88,16 @@ module Gitlab
def increment(name, value, use_prometheus = true)
self.class.transaction_metric(name, :counter).increment(labels, value) if use_prometheus
@values[name] += value
end
def set(name, value, use_prometheus = true)
self.class.transaction_metric(name, :gauge).set(labels, value) if use_prometheus
@values[name] = value
end
def finish
track_self
submit
end
def track_self
values = { duration: duration_milliseconds, allocated_memory: allocated_memory }
@values.each do |name, value|
values[name] = value
end
add_metric('transactions', values, @tags)
end
def submit
submit = @metrics.dup
@methods.each do |name, method|
submit << method.to_metric if method.above_threshold?
end
submit_hashes = submit.map do |metric|
hash = metric.to_hash
hash[:tags][:action] ||= action if action && !metric.event?
hash
end
::Gitlab::Metrics.submit_metrics(submit_hashes)
end
def labels
BASE_LABELS
end
# returns string describing the action performed, usually the class plus method name.
def action
"#{labels[:controller]}##{labels[:action]}" if labels && !labels.empty?
end
define_histogram :gitlab_transaction_cputime_seconds do
docstring 'Transaction thread cputime'
base_labels BASE_LABELS
......
......@@ -172,7 +172,6 @@ module Gitlab
dependency_proxy_enabled: Gitlab.config.try(:dependency_proxy)&.enabled,
gitlab_shared_runners_enabled: alt_usage_data { Gitlab.config.gitlab_ci.shared_runners_enabled },
gravatar_enabled: alt_usage_data { Gitlab::CurrentSettings.gravatar_enabled? },
influxdb_metrics_enabled: alt_usage_data { Gitlab::Metrics.influx_metrics_enabled? },
ldap_enabled: alt_usage_data { Gitlab.config.ldap.enabled },
mattermost_enabled: alt_usage_data { Gitlab.config.mattermost.enabled },
omniauth_enabled: alt_usage_data { Gitlab::Auth.omniauth_enabled? },
......
......@@ -5,15 +5,11 @@ require 'spec_helper'
describe 'instrument_classes' do
let(:config) { double(:config) }
let(:influx_sampler) { double(:influx_sampler) }
before do
allow(config).to receive(:instrument_method)
allow(config).to receive(:instrument_methods)
allow(config).to receive(:instrument_instance_method)
allow(config).to receive(:instrument_instance_methods)
allow(Gitlab::Metrics::Samplers::InfluxSampler).to receive(:initialize_instance).and_return(influx_sampler)
allow(influx_sampler).to receive(:start)
allow(Gitlab::Application).to receive(:configure)
end
......
......@@ -7,12 +7,6 @@ describe Gitlab::Metrics::BackgroundTransaction do
subject { described_class.new(test_worker_class) }
describe '#action' do
it 'returns transaction action name' do
expect(subject.action).to eq('TestWorker#perform')
end
end
describe '#label' do
it 'returns labels based on class name' do
expect(subject.labels).to eq(controller: 'TestWorker', action: 'perform')
......
......@@ -10,10 +10,6 @@ describe Gitlab::Metrics::RackMiddleware do
let(:env) { { 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/foo' } }
describe '#call' do
before do
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish)
end
it 'tracks a transaction' do
expect(app).to receive(:call).with(env).and_return('yay')
......@@ -36,26 +32,5 @@ describe Gitlab::Metrics::RackMiddleware do
it 'returns a Transaction' do
expect(transaction).to be_an_instance_of(Gitlab::Metrics::WebTransaction)
end
it 'stores the request method and URI in the transaction as values' do
expect(transaction.values[:request_method]).to eq('GET')
expect(transaction.values[:request_uri]).to eq('/foo')
end
context "when URI includes sensitive parameters" do
let(:env) do
{
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/foo?private_token=my-token',
'PATH_INFO' => '/foo',
'QUERY_STRING' => 'private_token=my_token',
'action_dispatch.parameter_filter' => [:private_token]
}
end
it 'stores the request URI with the sensitive parameters filtered' do
expect(transaction.values[:request_uri]).to eq('/foo?private_token=[FILTERED]')
end
end
end
end
......@@ -17,8 +17,6 @@ describe Gitlab::Metrics::SidekiqMiddleware do
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set)
.with(:sidekiq_queue_duration, instance_of(Float))
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish)
middleware.call(worker, message, :test) { nil }
end
......@@ -32,8 +30,6 @@ describe Gitlab::Metrics::SidekiqMiddleware do
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set)
.with(:sidekiq_queue_duration, instance_of(Float))
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish)
middleware.call(worker, {}, :test) { nil }
end
......@@ -46,9 +42,6 @@ describe Gitlab::Metrics::SidekiqMiddleware do
expect_any_instance_of(Gitlab::Metrics::Transaction)
.to receive(:add_event).with(:sidekiq_exception)
expect_any_instance_of(Gitlab::Metrics::Transaction)
.to receive(:finish)
expect { middleware.call(worker, message, :test) }
.to raise_error(RuntimeError)
end
......
......@@ -21,15 +21,9 @@ describe Gitlab::Metrics::Subscribers::ActionView do
describe '#render_template' do
it 'tracks rendering of a template' do
values = { duration: 2.1 }
tags = { view: 'app/views/x.html.haml' }
expect(transaction).to receive(:increment)
.with(:view_duration, 2.1)
expect(transaction).to receive(:add_metric)
.with(described_class::SERIES, values, tags)
subscriber.render_template(event)
end
......
......@@ -4,7 +4,6 @@ require 'spec_helper'
describe Gitlab::Metrics::Transaction do
let(:transaction) { described_class.new }
let(:metric) { transaction.metrics[0] }
let(:sensitive_tags) do
{
......@@ -13,12 +12,6 @@ describe Gitlab::Metrics::Transaction do
}
end
shared_examples 'tag filter' do |sane_tags|
it 'filters potentially sensitive tags' do
expect(metric.tags).to eq(sane_tags)
end
end
describe '#duration' do
it 'returns the duration of a transaction in seconds' do
transaction.run { }
......@@ -61,25 +54,6 @@ describe Gitlab::Metrics::Transaction do
end
end
describe '#add_metric' do
it 'adds a metric to the transaction' do
transaction.add_metric('foo', value: 1)
expect(metric.series).to eq('rails_foo')
expect(metric.tags).to eq({})
expect(metric.values).to eq(value: 1)
end
context 'with sensitive tags' do
before do
transaction
.add_metric('foo', { value: 1 }, **sensitive_tags.merge(sane: 'yes'))
end
it_behaves_like 'tag filter', sane: 'yes'
end
end
describe '#method_call_for' do
it 'returns a MethodCall' do
method = transaction.method_call_for('Foo#bar', :Foo, '#bar')
......@@ -88,133 +62,23 @@ describe Gitlab::Metrics::Transaction do
end
end
describe '#increment' do
it 'increments a counter' do
transaction.increment(:time, 1)
transaction.increment(:time, 2)
values = metric_values(time: 3)
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
end
end
describe '#set' do
it 'sets a value' do
transaction.set(:number, 10)
values = metric_values(number: 10)
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
end
end
describe '#finish' do
it 'tracks the transaction details and submits them to Sidekiq' do
expect(transaction).to receive(:track_self)
expect(transaction).to receive(:submit)
transaction.finish
end
end
describe '#track_self' do
it 'adds a metric for the transaction itself' do
values = metric_values
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
end
end
describe '#submit' do
it 'submits the metrics to Sidekiq' do
transaction.track_self
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([an_instance_of(Hash)])
transaction.submit
end
it 'adds the action as a tag for every metric' do
allow(transaction)
.to receive(:labels)
.and_return(controller: 'Foo', action: 'bar')
transaction.track_self
hash = {
series: 'rails_transactions',
tags: { action: 'Foo#bar' },
values: metric_values,
timestamp: a_kind_of(Integer)
}
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([hash])
transaction.submit
end
it 'does not add an action tag for events' do
allow(transaction)
.to receive(:labels)
.and_return(controller: 'Foo', action: 'bar')
transaction.add_event(:meow)
hash = {
series: 'events',
tags: { event: :meow },
values: { count: 1 },
timestamp: a_kind_of(Integer)
}
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([hash])
transaction.submit
end
end
describe '#add_event' do
it 'adds a metric' do
transaction.add_event(:meow)
let(:prometheus_metric) { instance_double(Prometheus::Client::Counter, increment: nil) }
expect(metric).to be_an_instance_of(Gitlab::Metrics::Metric)
before do
allow(described_class).to receive(:transaction_metric).and_return(prometheus_metric)
end
it "does not prefix the metric's series name" do
transaction.add_event(:meow)
expect(metric.series).to eq(described_class::EVENT_SERIES)
end
it 'tracks a counter for every event' do
transaction.add_event(:meow)
expect(metric.values).to eq(count: 1)
end
it 'adds a metric' do
expect(prometheus_metric).to receive(:increment)
it 'tracks the event name' do
transaction.add_event(:meow)
expect(metric.tags).to eq(event: :meow)
end
it 'allows tracking of custom tags' do
transaction.add_event(:bau, animal: 'dog')
expect(prometheus_metric).to receive(:increment).with(hash_including(animal: "dog"))
expect(metric.tags).to eq(event: :bau, animal: 'dog')
transaction.add_event(:bau, animal: 'dog')
end
context 'with sensitive tags' do
......@@ -222,16 +86,11 @@ describe Gitlab::Metrics::Transaction do
transaction.add_event(:baubau, **sensitive_tags.merge(sane: 'yes'))
end
it_behaves_like 'tag filter', event: :baubau, sane: 'yes'
end
end
private
it 'filters tags' do
expect(prometheus_metric).not_to receive(:increment).with(hash_including(sensitive_tags))
def metric_values(opts = {})
{
duration: 0.0,
allocated_memory: a_kind_of(Numeric)
}.merge(opts)
transaction.add_event(:baubau, **sensitive_tags.merge(sane: 'yes'))
end
end
end
end
......@@ -5,6 +5,11 @@ require 'spec_helper'
describe Gitlab::Metrics::WebTransaction do
let(:env) { {} }
let(:transaction) { described_class.new(env) }
let(:prometheus_metric) { double("prometheus metric") }
before do
allow(described_class).to receive(:transaction_metric).and_return(prometheus_metric)
end
describe '#duration' do
it 'returns the duration of a transaction in seconds' do
......@@ -40,15 +45,6 @@ describe Gitlab::Metrics::WebTransaction do
end
end
describe '#add_metric' do
it 'adds a metric to the transaction' do
expect(Gitlab::Metrics::Metric).to receive(:new)
.with('rails_foo', { number: 10 }, {})
transaction.add_metric('foo', number: 10)
end
end
describe '#method_call_for' do
it 'returns a MethodCall' do
method = transaction.method_call_for('Foo#bar', :Foo, '#bar')
......@@ -59,101 +55,17 @@ describe Gitlab::Metrics::WebTransaction do
describe '#increment' do
it 'increments a counter' do
transaction.increment(:time, 1)
transaction.increment(:time, 2)
values = { duration: 0.0, time: 3, allocated_memory: a_kind_of(Numeric) }
expect(prometheus_metric).to receive(:increment).with({}, 1)
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
transaction.increment(:time, 1)
end
end
describe '#set' do
it 'sets a value' do
transaction.set(:number, 10)
values = {
duration: 0.0,
number: 10,
allocated_memory: a_kind_of(Numeric)
}
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
end
end
describe '#finish' do
it 'tracks the transaction details and submits them to Sidekiq' do
expect(transaction).to receive(:track_self)
expect(transaction).to receive(:submit)
transaction.finish
end
end
describe '#track_self' do
it 'adds a metric for the transaction itself' do
values = {
duration: transaction.duration,
allocated_memory: a_kind_of(Numeric)
}
expect(transaction).to receive(:add_metric)
.with('transactions', values, {})
transaction.track_self
end
end
describe '#submit' do
it 'submits the metrics to Sidekiq' do
transaction.track_self
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([an_instance_of(Hash)])
transaction.submit
end
expect(prometheus_metric).to receive(:set).with({}, 10)
it 'adds the action as a tag for every metric' do
allow(transaction).to receive(:labels).and_return(controller: 'Foo', action: 'bar')
transaction.track_self
hash = {
series: 'rails_transactions',
tags: { action: 'Foo#bar' },
values: { duration: 0.0, allocated_memory: a_kind_of(Numeric) },
timestamp: a_kind_of(Integer)
}
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([hash])
transaction.submit
end
it 'does not add an action tag for events' do
allow(transaction).to receive(:labels).and_return(controller: 'Foo', action: 'bar')
transaction.add_event(:meow)
hash = {
series: 'events',
tags: { event: :meow },
values: { count: 1 },
timestamp: a_kind_of(Integer)
}
expect(Gitlab::Metrics).to receive(:submit_metrics)
.with([hash])
transaction.submit
transaction.set(:number, 10)
end
end
......@@ -167,7 +79,6 @@ describe Gitlab::Metrics::WebTransaction do
end
it 'provides labels with the method and path of the route in the grape endpoint' do
expect(transaction.labels).to eq({ controller: 'Grape', action: 'GET /projects/:id/archive' })
expect(transaction.action).to eq('Grape#GET /projects/:id/archive')
end
it 'does not provide labels if route infos are missing' do
......@@ -177,7 +88,6 @@ describe Gitlab::Metrics::WebTransaction do
env['api.endpoint'] = endpoint
expect(transaction.labels).to eq({})
expect(transaction.action).to be_nil
end
end
......@@ -193,7 +103,6 @@ describe Gitlab::Metrics::WebTransaction do
it 'tags a transaction with the name and action of a controller' do
expect(transaction.labels).to eq({ controller: 'TestController', action: 'show' })
expect(transaction.action).to eq('TestController#show')
end
context 'when the request content type is not :html' do
......@@ -201,7 +110,6 @@ describe Gitlab::Metrics::WebTransaction do
it 'appends the mime type to the transaction action' do
expect(transaction.labels).to eq({ controller: 'TestController', action: 'show.json' })
expect(transaction.action).to eq('TestController#show.json')
end
end
......@@ -210,54 +118,26 @@ describe Gitlab::Metrics::WebTransaction do
it 'does not append the MIME type to the transaction action' do
expect(transaction.labels).to eq({ controller: 'TestController', action: 'show' })
expect(transaction.action).to eq('TestController#show')
end
end
end
it 'returns no labels when no route information is present in env' do
expect(transaction.labels).to eq({})
expect(transaction.action).to eq(nil)
end
end
describe '#add_event' do
it 'adds a metric' do
transaction.add_event(:meow)
expect(prometheus_metric).to receive(:increment)
expect(transaction.metrics[0]).to be_an_instance_of(Gitlab::Metrics::Metric)
end
it "does not prefix the metric's series name" do
transaction.add_event(:meow)
metric = transaction.metrics[0]
expect(metric.series).to eq(described_class::EVENT_SERIES)
end
it 'tracks a counter for every event' do
transaction.add_event(:meow)
metric = transaction.metrics[0]
expect(metric.values).to eq(count: 1)
end
it 'tracks the event name' do
transaction.add_event(:meow)
metric = transaction.metrics[0]
expect(metric.tags).to eq(event: :meow)
end
it 'allows tracking of custom tags' do
transaction.add_event(:bau, animal: 'dog')
metric = transaction.metrics[0]
expect(prometheus_metric).to receive(:increment).with(animal: "dog")
expect(metric.tags).to eq(event: :bau, animal: 'dog')
transaction.add_event(:bau, animal: 'dog')
end
end
end
......@@ -53,60 +53,6 @@ describe Gitlab::Metrics do
end
end
describe '.influx_metrics_enabled?' do
it 'returns a boolean' do
expect(described_class.influx_metrics_enabled?).to be_in([true, false])
end
end
describe '.submit_metrics' do
it 'prepares and writes the metrics to InfluxDB' do
connection = double(:connection)
pool = double(:pool)
expect(pool).to receive(:with).and_yield(connection)
expect(connection).to receive(:write_points).with(an_instance_of(Array))
expect(described_class).to receive(:pool).and_return(pool)
described_class.submit_metrics([{ 'series' => 'kittens', 'tags' => {} }])
end
end
describe '.prepare_metrics' do
it 'returns a Hash with the keys as Symbols' do
metrics = described_class
.prepare_metrics([{ 'values' => {}, 'tags' => {} }])
expect(metrics).to eq([{ values: {}, tags: {} }])
end
it 'escapes tag values' do
metrics = described_class.prepare_metrics([
{ 'values' => {}, 'tags' => { 'foo' => 'bar=' } }
])
expect(metrics).to eq([{ values: {}, tags: { 'foo' => 'bar\\=' } }])
end
it 'drops empty tags' do
metrics = described_class.prepare_metrics([
{ 'values' => {}, 'tags' => { 'cats' => '', 'dogs' => nil } }
])
expect(metrics).to eq([{ values: {}, tags: {} }])
end
end
describe '.escape_value' do
it 'escapes an equals sign' do
expect(described_class.escape_value('foo=')).to eq('foo\\=')
end
it 'casts values to Strings' do
expect(described_class.escape_value(10)).to eq('10')
end
end
describe '.measure' do
context 'without a transaction' do
it 'returns the return value of the block' do
......@@ -145,30 +91,6 @@ describe Gitlab::Metrics do
end
end
describe '.action=' do
context 'without a transaction' do
it 'does nothing' do
expect_any_instance_of(Gitlab::Metrics::Transaction)
.not_to receive(:action=)
described_class.action = 'foo'
end
end
context 'with a transaction' do
it 'sets the action of a transaction' do
trans = Gitlab::Metrics::WebTransaction.new({})
expect(described_class).to receive(:current_transaction)
.and_return(trans)
expect(trans).to receive(:action=).with('foo')
described_class.action = 'foo'
end
end
end
describe '#series_prefix' do
it 'returns a String' do
expect(described_class.series_prefix).to be_an_instance_of(String)
......
......@@ -133,7 +133,6 @@ module UsageDataHelpers
gitaly
database
avg_cycle_analytics
influxdb_metrics_enabled
prometheus_metrics_enabled
web_ide_clientside_preview_enabled
ingress_modsecurity_enabled
......
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